Twitter Following API (X Following)
Twitter Following API — list the accounts an X (Twitter) user follows, with full profiles. Paginated JSON, $0.01 per call.
/v1/twitter/user-followingLists the accounts an X user follows, each with a full profile. The reverse direction is the Twitter Followers API.
Usage
const res = await fetch('https://api.yepapi.com/v1/twitter/user-following', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({"username": "NASA", "count": 20}),
});
const { data } = await res.json();
console.log(data);curl -X POST https://api.yepapi.com/v1/twitter/user-following \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"username": "NASA", "count": 20}'import requests
res = requests.post(
"https://api.yepapi.com/v1/twitter/user-following",
headers={"x-api-key": "YOUR_API_KEY"},
json={"username": "NASA", "count": 20},
)
print(res.json()["data"])Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
username | string | One of | X handle — NASA, @NASA, or an x.com / twitter.com profile URL | — |
user_id | string | One of | Numeric X user ID (skips the username lookup). Send username or user_id | — |
count | number | No | Page size hint, 1–100 | 20 |
cursor | string | No | cursor from the previous response, to fetch the next page | — |
Response
{
"ok": true,
"data": {
"cursor": "1597662469098825850|2116337024431554491",
"users": [
{
"avatar": "https://pbs.twimg.com/profile_images/3468011581/efb985f24af0a814a722457a768f3cc5_400x400.jpeg",
"banner": "https://pbs.twimg.com/profile_banners/14091091/1669391293",
"created_at": "2008-03-06T20:15:02+00:00",
"description": "The official X account for the NASA Hubble Space Telescope, managed and operated by NASA's Goddard Space Flight Center.",
"followers_count": 8895459,
"following_count": 44,
"id": "14091091",
"is_blue_verified": true,
"likes_count": 1243,
"listed_count": 15212,
"location": "Goddard Space Flight Center",
"media_count": 3156,
"name": "Hubble",
"pinned_tweet_ids": [],
"protected": false,
"tweet_count": 8501,
"url": "https://x.com/NASAHubble",
"username": "NASAHubble",
"verified": false,
"verified_type": "Government",
"website": "http://www.nasa.gov/mission_pages/hubble/main/index.html"
},
{
"avatar": "https://pbs.twimg.com/profile_images/1767989888916299776/hFYvpxZM_400x400.jpg",
"banner": "https://pbs.twimg.com/profile_banners/29472803/1657642323",
"created_at": "2009-04-07T15:40:56+00:00",
"description": "The Official *NASA* Webb X account. \n\nThe world's most powerful space telescope. Launched: Dec. 25, 2021. First images revealed: July 12, 2022.",
"followers_count": 3513964,
"following_count": 63,
"id": "29472803",
"is_blue_verified": true,
"likes_count": 4463,
"listed_count": 11772,
"location": "Lagrange Point 2",
"media_count": 3184,
"name": "NASA Webb Telescope",
"pinned_tweet_ids": [
"2116182214584975591"
],
"protected": false,
"tweet_count": 11592,
"url": "https://x.com/NASAWebb",
"username": "NASAWebb",
"verified": false,
"verified_type": "Government",
"website": "https://nasa.gov/webb"
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data.users | object[] | Accounts |
data.users[].id | string | Numeric user ID — use it as user_id on timeline endpoints |
data.users[].username | string | Handle without @ |
data.users[].name | string | Display name |
data.users[].description | string | null | Bio |
data.users[].location | string | null | Location from the profile |
data.users[].website | string | null | Website link from the profile |
data.users[].created_at | string | Account creation, ISO 8601 |
data.users[].avatar | string | null | Profile image URL (400×400) |
data.users[].banner | string | null | Banner image URL |
data.users[].url | string | x.com profile URL |
data.users[].followers_count | number | Followers |
data.users[].following_count | number | Accounts followed |
data.users[].tweet_count | number | Posts, including replies and reposts |
data.users[].likes_count | number | Posts liked |
data.users[].media_count | number | Photos and videos posted |
data.users[].listed_count | number | Lists the account is on |
data.users[].is_blue_verified | boolean | Has a blue check |
data.users[].verified | boolean | Legacy verification flag |
data.users[].verified_type | string | null | Business, Government, or null |
data.users[].protected | boolean | Posts are protected (private) |
data.users[].pinned_tweet_ids | string[] | IDs of pinned posts |
data.cursor | string | null | Cursor for the next page |
Pagination
Each response includes a cursor. Send the same request again with that value in cursor to get the next page; cursor is null when there is nothing more (or the page came back empty). count is a page-size hint — X may return a few more or fewer items than you ask for. Every page is a separate $0.01 call.
Caching
Responses are cached for 1 hour.
Errors
| Status | Code | When |
|---|---|---|
400 | VALIDATION_ERROR | Neither username nor user_id was sent, or one is malformed |
404 | NOT_FOUND | User not found or suspended |
429 | RATE_LIMITED_UPSTREAM | Too many requests in a short burst — retry after a few seconds |
502 / 503 | UPSTREAM_ERROR / SERVICE_UNAVAILABLE | Temporary problem fetching data from X — retry later |
Failed calls are not charged.
A protected account returns 200 with an empty users list.
Related Endpoints
- Twitter Followers API — accounts following this user
- Twitter User API — the account's profile
- Users Lookup — refresh up to 100 profiles by ID
Twitter Followers API (X Followers)
Twitter Followers API — list the followers of any X (Twitter) account with full profiles, follower counts, and bios. Paginated JSON, $0.01 per call.
Tweet API (X Post API)
Tweet API (X Post API) — get one tweet by ID or URL with full text, author, likes, retweets, replies, quotes, bookmarks, views, and media. JSON, $0.01 per call.