> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Twitter/X Profile Tweets

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

`GET|POST https://api.scrapier.io/api/v2/twitter-tweets/` · 1 credit per successful call · Cursor-paginated

## 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

```bash
curl -G "https://api.scrapier.io/api/v2/twitter-tweets/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "usernames=elonmusk" \
  --max-time 210
```

```python
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"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `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. |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `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

HTTP 200. Results are in `data.tweets`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "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"
  }
}
```

## 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

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.

```python
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

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- Nothing special: send the inputs, read the result.

## Related

- [Twitter/X Posts](https://docs.scrapier.io/api-reference/twitter/twitter-post.md): Structured X (Twitter) data: send `usernames`. Cursor-paginated, 1 credit per successful call.
- [X/Twitter Video Transcript](https://docs.scrapier.io/api-reference/twitter/twitter-transcript.md): Structured X (Twitter) data: send `urls`. Single lookup, 2 credits per successful call.
