X profile API
  1. Docs
  2. X (Twitter)
  3. X profile API

X profile API

Account details: bio, links, avatar, banner, followers, following, post count and verification.

GET /v1/twitter/profile

GET /v1/twitter/profile

Account details: bio, links, avatar, banner, followers, following, post count and verification. X no longer shows the account's likes or listed counts, so stats.likes is empty. If X will not serve the profile page, the account is read from its public timeline widget instead (extra.source is syndication): no birthdate, verification reason or highlights, and it needs the account to have posts of its own. Suspended accounts answer removed, unknown ones not_found.

  • Cost: 1 credit
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
handlestringyesUsername, with or without the leading @. Also accepted as username, screen_name.

Every request also accepts:

  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

1curl -G "https://api.socialscrape.dev/v1/twitter/profile" \2  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3  --data-urlencode "handle=NASA"

Example response#

This is a sample from a recorded response. Status 200.

200 OKSample response
1{2  "ok": true,3  "credits_charged": 1,4  "credits_remaining": 4999,5  "cached": false,6  "cached_at": null,7  "request_id": "req_aa10816824f8fd23e2b1f991",8  "data": {9    "object": "profile",10    "platform": "twitter",11    "id": "11348282",12    "handle": "NASA",13    "name": "NASA",14    "headline": null,15    "url": "https://x.com/NASA",16    "kind": "organization",17    "bio": "Making the seemingly impossible, possible. ✨",18    "avatar_url": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",19    "banner_url": "https://pbs.twimg.com/profile_banners/11348282/1788992290",20    "verified": true,21    "is_private": false,22    "external_url": "http://www.nasa.gov/",23    "links": [24      {25        "title": "nasa.gov",26        "url": "http://www.nasa.gov/"27      }28    ],29    "location": "Pale Blue Dot",30    "category": null,31    "created_at": "2007-12-19T20:20:32Z",32    "stats": {33      "followers": 92300952,34      "following": 115,35      "posts": 74471,36      "likes": null,37      "views": null38    },39    "extra": {40      "is_blue_verified": true,41      "likes_given": 17048,42      "media_count": 28218,43      "source": "syndication",44      "verified_type": "Government"45    }46  },47  "cursor": null,48  "has_more": null49}

Response#

A Profile object in data.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.

Example error:

1{2  "ok": false,3  "error": {4    "code": "invalid_params",5    "message": "A parameter is missing, unknown or has the wrong type.",6    "retryable": false7  },8  "credits_charged": 0,9  "request_id": "req_6bc0172519c84e540873756c"10}