# Following IDs

`GET https://api.twittrapi.com/user/{userId}/followings/ids`

IDs of the accounts a user follows, up to 5,000 per call.

HTML page: https://www.twittrapi.com/docs/reference/user-userid-followings-ids

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `userId` | path | string | yes |  | Numeric user ID (digits only, up to 30). To pass a handle instead, use -1 here and set username. |
| `username` | query | string | no |  | Handle, with or without @. When set, it is used instead of userId: the API looks up the ID first, which makes the call a little slower. Still one billed call. |
| `count` | query | integer | no | 5000 | IDs per page, 1 to 5,000. Values outside that range use 5,000. |
| `cursor` | query | string | no |  | nextCursor from the previous page. Leave it out for the first page. 0 means there are no more pages. |

Paginated: pass the bottom cursor of one page as `cursor` to get the next. Each page is one billed call.

## Notes

- One call returns up to 5,000 IDs, so a list of 1 million followers takes about 200 calls.
- Pages can occasionally be smaller (about 100 IDs) when X serves the list in smaller pages; keep following nextCursor.
- No simple format: with format=simple the response is the same as without it.

## Response

Built by the API: {"ids": ["123", ...], "nextCursor": "...", "previousCursor": "..."}. IDs are strings, newest first. nextCursor "0" means the list is complete.

## Errors

| Status | When |
| --- | --- |
| 422 | userId is not numeric, or the username lookup failed. |
| 400 | userId is -1 and username is missing, or the username contains characters X blocks. |
| 404 | The user could not be found. |
| 400 | cursor is 0 (the end of the list was already reached). |

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, 407, 408, 409 or a 5xx error are refunded.

## Example request

curl:

```bash
curl 'https://api.twittrapi.com/user/44196397/followings/ids?count=5000' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

Python:

```python
import httpx

# No SDK method for this endpoint yet, so this is a plain HTTP call.
resp = httpx.get(
    "https://api.twittrapi.com/user/44196397/followings/ids",
    headers={"X-API-KEY": "YOUR_API_KEY"},
    params={
        "count": "5000",
    },
    timeout=60,
)
data = resp.json()
```

Node.js:

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

const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
// No wrapper method for this endpoint yet; client.get() sends the same authenticated GET.
const data = await client.get({
  path: "/user/44196397/followings/ids",
  query: {
    count: "5000",
  },
});
```

RapidAPI:

```bash
curl 'https://twitter-aio.p.rapidapi.com/user/44196397/followings/ids?count=5000' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'
```
