> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrape.st/llms.txt
> Use this file to discover all available pages before exploring further.

# Recent Tweets

> Get cached tweets from tracked accounts in the last 24h

Returns tweets received from tracked X accounts within the last 24 hours. Tweets are cached in memory as they arrive on the dispatch path and expire automatically after 24h.

Provide accounts via numeric user IDs (`uids`), usernames (`usernames`), or both. Up to 100 accounts per request.

<Note>
  This endpoint only returns tweets that were captured while the account was
  being tracked. It does not backfill history — use the [backfill
  endpoints](/rest-api-reference/backfill/trigger) for that.
</Note>

## Query Parameters

<ParamField query="uids" type="string">
  Comma-separated X user IDs (e.g. `44196397,1234567`). Either `uids` or
  `usernames` is required.
</ParamField>

<ParamField query="usernames" type="string">
  Comma-separated X usernames (e.g. `elonmusk,jack`). Resolved to user IDs
  internally. Unresolved usernames are returned in the `unresolved` field.
</ParamField>

<ParamField query="since" type="number">
  Unix timestamp in milliseconds. Only tweets received at or after this time are
  returned. Omit to return all cached tweets (up to 24h).
</ParamField>

<ParamField query="group" type="string" default="flat">
  Response shape: - `flat` — single array of tweet payloads, sorted ascending by
  arrival time - `uid` — object keyed by user ID, with an array of tweets per
  user (empty array if no cached tweets for that uid)
</ParamField>

## Response

<ResponseField name="tweets" type="array | object">
  When `group=flat`: an array of tweet payloads sorted ascending by arrival
  time. When `group=uid`: an object mapping each resolved user ID to its array
  of tweet payloads.
</ResponseField>

<ResponseField name="unresolved" type="string[]">
  Usernames that could not be resolved to a user ID. Only present when at least
  one username failed to resolve.
</ResponseField>

The total request cap is 100 accounts (after merging `uids` and `usernames` and deduping). Rate limit: 30 requests per minute.

<RequestExample>
  ```bash flat theme={null}
  curl -X GET "https://scrape.st/x/tweets/recent?usernames=elonmusk,jack&since=1747699200000" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```bash grouped theme={null}
  curl -X GET "https://scrape.st/x/tweets/recent?uids=44196397,12&group=uid" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</RequestExample>

<ResponseExample>
  ```json flat theme={null}
  {
    "tweets": [
      {
        "id": "1886493083207827456",
        "text": "Bitcoin hits new all-time high! 🚀 $BTC",
        "created_at": "2024-04-02T15:30:00.000Z",
        "lang": "en",
        "author": {
          "id": "44196397",
          "name": "Elon Musk",
          "screen_name": "elonmusk"
        },
        "link": "https://x.com/elonmusk/status/1886493083207827456"
      }
    ]
  }
  ```

  ```json grouped theme={null}
  {
    "tweets": {
      "44196397": [
        {
          "id": "1886493083207827456",
          "text": "Bitcoin hits new all-time high! 🚀 $BTC",
          "author": { "id": "44196397", "screen_name": "elonmusk" }
        }
      ],
      "12": []
    }
  }
  ```

  ```json with-unresolved theme={null}
  {
    "tweets": [],
    "unresolved": ["somebody_who_does_not_exist"]
  }
  ```
</ResponseExample>
