---
title: "Get X Posts by Username"
method: GET
path: "/twitter/user/posts"
tags: ["X Search"]
---

# Get X Posts by Username

`GET /twitter/user/posts`

## Request

- Base URL: `https://api.desearch.ai`
- URL: `https://api.desearch.ai/twitter/user/posts`
- Auth: API key in header `Authorization`

Retrieve user's timeline posts by specifying their username. This endpoint fetches the latest tweets posted by the user associated with the provided username.

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. For example, `usage_count=10` at `$0.015 / 1,000` resolves to `cost_usd=0.00015`. JSON arrays, text, and streaming responses keep their body shape and expose billing metadata only through headers.

## Query parameters

- `username` string, required: Username to fetch posts for
- `cursor` string, nullable: Cursor for pagination

## Response `200`

A JSON object mapping X Posts

- XUserPostsResponse
  - `user` TwitterScraperUser, required
    - `id` string, required
    - `url` string, nullable
    - `name` string, nullable
    - `username` string, required
    - `created_at` string, nullable
    - `description` string, nullable
    - `favourites_count` integer, nullable
    - `followers_count` integer, nullable
    - `followings_count` integer, nullable
    - `listed_count` integer, nullable
    - `media_count` integer, nullable
    - `profile_image_url` string, nullable
    - `profile_banner_url` string, nullable
    - `statuses_count` integer, nullable
    - `verified` boolean, nullable
    - `is_blue_verified` boolean, nullable
    - `entities` TwitterScraperUserEntities
      - `description` TwitterScraperUserEntitiesDescription
        - `urls` TwitterScraperEntityUrl[], nullable
          - `display_url` string, required
          - `expanded_url` string, nullable
          - `url` string, required
          - `indices` integer[], required
      - `url` TwitterScraperUserEntitiesDescription
        - `urls` TwitterScraperEntityUrl[], nullable
          - `display_url` string, required
          - `expanded_url` string, nullable
          - `url` string, required
          - `indices` integer[], required
    - `can_dm` boolean, nullable
    - `can_media_tag` boolean, nullable
    - `location` string, nullable
    - `pinned_tweet_ids` string[], nullable
    - `professional` TwitterScraperUserProfessional
      - `professional_type` string, required
      - `category` TwitterScraperUserProfessionalCategory[]
        - `id` integer, required
        - `name` string, required
    - `affiliates_highlighted_label` TwitterScraperAffiliatesHighlightedLabel
      - `label` TwitterScraperAffiliateLabel
        - `badge` TwitterScraperAffiliateBadge
          - `url` string, nullable
        - `description` string, nullable
        - `url` TwitterScraperAffiliateUrl
          - `url` string, nullable
          - `url_type` string, nullable
        - `user_label_display_type` string, nullable
        - `user_label_type` string, nullable
    - `website` string, nullable
  - `tweets` TwitterScraperTweet[], required
    - `user` TwitterScraperUser
      - `id` string, required
      - `url` string, nullable
      - `name` string, nullable
      - `username` string, required
      - `created_at` string, nullable
      - `description` string, nullable
      - `favourites_count` integer, nullable
      - `followers_count` integer, nullable
      - `followings_count` integer, nullable
      - `listed_count` integer, nullable
      - `media_count` integer, nullable
      - `profile_image_url` string, nullable
      - `profile_banner_url` string, nullable
      - `statuses_count` integer, nullable
      - `verified` boolean, nullable
      - `is_blue_verified` boolean, nullable
      - `entities` TwitterScraperUserEntities
        - `description` TwitterScraperUserEntitiesDescription
          - `urls` TwitterScraperEntityUrl[], nullable
            - `display_url` string, required
            - `expanded_url` string, nullable
            - `url` string, required
            - `indices` integer[], required
        - `url` TwitterScraperUserEntitiesDescription
          - `urls` TwitterScraperEntityUrl[], nullable
            - `display_url` string, required
            - `expanded_url` string, nullable
            - `url` string, required
            - `indices` integer[], required
      - `can_dm` boolean, nullable
      - `can_media_tag` boolean, nullable
      - `location` string, nullable
      - `pinned_tweet_ids` string[], nullable
      - `professional` TwitterScraperUserProfessional
        - `professional_type` string, required
        - `category` TwitterScraperUserProfessionalCategory[]
          - `id` integer, required
          - `name` string, required
      - `affiliates_highlighted_label` TwitterScraperAffiliatesHighlightedLabel
        - `label` TwitterScraperAffiliateLabel
          - `badge` TwitterScraperAffiliateBadge
            - `url` string, nullable
          - `description` string, nullable
          - `url` TwitterScraperAffiliateUrl
            - `url` string, nullable
            - `url_type` string, nullable
          - `user_label_display_type` string, nullable
          - `user_label_type` string, nullable
      - `website` string, nullable
    - `id` string, required
    - `text` string, required
    - `reply_count` integer, required
    - `view_count` integer, nullable
    - `retweet_count` integer, required
    - `like_count` integer, required
    - `quote_count` integer, required
    - `bookmark_count` integer, required
    - `url` string, nullable
    - `created_at` string, required
    - `media` TwitterScraperMedia[], nullable
      - `media_url` string
      - `type` string
    - `is_quote_tweet` boolean, nullable
    - `is_retweet` boolean, nullable
    - `lang` string, nullable
    - `conversation_id` string, nullable
    - `in_reply_to_screen_name` string, nullable
    - `in_reply_to_status_id` string, nullable
    - `in_reply_to_user_id` string, nullable
    - `quoted_status_id` string, nullable
    - `quote` TwitterScraperTweet (recursive)
    - `replies` TwitterScraperTweet[], nullable
    - `display_text_range` integer[], nullable
    - `entities` TwitterScraperEntities
      - `hashtags` TwitterScraperEntitiesSymbol[], nullable
        - `indices` integer[], required
        - `text` string, required
      - `media` TwitterScraperEntitiesMedia[], nullable
        - `display_url` string, nullable
        - `expanded_url` string, nullable
        - `id_str` string, nullable
        - `indices` integer[], nullable
        - `media_key` string, nullable
        - `media_url_https` string, nullable
        - `type` string, nullable
        - `url` string, nullable
        - `additional_media_info` TwitterScraperEntitiesMediaAdditionalInfo
          - `monetizable` boolean, nullable
          - `source_user` object, nullable
        - `ext_media_availability` TwitterScraperEntitiesMediaExtAvailability
          - `status` string, nullable
        - `features` TwitterScraperEntitiesMediaFeatures
          - `large` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `medium` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `small` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `orig` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
        - `sizes` TwitterScraperEntitiesMediaSizes
          - `large` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `medium` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `small` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `thumb` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
        - `original_info` TwitterScraperEntitiesMediaOriginalInfo
          - `height` integer, required
          - `width` integer, required
          - `focus_rects` Rect[], nullable
            - `x` integer, required
            - `y` integer, required
            - `w` integer, required
            - `h` integer, required
        - `allow_download_status` TwitterScraperEntitiesMediaAllowDownloadStatus
          - `allow_download` boolean, nullable
        - `video_info` TwitterScraperEntitiesMediaVideoInfo
          - `duration_millis` integer, nullable
          - `aspect_ratio` integer[], nullable
          - `variants` TwitterScraperEntitiesMediaVideoInfoVariant[], nullable
            - `content_type` string, required
            - `url` string, required
            - `bitrate` integer, nullable
        - `media_results` TwitterScraperEntitiesMediaResults
          - `result` TwitterScraperEntitiesMediaResult
            - `media_key` string, required
      - `symbols` TwitterScraperEntitiesSymbol[], nullable
        - `indices` integer[], required
        - `text` string, required
      - `timestamps` unknown[], nullable
        - unknown
      - `urls` TwitterScraperEntityUrl[], nullable
        - `display_url` string, required
        - `expanded_url` string, nullable
        - `url` string, required
        - `indices` integer[], required
      - `user_mentions` TwitterScraperEntitiesUserMention[], nullable
        - `id_str` string, required
        - `name` string, required
        - `screen_name` string, required
        - `indices` integer[], required
    - `extended_entities` TwitterScraperExtendedEntities
      - `media` TwitterScraperEntitiesMedia[], nullable
        - `display_url` string, nullable
        - `expanded_url` string, nullable
        - `id_str` string, nullable
        - `indices` integer[], nullable
        - `media_key` string, nullable
        - `media_url_https` string, nullable
        - `type` string, nullable
        - `url` string, nullable
        - `additional_media_info` TwitterScraperEntitiesMediaAdditionalInfo
          - `monetizable` boolean, nullable
          - `source_user` object, nullable
        - `ext_media_availability` TwitterScraperEntitiesMediaExtAvailability
          - `status` string, nullable
        - `features` TwitterScraperEntitiesMediaFeatures
          - `large` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `medium` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `small` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
          - `orig` TwitterScraperEntitiesMediaFeature
            - `faces` Rect[], nullable
              - …
        - `sizes` TwitterScraperEntitiesMediaSizes
          - `large` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `medium` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `small` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
          - `thumb` MediaSize
            - `w` integer, required
            - `h` integer, required
            - `resize` string, nullable
        - `original_info` TwitterScraperEntitiesMediaOriginalInfo
          - `height` integer, required
          - `width` integer, required
          - `focus_rects` Rect[], nullable
            - `x` integer, required
            - `y` integer, required
            - `w` integer, required
            - `h` integer, required
        - `allow_download_status` TwitterScraperEntitiesMediaAllowDownloadStatus
          - `allow_download` boolean, nullable
        - `video_info` TwitterScraperEntitiesMediaVideoInfo
          - `duration_millis` integer, nullable
          - `aspect_ratio` integer[], nullable
          - `variants` TwitterScraperEntitiesMediaVideoInfoVariant[], nullable
            - `content_type` string, required
            - `url` string, required
            - `bitrate` integer, nullable
        - `media_results` TwitterScraperEntitiesMediaResults
          - `result` TwitterScraperEntitiesMediaResult
            - `media_key` string, required
    - `retweet` TwitterScraperTweet (recursive)
    - `article` TwitterScraperArticle
      - `id` string, nullable
      - `title` string, nullable
      - `preview_text` string, nullable
      - `plain_text` string, nullable
      - `cover_media` TwitterScraperArticleCoverMedia
        - `url` string, nullable
        - `width` integer, nullable
        - `height` integer, nullable
      - `first_published_at` integer, nullable
    - `content_disclosure` TwitterScraperContentDisclosure
      - `advertising_disclosure` TwitterScraperAdvertisingDisclosure
        - `is_paid_promotion` boolean, nullable
    - `edit_control` TwitterScraperEditControl
      - `edit_tweet_ids` string[], nullable
      - `editable_until_msecs` string, nullable
      - `edits_remaining` string, nullable
      - `is_edit_eligible` boolean, nullable
    - `possibly_sensitive` boolean, nullable
  - `next_cursor` string, nullable: Cursor for pagination

## Other responses

- `301`: Moved Permanently
- `304`: Not Modified
- `401`: Unauthorized
- `404`: User not found
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error
- `503`: X crawler upstream failed or timed out

---

[API](https://skmtc.dev/desearch/apis/desearch-api.md) · [All operations](https://skmtc.dev/desearch/apis/desearch-api/llms.txt) · [OpenAPI document](https://skmtc.dev/desearch/apis/desearch-api/revisions/c2d7648859bd?raw)
