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

Retrieve user information for up to 100 users per request.

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

## Headers

**Authorization** `string` — required

Authorization Bearer header containing your SocialData API key

Example: Bearer YOUR\_API\_KEY

## Body

**ids** `array` — required

An array of Twitter user IDs. Up to 100 IDs per request

Example: \["44196397", "1319287761048723458", ...\]

> **Caution**
> 
> When using languages where the `user_id` value exceeds the default Integer type limit (e.g., JavaScript), you should store `user_id` as a String. Use the `id_str` property returned by the API for these values

## Code Examples

#### curl

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

#### JavaScript

```js
const ids = ["44196397", "1319287761048723458"];
const API_KEY = 'YOUR_API_KEY_HERE';

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

#### Python

```python
import requests

ids = [44196397, 1319287761048723458]
API_KEY = 'YOUR_API_KEY_HERE'

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

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

payload = {'ids': ids}

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
$ids = [44196397, 1319287761048723458];
$API_KEY = 'YOUR_API_KEY_HERE';

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

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode(['ids' => $ids]),
    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": true,
            "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": false
        },
        // ...
    ]
}
```

#### 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

## Related endpoints

-   [Get user profile](https://docs.socialdata.tools/reference/get-user-profile/)
-   [Get user extended bio](https://docs.socialdata.tools/reference/get-user-extended-bio/)
-   [Get similar profiles](https://docs.socialdata.tools/reference/get-user-similar-profiles/)
-   [Get user affiliates](https://docs.socialdata.tools/reference/get-user-affiliates/)

## 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/)
