---
title: "Get User Profiles by Usernames - API Reference"
description: "Retrieve up to 100 Twitter/X user profiles by username in a single request. Flat-rate $0.0002 per profile, no subscription plans."
source: "https://docs.socialdata.tools/reference/get-multiple-user-profiles-by-usernames/"
---

> **Deprecated**
> 
> This endpoint is deprecated and is no longer recommended for new integrations. Use the [“users-by-ids” endpoint](https://docs.socialdata.tools/reference/get-multiple-user-profiles/) instead — it returns the same profile objects with more reliable results. This page remains published for existing integrations only, and the endpoint may be removed in the future.

> **Caution**
> 
> Due to limitations in our data source, this endpoint cannot provide accurate values for the “verified” and “can\_dm” attributes. We recommend using the [“users-by-ids” endpoint](https://docs.socialdata.tools/reference/get-multiple-user-profiles/) instead for more reliable results.

Retrieve user information for up to 100 users per request.

POST https://api.socialdata.tools/twitter/users-by-usernames

## Headers

**Authorization** `string` — required

Authorization Bearer header containing your SocialData API key

Example: Bearer YOUR\_API\_KEY

## Body

**usernames** `array` — required

An array of Twitter usernames. Up to 100 usernames per request

Example: \["elonmusk", "realdonaldtrump", ...\]

## Code Examples

#### curl

```shellscript
curl "https://api.socialdata.tools/twitter/users-by-usernames" \
    -X POST \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -d '{"usernames": ["elonmusk", "realdonaldtrump"]}'
```

#### JavaScript

```js
const usernames = ["elonmusk", "realdonaldtrump"];
const API_KEY = 'YOUR_API_KEY_HERE';

fetch('https://api.socialdata.tools/twitter/users-by-usernames', {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
        'Accept': 'application/json'
    },
    body: JSON.stringify({ usernames })
})
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
```

#### Python

```python
import requests

usernames = ['elonmusk', 'realdonaldtrump']
API_KEY = 'YOUR_API_KEY_HERE'

url = 'https://api.socialdata.tools/twitter/users-by-usernames'

headers = {
    'Authorization': f'Bearer {API_KEY}',
    'Content-Type': 'application/json',
    'Accept': 'application/json'
}

payload = {'usernames': usernames}

response = requests.post(url, json=payload, headers=headers)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Error: {response.status_code}")
    print(response.text)
```

#### PHP

```php
$usernames = ["elonmusk", "realdonaldtrump"];
$API_KEY = 'YOUR_API_KEY_HERE';

$url = "https://api.socialdata.tools/twitter/users-by-usernames";

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode(['usernames' => $usernames]),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $API_KEY",
        "Content-Type: application/json",
        "Accept: application/json"
    ]
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data);

curl_close($ch);
```

## Example Responses

#### 200

```json
{
    "users": [
        {
            "id": 44196397,
            "id_str": "44196397",
            "name": "Elon Musk",
            "screen_name": "elonmusk",
            "location": "\\ud835\\udd4f\\u00d0",
            "url": null,
            "description": "",
            "protected": false,
            "verified": false, // This endpoint is unable to provide correct Blue-checkmark verified status. Please use users-by-ids instead
            "followers_count": 166213974,
            "friends_count": 506,
            "listed_count": 149577,
            "favourites_count": 37987,
            "statuses_count": 34934,
            "created_at": "2009-06-02T20:12:29.000000Z",
            "profile_banner_url": "https:\\/\\/pbs.twimg.com\\/profile_banners\\/44196397\\/1690621312",
            "profile_image_url_https": "https:\\/\\/pbs.twimg.com\\/profile_images\\/1683325380441128960\\/yRsRRjGO_normal.jpg",
            "can_dm": null // This endpoint is unable to provide correct can_dm value. Please use users-by-ids instead
        },
        // ...
    ]
}
```

#### 402

```json
{
    "status": "error",
    "message": "Insufficient balance"
}
```

#### 404

```json
{
    "status": "error",
    "message": "User not found"
}
```

#### 500

```json
{
    "status": "error",
    "message": "Failed to fetch data from Twitter"
}
```

## Response Codes

-   **200 OK** - request succeeded
-   **402 Payment Required** - not enough credits to perform this request
-   **422 Unprocessable Content** - validation failed (e.g. one of the required parameters was not provided)
-   **500 Internal Error** - API internal error, typically means that SocialData API failed to obtain the requested information and you should try again later

## Before you integrate

-   [Authentication](https://docs.socialdata.tools/getting-started/authentication/)
-   [Rate limits](https://docs.socialdata.tools/getting-started/rate-limits/)
-   [Errors](https://docs.socialdata.tools/getting-started/errors/)
-   [Pricing](https://docs.socialdata.tools/getting-started/pricing/)
