Skip to content

Structured X (Twitter) data: send usernames. Cursor-paginated, 1 credit per successful call.

GET · POST1 credit / successful callCursor-paginated
GEThttps://api.scrapier.io/api/v2/twitter-tweets/Open in Playground

Call GET /api/v2/twitter-tweets/ with usernames. The results are in data.tweets; send data.next_cursor back as cursor to get the next page. 3 optional parameters refine the call (see Parameters).

Terminal window
curl -G "https://api.scrapier.io/api/v2/twitter-tweets/" \
-H "X-API-Key: YOUR_API_KEY" \
--data-urlencode "usernames=elonmusk" \
--max-time 210
NameTypeRequiredDefaultDescription
X-API-Key headerstringyes—Your API key from the dashboard.
usernamesstringyese.g. elonmuskX handle, numeric user ID, or profile URL. Required on first call; ignored when cursor is supplied. Keyword/hashtag search is login-only on X and returns 400.
cursorstringno—Pagination cursor returned in the previous response's next_cursor. Pass it back unchanged to fetch the next page. When next_cursor is null, you have reached the last page.
with_repliesbooleannotrueInclude replies in the result. Locked into the cursor.
include_user_infobooleannotrueInclude per-tweet user info. Locked into the cursor.
Advanced
NameTypeDefaultDescription
use_proxybooleantrueRoute the request through Scrapier's residential proxy pool. Default: true. Leave as is unless support tells you otherwise.
raw_databooleanfalseWhen true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under raw_responses, in place of the formatted items. When false (default) you get the formatted output. Pagination (cursor / next_cursor) works the same in both modes.
{
"success": true,
"data": {
"usernames": "BillGates",
"user_id": "50393960",
"screen_name": "BillGates",
"page": 1,
"page_size": 20,
"tweets": [
{
"id": "1948167071684231344",
"tweet_id": "1948167071684231344",
"url": "https://x.com/BillGates/status/1948167071684231344",
"verified": true,
"username": "@BillGates",
"fullname": "Bill Gates",
"timestamp": "Wed Jul 23 23:43:19 +0000 2025",
"text": "Learning how many kids were dying from diarrhea back in 1997 ... https://t.co/NYitqiRY38",
"links": [
"https://gatesnot.es/46lTfBz"
],
"isPinned": false,
"isQuote": false,
"isRetweet": false,
"isReply": false,
"likes": 5219,
"replies": 0,
"retweets": 1816,
"quotes": 598,
"bookmarks": 334,
"views": 2828080,
"lang": "en",
"user": {
"avatar": "https://pbs.twimg.com/profile_images/1879013694367252480/Gxa-Pspq_normal.jpg",
"username": "BillGates",
"userFullName": "Bill Gates",
"description": "Sharing things I'm learning through my foundation work and other interests.",
"location": "Seattle, WA",
"website": "https://gatesnot.es/tgn",
"joinDate": "Wed Jun 24 18:44:10 +0000 2009",
"verified": true,
"totalLikes": 542,
"totalTweets": 4521,
"totalFollowing": 571,
"totalFollowers": 65231300,
"url": "https://t.co/TiXXwOGE95",
"userId": "50393960",
"totalMediaCount": 1530
},
"media": [],
"tweetUserId": "50393960",
"input_username": "BillGates",
"scraped_at": "2026-10-03T03:35:53.722Z"
}
],
"next_cursor": "eyJoIjoiLi4uIiwiaW4iOiJCaWxsR2F0ZXMiLCJsdCI6IjE5MjYwNDY2MzQ0NDc1NTg1NjYiLCJwIjoyLCJyIjp0cnVlLCJzbiI6IkJpbGxHYXRlcyIsInUiOiI1MDM5Mzk2MCIsInVpIjp0cnVlfQ"
}
}

Sample from the live catalog; arrays trimmed to 3 items. Results are in data.tweets.

FieldTypeExampleDescription
usernamesstringBillGates—
user_idstring50393960—
screen_namestringBillGates—
pageinteger1—
page_sizeinteger20—
tweetsarray[1 item]The results.
next_cursorstringeyJoIjoiLi4uIiwiaW4iOiJCaWxsR2F0ZXMiLCJsdCI6I…Pass back as cursor for the next page. null on the last page.
tweets[].idstring1948167071684231344—
tweets[].tweet_idstring1948167071684231344—
tweets[].urlstringhttps://x.com/BillGates/status/19481670716842…—
tweets[].verifiedbooleantrue—
tweets[].usernamestring@BillGates—
tweets[].fullnamestringBill Gates—
tweets[].timestampstringWed Jul 23 23:43:19 +0000 2025—
tweets[].textstringLearning how many kids were dying from diarrh…—
tweets[].linksarray[1 item]—
tweets[].isPinnedbooleanfalse—
tweets[].isQuotebooleanfalse—
tweets[].isRetweetbooleanfalse—
tweets[].isReplybooleanfalse—
tweets[].likesinteger5219—
tweets[].repliesinteger0—
tweets[].retweetsinteger1816—
tweets[].quotesinteger598—
tweets[].bookmarksinteger334—
tweets[].viewsinteger2828080—
tweets[].langstringen—
tweets[].userobject{…}—
tweets[].mediaarray[]—
tweets[].tweetUserIdstring50393960—
tweets[].input_usernamestringBillGates—
tweets[].scraped_atstring2026-10-03T03:35:53.722Z—

Pass data.next_cursor back as cursor until it is null. Required inputs are ignored once a cursor is sent. Each page is one billed call. More in Pagination.

const url = "https://api.scrapier.io/api/v2/twitter-tweets/";
let params = { usernames: "elonmusk" };
const items = [];
for (let page = 0; page < 10; page++) { // each page is one billed call
const res = await fetch(`${url}?${new URLSearchParams(params)}`, {
headers: { "X-API-Key": "YOUR_API_KEY" },
signal: AbortSignal.timeout(210_000),
});
const body = await res.json();
if (!res.ok) throw new Error(body.error ?? body.detail ?? `HTTP ${res.status}`);
const data = body.data;
items.push(...(data.tweets ?? []));
if (!data.next_cursor) break; // null = last page
params = { cursor: data.next_cursor };
}

Failed calls are free. Branch on the HTTP status and read the message from error (or detail). Full details in Errors.

StatusMeaningRetry?Charged?
400Bad or missing input.No — fix the paramsNo
401 / 403Missing, invalid or revoked API key.No — fix the keyNo
402Out of credits (body has balance).No — top upNo
404Unknown endpoint slug.No — check the slugNo
429 / 503Busy or throttled.Yes — after Retry-AfterNo
5xxTarget site or upstream failure, or timeout.Yes — with backoffNo
  • Nothing special: send the inputs, read the result.
  • Twitter/X Posts — Structured X (Twitter) data: send usernames. Cursor-paginated, 1 credit per successful call.
  • X/Twitter Video Transcript — Structured X (Twitter) data: send urls. Single lookup, 2 credits per successful call.