# User tweets

`GET https://api.twittrapi.com/user/{userId}/tweets`

Tweets from a profile timeline (without replies), newest first.

HTML page: https://www.twittrapi.com/docs/reference/user-userid-tweets

## Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `userId` | path | string | yes |  | Numeric user ID (digits only, up to 30). To pass a handle instead, use -1 here and set username. |
| `username` | query | string | no |  | Handle, with or without @. When set, it is used instead of userId: the API looks up the ID first, which makes the call a little slower. Still one billed call. |
| `count` | query | integer | no | 20 | Number of items to ask X for. Sent to X as is; X treats it as a hint and decides how many it returns (follower and following pages often hold 50 to 70 users for count=20). A value that is not a number falls back to 20. |
| `cursor` | query | string | no |  | Bottom cursor from the previous page. Leave it out for the first page. See Pagination. |
| `includePromotedContent` | query | boolean | no | false | Ask X to include promoted tweets. Accepts true/false, 1/0. |

Every read endpoint also accepts `format=simple` (or the header `X-Response-Format: simple`) for compact, flat JSON with a fixed schema. Same price.

Paginated: pass the bottom cursor of one page as `cursor` to get the next. Each page is one billed call.

## Response

Raw JSON of X's UserTweets query. Entries are in data.user.result.timeline.timeline.instructions.

With `format=simple`: Collection of Tweet objects: {data: [Tweet], nextCursor, previousCursor, hasNextPage}. The pinned tweet comes first with isPinned: true. "Who to follow" modules are dropped.

## Errors

| Status | When |
| --- | --- |
| 422 | userId is not numeric, or the username lookup failed. |
| 400 | userId is -1 and username is missing, the username contains characters X blocks, or the user could not be found. |

Shared errors (401 missing key, 402 no balance, 429 rate limit, 5xx) are listed on https://www.twittrapi.com/docs/helpful-infos/error-handling. Calls that fail with 400, 408, 409 or a 5xx error are refunded.

## Example request

curl:

```bash
curl 'https://api.twittrapi.com/user/12/tweets?count=20' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

Python:

```python
from twittrapi import TwittrAPI

client = TwittrAPI(api_key="YOUR_API_KEY")
data = client.users.tweets("12", count=20)
```

Node.js:

```js
import { TwittrAPI } from "twittrapi";

const client = new TwittrAPI({ apiKey: process.env.TWITTRAPI_API_KEY });
const data = await client.users.tweets({ userId: "12", count: 20 });
```

RapidAPI:

```bash
curl 'https://twitter-aio.p.rapidapi.com/user/12/tweets?count=20' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: twitter-aio.p.rapidapi.com'
```

## Example response

Shortened: arrays keep their first items and long strings are cut.

Raw (default):

```json
{
  "data": {
    "user": {
      "result": {
        "__typename": "User",
        "timeline": {
          "timeline": {
            "instructions": [
              {
                "type": "TimelineClearCache"
              },
              {
                "entry": {
                  "content": {
                    "__typename": "TimelineTimelineItem",
                    "clientEventInfo": {
                      "component": "pinned_tweets",
                      "element": "tweet"
                    },
                    "entryType": "TimelineTimelineItem",
                    "itemContent": {
                      "__typename": "TimelineTweet",
                      "itemType": "TimelineTweet",
                      "socialContext": {
                        "contextType": "Pin",
                        "text": "Example text.",
                        "type": "TimelineGeneralContext"
                      },
                      "tweetDisplayType": "Tweet",
                      "tweet_results": {
                        "result": {
                          "__typename": "Tweet",
                          "card": {
                            "legacy": {
                              "…": "…"
                            },
                            "rest_id": "https://t.co/FS66GuIYJD"
                          },
                          "cashtag_attachments": [],
                          "core": {
                            "user_results": {
                              "…": "…"
                            }
                          },
                          "edit_control": {
                            "edit_tweet_ids": [
                              "…"
                            ],
                            "editable_until_msecs": "1770415785000",
                            "edits_remaining": "5",
                            "is_edit_eligible": false
                          },
                          "grok_analysis_button": true,
                          "grok_annotations": {
                            "is_image_editable_by_grok": true
                          },
                          "grok_translated_post_with_availability": {
                            "is_available": false
                          },
                          "is_translatable": false,
                          "legacy": {
                            "bookmark_count": 2803,
                            "bookmarked": false,
                            "conversation_id_str": "2019881223666233717",
                            "created_at": "Fri Feb 06 21:09:45 +0000 2026",
                            "display_text_range": [
                              "…"
                            ],
                            "entities": {
                              "…": "…"
                            },
                            "favorite_count": 5599,
                            "favorited": false,
                            "full_text": "Officially launching X API Pay-Per-Use\n\nThe core of X developers are indie builders, early stage products, startups, and…",
                            "id_str": "2019881223666233717",
                            "is_quote_status": false,
                            "lang": "en",
                            "possibly_sensitive": false,
                            "possibly_sensitive_editable": true,
                            "quote_count": 596,
                            "reply_count": 791,
                            "retweet_count": 896,
                            "retweeted": false,
                            "user_id_str": "2244994945"
                          },
                          "quick_promote_eligibility": {
                            "eligibility": "IneligibleNotVerified"
                          },
                          "rest_id": "2019881223666233717",
                          "unmention_data": {},
… (76 more lines)
```

Simple (`format=simple`):

```json
{
  "data": [
    {
      "id": "2019881223666233717",
      "url": "https://x.com/XDevelopers/status/2019881223666233717",
      "text": "Officially launching X API Pay-Per-Use\n\nThe core of X developers are indie builders, early stage products, startups, and hobbyists\n\nIt’s time to open up our X API ecosystem and instill a new wave of n…",
      "createdAt": "2026-02-06T21:09:45Z",
      "lang": "en",
      "author": {
        "id": "2244994945",
        "username": "XDevelopers",
        "name": "Developers",
        "description": "The voice of the X Dev team and your official source for updates, news, and events, related to the X API.",
        "location": "127.0.0.1",
        "url": "https://docs.x.com/",
        "createdAt": "2013-12-14T04:35:55Z",
        "avatarUrl": "https://pbs.twimg.com/profile_images/1683501992314798080/xl1POYLw.jpg",
        "bannerUrl": "https://pbs.twimg.com/profile_banners/2244994945/1690213128",
        "verified": true,
        "verifiedType": "Business",
        "protected": false,
        "counts": {
          "followers": 698074,
          "following": 770,
          "tweets": 4376,
          "likes": 2758,
          "media": 832,
          "listed": 0
        },
        "pinnedTweetIds": [
          "2019881223666233717"
        ],
        "isAutomated": false
      },
      "counts": {
        "likes": 5599,
        "retweets": 896,
        "replies": 791,
        "quotes": 596,
        "bookmarks": 2803,
        "views": 2552260
      },
      "media": [],
      "urls": [
        "http://developer.x.com"
      ],
      "hashtags": [],
      "mentions": [],
      "replyTo": null,
      "quoted": null,
      "retweetOf": null,
      "conversationId": "2019881223666233717",
      "isPinned": true,
      "source": null,
      "article": null
    }
  ],
  "nextCursor": "DAAHCgABHUS5pXT__-wLAAIAAAATMjEwMjQ0NzU2NzA0MDgyMzc2MAgAAwAAAAIAAA",
  "previousCursor": "DAAHCgABHUS5pXUAJxELAAIAAAATMjEwODk2ODM2MDY5MjQwNDI2MQgAAwAAAAEAAA",
  "hasNextPage": true
}
```
