Twitter/X Profile Tweets
Structured X (Twitter) data: send usernames. Cursor-paginated, 1 credit per successful call.
Overview
Section titled “Overview”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).
Request
Section titled “Request”curl -G "https://api.scrapier.io/api/v2/twitter-tweets/" \ -H "X-API-Key: YOUR_API_KEY" \ --data-urlencode "usernames=elonmusk" \ --max-time 210const params = new URLSearchParams({ usernames: "elonmusk" });
const res = await fetch(`https://api.scrapier.io/api/v2/twitter-tweets/?${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}`);
console.log(body.data.tweets);import requests
resp = requests.get( "https://api.scrapier.io/api/v2/twitter-tweets/", headers={"X-API-Key": "YOUR_API_KEY"}, params={"usernames": "elonmusk"}, timeout=210,)body = resp.json()if not resp.ok: raise RuntimeError(body.get("error") or body.get("detail"))
print(body["data"]["tweets"])curl -X POST "https://api.scrapier.io/api/v2/twitter-tweets/" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"usernames":"elonmusk"}' \ --max-time 210Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
X-API-Key header | string | yes | — | Your API key from the dashboard. |
usernames | string | yes | e.g. elonmusk | X 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. |
cursor | string | no | — | 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_replies | boolean | no | true | Include replies in the result. Locked into the cursor. |
include_user_info | boolean | no | true | Include per-tweet user info. Locked into the cursor. |
Advanced
| Name | Type | Default | Description |
|---|---|---|---|
use_proxy | boolean | true | Route the request through Scrapier's residential proxy pool. Default: true. Leave as is unless support tells you otherwise. |
raw_data | boolean | false | When 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. |
Response
Section titled “Response”{ "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" }}Bad input. The exact message varies by endpoint.
{ "success": false, "error": "…"}Balance below the endpoint’s price.
{ "error": "Insufficient credits. Buy more to scrape more.", "balance": 1, "required": 2}Invalid or unknown API key.
{ "detail": "Authentication service unavailable or invalid API key."}Throttled — wait for Retry-After.
{ "detail": "Request was throttled. Expected available in N seconds."}Sample from the live catalog; arrays trimmed to 3 items. Results are in data.tweets.
Response fields
Section titled “Response fields”| Field | Type | Example | Description |
|---|---|---|---|
usernames | string | BillGates | — |
user_id | string | 50393960 | — |
screen_name | string | BillGates | — |
page | integer | 1 | — |
page_size | integer | 20 | — |
tweets | array | [1 item] | The results. |
next_cursor | string | eyJoIjoiLi4uIiwiaW4iOiJCaWxsR2F0ZXMiLCJsdCI6I… | Pass back as cursor for the next page. null on the last page. |
tweets[].id | string | 1948167071684231344 | — |
tweets[].tweet_id | string | 1948167071684231344 | — |
tweets[].url | string | https://x.com/BillGates/status/19481670716842… | — |
tweets[].verified | boolean | true | — |
tweets[].username | string | @BillGates | — |
tweets[].fullname | string | Bill Gates | — |
tweets[].timestamp | string | Wed Jul 23 23:43:19 +0000 2025 | — |
tweets[].text | string | Learning how many kids were dying from diarrh… | — |
tweets[].links | array | [1 item] | — |
tweets[].isPinned | boolean | false | — |
tweets[].isQuote | boolean | false | — |
tweets[].isRetweet | boolean | false | — |
tweets[].isReply | boolean | false | — |
tweets[].likes | integer | 5219 | — |
tweets[].replies | integer | 0 | — |
tweets[].retweets | integer | 1816 | — |
tweets[].quotes | integer | 598 | — |
tweets[].bookmarks | integer | 334 | — |
tweets[].views | integer | 2828080 | — |
tweets[].lang | string | en | — |
tweets[].user | object | {…} | — |
tweets[].media | array | [] | — |
tweets[].tweetUserId | string | 50393960 | — |
tweets[].input_username | string | BillGates | — |
tweets[].scraped_at | string | 2026-10-03T03:35:53.722Z | — |
Pagination
Section titled “Pagination”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 };}import requests
URL = "https://api.scrapier.io/api/v2/twitter-tweets/"HEADERS = {"X-API-Key": "YOUR_API_KEY"}params = {"usernames": "elonmusk"}items = []
for _ in range(10): # each page is one billed call resp = requests.get(URL, headers=HEADERS, params=params, timeout=210) resp.raise_for_status() data = resp.json()["data"] items.extend(data.get("tweets") or []) if not data.get("next_cursor"): # None = last page break params = {"cursor": data["next_cursor"]}Errors
Section titled “Errors”Failed calls are free. Branch on the HTTP status and read the message from error (or detail). Full details in Errors.
| Status | Meaning | Retry? | Charged? |
|---|---|---|---|
400 | Bad or missing input. | No — fix the params | No |
401 / 403 | Missing, invalid or revoked API key. | No — fix the key | No |
402 | Out of credits (body has balance). | No — top up | No |
404 | Unknown endpoint slug. | No — check the slug | No |
429 / 503 | Busy or throttled. | Yes — after Retry-After | No |
5xx | Target site or upstream failure, or timeout. | Yes — with backoff | No |
- Nothing special: send the inputs, read the result.
Related
Section titled “Related”- 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.