# Users by IDs

`GET https://api.twittrapi.com/user/users/by/ids`

Profiles of up to 100 accounts in one call.

HTML page: https://www.twittrapi.com/docs/reference/user-users-by-ids

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `ids` | query | string (comma-separated) | yes |  | Numeric user IDs separated by commas. At most 100. |

Every read endpoint also accepts `format=simple` (or the header `X-Response-Format: simple`) for compact, flat JSON with a fixed schema. Same price.

## Response

Raw JSON of X's UsersByRestIds query (data.users, one result per ID).

With `format=simple`: Collection of User objects without cursors (hasNextPage false). Accounts X does not return are left out.

## Errors

| Status | When |
| --- | --- |
| 400 | ids is missing, or has more than 100 IDs. |
| 422 | One of the IDs is not numeric. |

Shared errors (401 missing key, 402 no balance, 429 rate limit, 5xx) are listed on https://www.twittrapi.com/docs/helpful-infos/error-handling. Calls that fail with 400, 408, 409 or a 5xx error are refunded.

## Example request

curl:

```bash
curl 'https://api.twittrapi.com/user/users/by/ids?ids=12,783214' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

Python:

```python
from twittrapi import TwittrAPI

client = TwittrAPI(api_key="YOUR_API_KEY")
data = client.users.get_many(["12", "783214"])
```

Node.js:

```js
import { TwittrAPI } from "twittrapi";

const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
const data = await client.users.getMany(["12", "783214"]);
```

RapidAPI:

```bash
curl 'https://twitter-aio.p.rapidapi.com/user/users/by/ids?ids=12,783214' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'
```

## Example response

Shortened: arrays keep their first items and long strings are cut.

Raw (default):

```json
{
  "data": {
    "users": [
      {
        "result": {
          "__typename": "User",
          "affiliates_highlighted_label": {
            "label": {
              "badge": {
                "url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg"
              },
              "description": "X",
              "url": {
                "url": "https://twitter.com/X",
                "urlType": "DeepLink"
              },
              "userLabelDisplayType": "Badge",
              "userLabelType": "BusinessLabel"
            }
          },
          "has_graduated_access": true,
          "id": "VXNlcjoyMjQ0OTk0OTQ1",
          "is_blue_verified": true,
          "legacy": {
            "blocked_by": false,
            "blocking": false,
            "can_dm": true,
            "can_media_tag": true,
            "created_at": "Sat Dec 14 04:35:55 +0000 2013",
            "default_profile": false,
            "default_profile_image": false,
            "description": "The voice of the X Dev team and your official source for updates, news, and events, related to the X API.",
            "entities": {
              "description": {},
              "url": {
                "urls": [
                  {
                    "display_url": "docs.x.com",
                    "expanded_url": "https://docs.x.com/",
                    "indices": [
                      0,
                      23
                    ],
                    "url": "https://t.co/NIwHVIVyrN"
                  }
                ]
              }
            },
            "fast_followers_count": 0,
            "favourites_count": 2758,
            "follow_request_sent": false,
            "followed_by": false,
            "followers_count": 698074,
            "following": false,
            "friends_count": 770,
            "has_custom_timelines": true,
            "is_translator": false,
            "listed_count": 2977,
            "location": "127.0.0.1",
            "media_count": 832,
            "muting": false,
            "name": "Developers",
            "needs_phone_verification": false,
            "normal_followers_count": 698074,
            "notifications": false,
            "pinned_tweet_ids_str": [
              "2019881223666233717"
            ],
            "possibly_sensitive": false,
            "profile_banner_url": "https://pbs.twimg.com/profile_banners/2244994945/1690213128",
            "profile_image_url_https": "https://pbs.twimg.com/profile_images/1683501992314798080/xl1POYLw_normal.jpg",
            "profile_interstitial_type": "",
            "protected": false,
            "screen_name": "XDevelopers",
            "statuses_count": 4376,
            "time_zone": "",
            "translator_type": "regular",
            "url": "https://t.co/NIwHVIVyrN",
            "utc_offset": 0,
            "verified": false,
            "verified_type": "Business",
            "want_retweets": false,
            "withheld_description": "",
            "withheld_scope": ""
          },
          "parody_commentary_fan_label": "None",
          "professional": {
            "category": [
              {
                "icon_name": "IconBriefcaseStroke",
… (19 more lines)
```

Simple (`format=simple`):

```json
{
  "data": [
    {
      "id": "2244994945",
      "username": "XDevelopers",
      "name": "Developers",
      "description": "The voice of the X Dev team and your official source for updates, news, and events, related to the X API.",
      "location": "127.0.0.1",
      "url": "https://docs.x.com/",
      "createdAt": "2013-12-14T04:35:55Z",
      "avatarUrl": "https://pbs.twimg.com/profile_images/1683501992314798080/xl1POYLw.jpg",
      "bannerUrl": "https://pbs.twimg.com/profile_banners/2244994945/1690213128",
      "verified": true,
      "verifiedType": "Business",
      "protected": false,
      "counts": {
        "followers": 698074,
        "following": 770,
        "tweets": 4376,
        "likes": 2758,
        "media": 832,
        "listed": 2977
      },
      "pinnedTweetIds": [
        "2019881223666233717"
      ],
      "isAutomated": false
    },
    "… 1 more"
  ],
  "nextCursor": null,
  "previousCursor": null,
  "hasNextPage": false
}
```
