YepAPI
Twitter / X API

Twitter User API (X Profile API)

Twitter User API (X Profile API) — get an X profile by username with follower, following, tweet, and like counts, bio, avatar, and verification. JSON, $0.01 per call.

POST/v1/twitter/user
$0.01/call

The Twitter User API (X Profile API) returns a public X profile from a handle: display name, bio, location, website, follower and following counts, tweet and media counts, avatar and banner, blue-check and verification type, and pinned tweet IDs. The id it returns works as user_id on User Tweets, Followers, and the other timeline endpoints.

Usage

const res = await fetch('https://api.yepapi.com/v1/twitter/user', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"username": "NASA"}),
});
const { data } = await res.json();
console.log(data);
curl -X POST https://api.yepapi.com/v1/twitter/user \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"username": "NASA"}'
import requests

res = requests.post(
    "https://api.yepapi.com/v1/twitter/user",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={"username": "NASA"},
)
print(res.json()["data"])

Request Body

ParameterTypeRequiredDescriptionDefault
usernamestringYesX handle — NASA, @NASA, or an x.com / twitter.com profile URL—

Response

{
  "ok": true,
  "data": {
    "avatar": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
    "banner": "https://pbs.twimg.com/profile_banners/11348282/1788992290",
    "created_at": "2007-12-19T20:20:32+00:00",
    "description": "Making the seemingly impossible, possible. ✨",
    "followers_count": 92298682,
    "following_count": 115,
    "id": "11348282",
    "is_blue_verified": true,
    "likes_count": 17049,
    "listed_count": 96844,
    "location": "Pale Blue Dot",
    "media_count": 28221,
    "name": "NASA",
    "pinned_tweet_ids": [
      "2116263878807998722"
    ],
    "protected": false,
    "tweet_count": 74477,
    "url": "https://x.com/NASA",
    "username": "NASA",
    "verified": false,
    "verified_type": "Government",
    "website": "http://www.nasa.gov/"
  }
}

Response Fields

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

Caching

Responses are cached for 1 hour.

Errors

StatusCodeWhen
400VALIDATION_ERRORusername is missing or not a valid X handle
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.

On this page