GET/twitter/user/posts

    Get X Posts by Username

    Retrieve user's timeline posts by specifying their username. This endpoint fetches the latest tweets posted by the user associated with the provided username. Page with `cursor`: send the previous page's `next_cursor` back unchanged. An invalid, expired or other-user cursor returns 422 and is not charged. Billing metadata: successful billable responses include the `X-Desearch-Cost-Usd`, `X-Desearch-Usage-Count`, `X-Desearch-Service`, and `X-Desearch-Currency` headers. JSON object responses also include optional `cost_usd`, `usage_count`, `service`, and `currency` fields. Current prices are at https://desearch.ai/pricing. JSON arrays, text, and streaming responses keep their body shape and expose billing metadata only through headers.

    Base URL

    https://api.desearch.ai

    Implementation guidance

    Use Get X Posts by Username when your application needs fresh X data without maintaining its own crawler, social-data pipeline, or retrieval infrastructure. Use this route when you already know the account and want what it posted recently: pass the X handle as the required username query value, and the response holds that user's latest timeline posts. It reads the timeline rather than running a search. To find one account's posts that match a topic, use Search X Posts by User, which ranks results by relevance even when its query is empty; to collect an account's tweets together with its replies, use Fetch User's Tweets and Replies. A 200 response is a JSON object with a required user profile and a required tweets array; next_cursor is optional and can be null. The example below requests a second page only when the first one returns a next_cursor string, as the cursor parameter describes, and an account that is not found returns HTTP 404. Every post requires id, text, created_at and the integer counters reply_count, retweet_count, like_count, quote_count and bookmark_count; view_count, url, media, lang and reply fields such as in_reply_to_status_id are optional and can be null. The nested retweet object, which holds a reposted post, is documented as available on this endpoint only; it is also optional and can be null. The X API overview lists the other X routes. The endpoint returns structured data that can be consumed by agents, research tools, dashboards, and retrieval-augmented generation workflows. Keep the request focused on the minimum fields your workflow needs so responses remain fast and easy to validate.

    Send requests to GET /twitter/user/posts with your Desearch API key in the authorization header. Treat the key as a server-side secret, validate all required parameters before sending the request, and handle non-2xx responses explicitly. Production integrations should use sensible timeouts, retry only transient failures with backoff, and record the response status and request identifier for troubleshooting.

    Test the example request below before integrating it into a larger workflow. Confirm that the returned fields, links, and timestamps meet your freshness requirements, then add schema validation at the application boundary. For agentic systems, preserve source URLs with the generated answer so users can inspect evidence and your application can avoid presenting unsupported claims.

    Example: read up to two pages from @desearch_ai, the Desearch account on X. Set DESEARCH_API_KEY to your API key; the script needs curl 7.76 or later and jq, stops after page 1 when no next_cursor comes back, and prints the error body and exits 1 on an HTTP error.

    BASH
    set -euo pipefail
    
    # Page 1: posts from one account's timeline
    curl -sS --fail-with-body "https://api.desearch.ai/twitter/user/posts?username=desearch_ai" \
      -H "Authorization: $DESEARCH_API_KEY" -o page1.json || { cat page1.json >&2; exit 1; }
    jq '{user: .user.username, posts: (.tweets | length), first_created_at: .tweets[0].created_at, next_cursor_returned: ((.next_cursor | type) == "string")}' page1.json
    
    # Page 2 only if page 1 returned next_cursor: send it back unchanged, with the same username, within 24 hours
    NEXT_CURSOR=$(jq -r 'if (.next_cursor | type) == "string" and .next_cursor != "" then .next_cursor else empty end' page1.json)
    if [ -z "$NEXT_CURSOR" ]; then
      echo "No next_cursor: page 1 is the last page."
      exit 0
    fi
    curl -sS --fail-with-body -G "https://api.desearch.ai/twitter/user/posts" \
      -H "Authorization: $DESEARCH_API_KEY" \
      --data-urlencode "username=desearch_ai" \
      --data-urlencode "cursor=$NEXT_CURSOR" -o page2.json || { cat page2.json >&2; exit 1; }
    jq '{posts: (.tweets | length), first_created_at: .tweets[0].created_at}' page2.json
    

    Output of this script on 2 December 2026 (counts and dates change as the account posts; first_created_at is the first item in the array, not a computed latest time):

    JSON
    {
      "user": "desearch_ai",
      "posts": 19,
      "first_created_at": "Tue Dec 01 16:04:58 +0000 2026",
      "next_cursor_returned": true
    }
    {
      "posts": 20,
      "first_created_at": "Wed Nov 11 13:01:03 +0000 2026"
    }
    

    Query Parameters

    usernamestringrequired

    Username to fetch posts for

    cursorstring

    Opaque pagination cursor. Omit it for the first page. For the next page, send the `next_cursor` from the previous response back unchanged with the same `username`. A cursor is valid for 24 hours. `next_cursor` is `null` on the last page. Any other value, including an expired cursor or one from another user, returns 422 and is not charged.

    Responses

    200A JSON object mapping X Posts
    301Moved Permanently
    304Not Modified
    401Unauthorized
    404User not found
    422Validation Error, or `cursor` is not a `next_cursor` this route returned for this username in the last 24 hours. Rejected before any lookup and not charged.
    429Too Many Requests
    500Internal Server Error
    503The X crawler failed or timed out
    Authorization

    Your API key is sent in the Authorization header.

    Request
    curl -X GET "https://api.desearch.ai/twitter/user/posts?username=elonmusk" \
      -H "Authorization: YOUR_API_KEY" \
      -H "Content-Type: application/json"
    GET /twitter/user/posts
    ResponseSchema
    {
      "user": {
        "id": "123456789",
        "url": "https://twitter.com/example_user",
        "name": "John Doe",
        "username": "johndoe",
        "created_at": "2023-01-01T00:00:00Z",
        "description": "This is an example user description.",
        "favourites_count": 100,
        "followers_count": 1500,
        "followings_count": 100,
        "listed_count": 10,
        "media_count": 50,
        "profile_image_url": "https://example.com/profile.jpg",
        "profile_banner_url": "https://example.com/banner.jpg",
        "statuses_count": 500,
        "verified": true,
        "is_blue_verified": true,
        "entities": {
          "description": {},
          "url": {}
        },
        "can_dm": true,
        "can_media_tag": true,
        "location": "Jamaica",
        "pinned_tweet_ids": [
          "123456789",
          "987654321"
        ],
        "professional": {
          "professional_type": "Business",
          "category": [
            {
              "id": 1,
              "name": "Technology"
            }
          ]
        },
        "affiliates_highlighted_label": {
          "label": {
            "description": "Polymarket",
            "user_label_display_type": "Badge",
            "user_label_type": "BusinessLabel"
          }
        },
        "website": "https://t.co/4sVzS0XYIW"
      },
      "tweets": [
        {
          "user": {
            "id": "123456789",
            "url": "https://twitter.com/example_user",
            "name": "John Doe",
            "username": "johndoe",
            "created_at": "2023-01-01T00:00:00Z",
            "description": "This is an example user description.",
            "favourites_count": 100,
            "followers_count": 1500,
            "followings_count": 100,
            "listed_count": 10,
            "media_count": 50,
            "profile_image_url": "https://example.com/profile.jpg",
            "profile_banner_url": "https://example.com/banner.jpg",
            "statuses_count": 500,
            "verified": true,
            "is_blue_verified": true,
            "entities": {},
            "can_dm": true,
            "can_media_tag": true,
            "location": "Jamaica",
            "pinned_tweet_ids": [
              "123456789",
              "987654321"
            ],
            "professional": {},
            "affiliates_highlighted_label": {},
            "website": "https://t.co/4sVzS0XYIW"
          },
          "id": "987654321",
          "text": "This is an example tweet.",
          "reply_count": 10,
          "view_count": 1000,
          "retweet_count": 5,
          "like_count": 100,
          "quote_count": 2,
          "bookmark_count": 3,
          "url": "https://twitter.com/example_tweet",
          "created_at": "2023-01-01T00:00:00Z",
          "media": [],
          "is_quote_tweet": false,
          "is_retweet": false,
          "lang": "en",
          "conversation_id": "987654321",
          "in_reply_to_screen_name": "someuser",
          "in_reply_to_status_id": "987654320",
          "in_reply_to_user_id": "123456789",
          "quoted_status_id": "987654319",
          "quote": {
            "user": {},
            "id": "987654321",
            "text": "This is an example tweet.",
            "reply_count": 10,
            "view_count": 1000,
            "retweet_count": 5,
            "like_count": 100,
            "quote_count": 2,
            "bookmark_count": 3,
            "url": "https://twitter.com/example_tweet",
            "created_at": "2023-01-01T00:00:00Z",
            "media": [],
            "is_quote_tweet": false,
            "is_retweet": false,
            "lang": "en",
            "conversation_id": "987654321",
            "in_reply_to_screen_name": "someuser",
            "in_reply_to_status_id": "987654320",
            "in_reply_to_user_id": "123456789",
            "quoted_status_id": "987654319",
            "quote": {},
            "replies": [],
            "display_text_range": [
              0,
              280
            ],
            "entities": {},
            "extended_entities": {},
            "retweet": {},
            "article": {},
            "content_disclosure": {},
            "edit_control": {},
            "possibly_sensitive": false,
            "card": {}
          },
          "replies": [
            {
              "id": "987654321",
              "text": "This is an example tweet.",
              "reply_count": 10,
              "view_count": 1000,
              "retweet_count": 5,
              "like_count": 100,
              "quote_count": 2,
              "bookmark_count": 3,
              "url": "https://twitter.com/example_tweet",
              "created_at": "2023-01-01T00:00:00Z",
              "media": [],
              "is_quote_tweet": false,
              "is_retweet": false,
              "lang": "en",
              "conversation_id": "987654321",
              "in_reply_to_screen_name": "someuser",
              "in_reply_to_status_id": "987654320",
              "in_reply_to_user_id": "123456789",
              "quoted_status_id": "987654319",
              "replies": [],
              "display_text_range": [
                0,
                280
              ],
              "possibly_sensitive": false
            }
          ],
          "display_text_range": [
            0,
            280
          ],
          "entities": {
            "hashtags": [],
            "media": [],
            "symbols": [],
            "timestamps": [],
            "urls": [],
            "user_mentions": []
          },
          "extended_entities": {
            "media": []
          },
          "retweet": {
            "user": {},
            "id": "987654321",
            "text": "This is an example tweet.",
            "reply_count": 10,
            "view_count": 1000,
            "retweet_count": 5,
            "like_count": 100,
            "quote_count": 2,
            "bookmark_count": 3,
            "url": "https://twitter.com/example_tweet",
            "created_at": "2023-01-01T00:00:00Z",
            "media": [],
            "is_quote_tweet": false,
            "is_retweet": false,
            "lang": "en",
            "conversation_id": "987654321",
            "in_reply_to_screen_name": "someuser",
            "in_reply_to_status_id": "987654320",
            "in_reply_to_user_id": "123456789",
            "quoted_status_id": "987654319",
            "quote": {},
            "replies": [],
            "display_text_range": [
              0,
              280
            ],
            "entities": {},
            "extended_entities": {},
            "retweet": {},
            "article": {},
            "content_disclosure": {},
            "edit_control": {},
            "possibly_sensitive": false,
            "card": {}
          },
          "article": {
            "id": "2036821104418029568",
            "title": "How to become so creative it feels illegal",
            "preview_text": "string",
            "plain_text": "string",
            "cover_media": {},
            "first_published_at": 0
          },
          "content_disclosure": {
            "advertising_disclosure": {}
          },
          "edit_control": {
            "edit_tweet_ids": [
              "987654321"
            ],
            "editable_until_msecs": "1784103100000",
            "edits_remaining": "5",
            "is_edit_eligible": false
          },
          "possibly_sensitive": false,
          "card": {
            "type": "summary_large_image",
            "url": "https://t.co/hVHgyxtOZ9",
            "title": "Starship | Starlink Group 31-1 (Starship Flight 14)",
            "description": "14th test flight of the two-stage Starship launch vehicle.",
            "domain": "www.missionstatus.com",
            "image": "https://pbs.twimg.com/card_img/2104931127370690560/nssO7aWi?format=jpg&name=800x419",
            "image_alt": "string",
            "player_url": "https://www.youtube.com/embed/abc123",
            "broadcast_url": "https://x.com/i/broadcasts/1YGNrbPLejQGw",
            "state": "ENDED"
          }
        }
      ],
      "next_cursor": "string"
    }
    Status codes200301304401404422429500503