YepAPI
Twitter / X API

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.

POST/v1/twitter/user-following
$0.01/call

Lists 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

ParameterTypeRequiredDescriptionDefault
usernamestringOne ofX handle — NASA, @NASA, or an x.com / twitter.com profile URL—
user_idstringOne ofNumeric X user ID (skips the username lookup). Send username or user_id—
countnumberNoPage size hint, 1–10020
cursorstringNocursor 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

FieldTypeDescription
okbooleanWhether the request succeeded
data.usersobject[]Accounts
data.users[].idstringNumeric user ID — use it as user_id on timeline endpoints
data.users[].usernamestringHandle without @
data.users[].namestringDisplay name
data.users[].descriptionstring | nullBio
data.users[].locationstring | nullLocation from the profile
data.users[].websitestring | nullWebsite link from the profile
data.users[].created_atstringAccount creation, ISO 8601
data.users[].avatarstring | nullProfile image URL (400×400)
data.users[].bannerstring | nullBanner image URL
data.users[].urlstringx.com profile URL
data.users[].followers_countnumberFollowers
data.users[].following_countnumberAccounts followed
data.users[].tweet_countnumberPosts, including replies and reposts
data.users[].likes_countnumberPosts liked
data.users[].media_countnumberPhotos and videos posted
data.users[].listed_countnumberLists the account is on
data.users[].is_blue_verifiedbooleanHas a blue check
data.users[].verifiedbooleanLegacy verification flag
data.users[].verified_typestring | nullBusiness, Government, or null
data.users[].protectedbooleanPosts are protected (private)
data.users[].pinned_tweet_idsstring[]IDs of pinned posts
data.cursorstring | nullCursor 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

StatusCodeWhen
400VALIDATION_ERRORNeither username nor user_id was sent, or one is malformed
404NOT_FOUNDUser not found or suspended
429RATE_LIMITED_UPSTREAMToo many requests in a short burst — retry after a few seconds
502 / 503UPSTREAM_ERROR / SERVICE_UNAVAILABLETemporary problem fetching data from X — retry later

Failed calls are not charged.

A protected account returns 200 with an empty users list.

On this page