# Search tweets

> Search all of X for tweets matching a query, newest or most popular first, with X's search operators.

- **Request:** `GET https://api.lurkapi.com/v1/twitter/search`
- **Auth:** `x-api-key` header ([get a free key](https://lurkapi.com/login?next=/dashboard))
- **Cost:** 6 credits per call. Calls turned away before they reach the platform (invalid parameters, a key or balance problem, a rate limit) are free, and so are `5xx` errors. A `not_found` is charged, since the platform was checked. [How charging works](https://lurkapi.com/docs.md#credits).
- **MCP:** `twitter · search` on `https://api.lurkapi.com/mcp`
- **Freshness:** responses are cached for up to 1 minute
- **Try it live:** https://lurkapi.com/docs/twitter/search#try (no signup)
- **Platform:** [X (Twitter)](https://lurkapi.com/docs/twitter.md) (x.com)
- **Web page:** https://lurkapi.com/docs/twitter/search

## When to use this

Use it for social listening and brand monitoring: who's talking about a product, a topic or a link right now. It searches the way x.com/search does, operators included: `"exact phrase"`, `from:NASA`, `to:NASA`, `#hashtag`, `lang:en`, `since:2026-11-01`, `until:2026-11-30`, `min_faves:100`, `filter:videos`, `-filter:replies`. About 20 tweets a page, each with its author, counts and media.

**Pagination.** Pass the response's `cursor` back as `cursor` (with the same `query` and `sort`) for the next page; it's null at the end.

A query nothing matches returns an empty `tweets` list.

## Example request

Copy one and replace `YOUR_API_KEY` with your API key ([get one free](https://lurkapi.com/login?next=/dashboard)). The code versions read the key from the `LURKAPI_API_KEY` environment variable instead.

curl:

```bash
curl "https://api.lurkapi.com/v1/twitter/search?query=claude+code" \
  -H "x-api-key: YOUR_API_KEY"
```

JavaScript:

```js
const params = new URLSearchParams({
  query: "claude code",
});
const res = await fetch(`https://api.lurkapi.com/v1/twitter/search?${params}`, {
  headers: { "x-api-key": process.env.LURKAPI_API_KEY },
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.error}`);
console.log(data.tweets);
```

Python:

```python
import os
import requests

res = requests.get(
    "https://api.lurkapi.com/v1/twitter/search",
    params={
        "query": "claude code",
    },
    headers={"x-api-key": os.environ["LURKAPI_API_KEY"]},
    timeout=60,
)
data = res.json()
if not data["success"]:
    raise RuntimeError(f"{data['code']}: {data['error']}")
print(data["tweets"])
```

## Parameters

Add them to the URL after a `?`, as in `?query=claude+code`. Join several with `&`.

| Name | Type | Required | Default | Allowed values | Description | Example |
| --- | --- | --- | --- | --- | --- | --- |
| `query` | string | yes |  |  | What to search for, as on x.com/search, e.g. `claude code` or `from:NASA filter:videos`. | `claude code` |
| `sort` | string | no | `latest` | `latest`, `top` | `latest`: newest first. `top`: X's most popular matches. |  |
| `cursor` | string | no |  |  | The `cursor` from the previous response, to get the next page. |  |

## Example response

A real response, captured from the live API. Lists are trimmed to a couple of items, and long text such as media links is cut short with `…`.

200 OK (application/json):

```json
{
  "success": true,
  "credits_remaining": 999994,
  "credits_charged": 6,
  "tweets": [
    {
      "id": "2127845640688238918",
      "url": "https://x.com/thesweetvibes_/status/2127845640688238918",
      "text": "🎉 Happy 4th Birthday, ChatGPT!\n\nCongratulations on 4 years to OpenAI & …",
      "created_at": "2026-12-01T19:21:48.000Z",
      "lang": "en",
      "source": null,
      "author": {
        "id": "2107888443384631298",
        "handle": "thesweetvibes_",
        "name": "Matt Ragusa",
        "avatar": "https://pbs.twimg.com/profile_images/2125830389776211968/K33taagx_400x400.jpg",
        "verified": true,
        "verified_type": null,
        "followers": 17
      },
      "counts": {
        "likes": 0,
        "replies": 0,
        "retweets": 0,
        "quotes": 0,
        "bookmarks": 0,
        "views": 2
      },
      "media": [
        {
          "type": "photo",
          "url": "https://pbs.twimg.com/media/HYegVMEWkAED8Bz.jpg",
          "width": 1206,
          "height": 888,
          "duration_ms": null,
          "variants": []
        }
      ],
      "hashtags": [
        "ChatGPT",
        "AI",
        "OpenAI",
        "SoftwareEngineering",
        "GPT6",
        "VibeCoding",
        "Coding",
        "DevTools",
        "UIUX",
        "WebDev",
        "AIBuilders",
        "Tech",
        "CyberSecurity",
        "VoiceAI",
        "BuildInPublic",
        "AIBenchmarks",
        "LLM",
        "Codex",
        "AppSec",
        "ChatGPT4Years",
        "CodingCommunity"
      ],
      "mentions": [
        "sama"
      ],
      "links": [
        "https://community.openai.com/t/happy-birthday-chatgpt-hows-it-feel-to-be-four-years-old/1423205"
      ],
      "poll": null,
      "article": null,
      "reply_to_id": null,
      "reply_to_handle": null,
      "conversation_id": "2127845640688238918",
      "quoted_id": null,
      "possibly_sensitive": false,
      "quoted_tweet": null,
      "retweeted_tweet": null
    },
    {
      "id": "2127845530407674285",
      "url": "https://x.com/4U_EGO/status/2127845530407674285",
      "text": "$1M ARR. an AI image, video and music workspace built with Lovable, Curs…",
      "created_at": "2026-12-01T19:21:22.000Z",
      "lang": "en",
      "source": null,
      "author": {
        "id": "2112846449134419968",
        "handle": "4U_EGO",
        "name": "Ego",
        "avatar": "https://pbs.twimg.com/profile_images/2117486640889516032/Kh6YNNUy_400x400.jpg",
        "verified": false,
        "verified_type": null,
        "followers": 58
      },
      "counts": {
        "likes": 0,
        "replies": 0,
        "retweets": 0,
        "quotes": 0,
        "bookmarks": 0,
        "views": 4
      },
      "media": [],
      "hashtags": [],
      "mentions": [],
      "links": [
        "https://make.fun"
      ],
      "poll": null,
      "article": null,
      "reply_to_id": null,
      "reply_to_handle": null,
      "conversation_id": "2127845530407674285",
      "quoted_id": "2127044154693984262",
      "possibly_sensitive": false,
      "quoted_tweet": {
        "id": "2127044154693984262",
        "url": "https://x.com/makefunai/status/2127044154693984262",
        "text": "MADE WITH AI: Zohar Vanunu built https://Kolbo.AI with Lovable, Cursor a…",
        "created_at": "2026-11-29T14:16:59.000Z",
        "lang": "en",
        "source": null,
        "author": {
          "id": "2117745311074693120",
          "handle": "makefunai",
          "name": "makedotfun",
          "avatar": "https://pbs.twimg.com/profile_images/2119681592578998272/XygMw1Pw_400x400.jpg",
          "verified": true,
          "verified_type": null,
          "followers": 8370
        },
        "counts": {
          "likes": 158,
          "replies": 62,
          "retweets": 41,
          "quotes": 318,
          "bookmarks": 5,
          "views": 41407
        },
        "media": [
          {
            "type": "photo",
            "url": "https://pbs.twimg.com/media/HYTHPCxW8AEEFIc.jpg",
            "width": 1600,
            "height": 900,
            "duration_ms": null,
            "variants": []
          }
        ],
        "hashtags": [],
        "mentions": [],
        "links": [
          "https://Kolbo.AI"
        ],
        "poll": null,
        "article": null,
        "reply_to_id": null,
        "reply_to_handle": null,
        "conversation_id": "2127044154693984262",
        "quoted_id": null,
        "possibly_sensitive": false
      },
      "retweeted_tweet": null
    }
  ],
  "cursor": "t2~DAADDAABCgABHYegVh4WAUYKAAIdh5-dNxtQQwAIAAIAAAACCAADAAAAAAgABAAAAAAKA…"
}
```

## Response fields

Every field in a successful response, and what it means. A name with `[]` belongs to each item of a list: `tweets[].id` is the `id` of every item in `tweets`. `null` means there's no value.

| Field | Type | Description |
| --- | --- | --- |
| `success` | `true` | Always true here; errors have `success: false`. |
| `credits_remaining` | `number` | Your balance after this call. On anonymous playground calls: free tries left today. |
| `credits_charged` | `number` | Credits this call cost; 0 on free endpoints. On anonymous playground calls: tries used (1). |
| `tweets` | `object[]` | One page of matching tweets, in `sort` order. |
| `tweets[].id` | `string` | Tweet id, e.g. `2104593672624886205`. |
| `tweets[].url` | `string` | The tweet on x.com. |
| `tweets[].text` | `string` | The text as x.com shows it: long posts in full, t.co links expanded, without a reply's leading @mentions or the trailing media link. A retweet shows the original's text. Empty for media-only tweets. |
| `tweets[].created_at` | `string` | When it was posted, ISO 8601. |
| `tweets[].lang` | `string`, can be null | Language as X detects it, e.g. `en` (`und` when it can't tell); null if unknown. |
| `tweets[].source` | `string`, can be null | The app it was posted from, e.g. `Twitter for iPhone`; null if X doesn't say. |
| `tweets[].author` | `object` | Who posted it. |
| `tweets[].author.id` | `string` | Numeric user id. It stays the same when the handle changes. |
| `tweets[].author.handle` | `string` | Username (handle), without @. |
| `tweets[].author.name` | `string` | Display name. |
| `tweets[].author.avatar` | `string`, can be null | Profile picture URL, 400×400; null if none. |
| `tweets[].author.verified` | `boolean` | Has the blue check (X Premium). |
| `tweets[].author.verified_type` | `string`, can be null | `Business` (gold check, a verified organization) or `Government` (grey check); null otherwise. |
| `tweets[].author.followers` | `number`, can be null | Followers when fetched; null when X's main source was busy and we used its embed data instead. |
| `tweets[].counts` | `object` | Engagement when fetched. Exact numbers, not rounded. A retweet shows the original's, as x.com does. |
| `tweets[].counts.likes` | `number` | Likes. |
| `tweets[].counts.replies` | `number` | Replies. |
| `tweets[].counts.retweets` | `number`, can be null | Reposts (retweets); null when X's main source was busy and we used its embed data instead. |
| `tweets[].counts.quotes` | `number`, can be null | Quote posts; null when X's main source was busy and we used its embed data instead. |
| `tweets[].counts.bookmarks` | `number`, can be null | Bookmarks; null when X's main source was busy and we used its embed data instead. |
| `tweets[].counts.views` | `number`, can be null | Views; null on tweets from before 2023 (X didn't count them then), and null when X's main source was busy and we used its embed data instead. |
| `tweets[].media` | `object[]` | Attached photos, videos and GIFs, in order. Empty if none. |
| `tweets[].media[].type` | `string` | `photo`, `video` or `gif` (X plays GIFs as silent looping MP4s). |
| `tweets[].media[].url` | `string` | The image; for videos and GIFs, the poster (thumbnail) image. |
| `tweets[].media[].width` | `number` | Original width in pixels. |
| `tweets[].media[].height` | `number` | Original height in pixels. |
| `tweets[].media[].duration_ms` | `number`, can be null | Video length in milliseconds; null for photos and GIFs. |
| `tweets[].media[].variants` | `object[]` | Playable files for videos and GIFs: MP4s from highest to lowest bitrate, then the HLS playlist. Empty for photos. |
| `tweets[].media[].variants[].url` | `string` | File URL on video.twimg.com. |
| `tweets[].media[].variants[].content_type` | `string` | `video/mp4`, or `application/x-mpegURL` for the HLS playlist. |
| `tweets[].media[].variants[].bitrate` | `number`, can be null | Bits per second; null for the HLS playlist. |
| `tweets[].hashtags` | `string[]` | Hashtags in the text, without #. |
| `tweets[].mentions` | `string[]` | Usernames @mentioned, including the ones a reply is addressed to. |
| `tweets[].links` | `string[]` | Links in the text, expanded (not t.co). The tweet's own photos and videos aren't included. |
| `tweets[].poll` | `object`, can be null | The tweet's poll; null if it has none. |
| `tweets[].poll.options` | `object[]` | The choices, in order. |
| `tweets[].poll.options[].label` | `string` | The choice's text. |
| `tweets[].poll.options[].votes` | `number`, can be null | Votes for it, exact; null if X doesn't show them. |
| `tweets[].poll.ends_at` | `string`, can be null | When voting ends (or ended), ISO 8601; null if X doesn't say. |
| `tweets[].poll.closed` | `boolean` | Voting has ended, so the counts are final. |
| `tweets[].article` | `object`, can be null | An X Article (long-form post): title, preview, body and cover. Its tweet's `text` is just the article's link. null for other tweets. |
| `tweets[].article.title` | `string` | The article's title. |
| `tweets[].article.preview_text` | `string`, can be null | The opening lines X shows on the article's card; null if none. |
| `tweets[].article.text` | `string`, can be null | The full body as plain text, blocks separated by blank lines. Only the tweet endpoint has it; null elsewhere, where X sends only the preview. |
| `tweets[].article.cover` | `string`, can be null | Cover image URL; null if none. |
| `tweets[].reply_to_id` | `string`, can be null | Id of the tweet this replies to; null if it isn't a reply. |
| `tweets[].reply_to_handle` | `string`, can be null | Username of the account this replies to; null if it isn't a reply. |
| `tweets[].conversation_id` | `string`, can be null | Id of the thread's first tweet (its own id if it starts one); null if X doesn't say. |
| `tweets[].quoted_id` | `string`, can be null | Id of the tweet this one quotes; null if it isn't a quote. |
| `tweets[].possibly_sensitive` | `boolean` | X marks the media as possibly sensitive. |
| `tweets[].quoted_tweet` | `object`, can be null | The tweet this one quotes (without its own quoted or retweeted tweet); null if none or it's no longer available. |
| `tweets[].quoted_tweet.id` | `string` | Tweet id, e.g. `2104593672624886205`. |
| `tweets[].quoted_tweet.url` | `string` | The tweet on x.com. |
| `tweets[].quoted_tweet.text` | `string` | The text as x.com shows it: long posts in full, t.co links expanded, without a reply's leading @mentions or the trailing media link. A retweet shows the original's text. Empty for media-only tweets. |
| `tweets[].quoted_tweet.created_at` | `string` | When it was posted, ISO 8601. |
| `tweets[].quoted_tweet.lang` | `string`, can be null | Language as X detects it, e.g. `en` (`und` when it can't tell); null if unknown. |
| `tweets[].quoted_tweet.source` | `string`, can be null | The app it was posted from, e.g. `Twitter for iPhone`; null if X doesn't say. |
| `tweets[].quoted_tweet.author` | `object` | Who posted it. |
| `tweets[].quoted_tweet.author.id` | `string` | Numeric user id. It stays the same when the handle changes. |
| `tweets[].quoted_tweet.author.handle` | `string` | Username (handle), without @. |
| `tweets[].quoted_tweet.author.name` | `string` | Display name. |
| `tweets[].quoted_tweet.author.avatar` | `string`, can be null | Profile picture URL, 400×400; null if none. |
| `tweets[].quoted_tweet.author.verified` | `boolean` | Has the blue check (X Premium). |
| `tweets[].quoted_tweet.author.verified_type` | `string`, can be null | `Business` (gold check, a verified organization) or `Government` (grey check); null otherwise. |
| `tweets[].quoted_tweet.author.followers` | `number`, can be null | Followers when fetched; null when X's main source was busy and we used its embed data instead. |
| `tweets[].quoted_tweet.counts` | `object` | Engagement when fetched. Exact numbers, not rounded. A retweet shows the original's, as x.com does. |
| `tweets[].quoted_tweet.counts.likes` | `number` | Likes. |
| `tweets[].quoted_tweet.counts.replies` | `number` | Replies. |
| `tweets[].quoted_tweet.counts.retweets` | `number`, can be null | Reposts (retweets); null when X's main source was busy and we used its embed data instead. |
| `tweets[].quoted_tweet.counts.quotes` | `number`, can be null | Quote posts; null when X's main source was busy and we used its embed data instead. |
| `tweets[].quoted_tweet.counts.bookmarks` | `number`, can be null | Bookmarks; null when X's main source was busy and we used its embed data instead. |
| `tweets[].quoted_tweet.counts.views` | `number`, can be null | Views; null on tweets from before 2023 (X didn't count them then), and null when X's main source was busy and we used its embed data instead. |
| `tweets[].quoted_tweet.media` | `object[]` | Attached photos, videos and GIFs, in order. Empty if none. |
| `tweets[].quoted_tweet.media[].type` | `string` | `photo`, `video` or `gif` (X plays GIFs as silent looping MP4s). |
| `tweets[].quoted_tweet.media[].url` | `string` | The image; for videos and GIFs, the poster (thumbnail) image. |
| `tweets[].quoted_tweet.media[].width` | `number` | Original width in pixels. |
| `tweets[].quoted_tweet.media[].height` | `number` | Original height in pixels. |
| `tweets[].quoted_tweet.media[].duration_ms` | `number`, can be null | Video length in milliseconds; null for photos and GIFs. |
| `tweets[].quoted_tweet.media[].variants` | `object[]` | Playable files for videos and GIFs: MP4s from highest to lowest bitrate, then the HLS playlist. Empty for photos. |
| `tweets[].quoted_tweet.media[].variants[].url` | `string` | File URL on video.twimg.com. |
| `tweets[].quoted_tweet.media[].variants[].content_type` | `string` | `video/mp4`, or `application/x-mpegURL` for the HLS playlist. |
| `tweets[].quoted_tweet.media[].variants[].bitrate` | `number`, can be null | Bits per second; null for the HLS playlist. |
| `tweets[].quoted_tweet.hashtags` | `string[]` | Hashtags in the text, without #. |
| `tweets[].quoted_tweet.mentions` | `string[]` | Usernames @mentioned, including the ones a reply is addressed to. |
| `tweets[].quoted_tweet.links` | `string[]` | Links in the text, expanded (not t.co). The tweet's own photos and videos aren't included. |
| `tweets[].quoted_tweet.poll` | `object`, can be null | The tweet's poll; null if it has none. |
| `tweets[].quoted_tweet.poll.options` | `object[]` | The choices, in order. |
| `tweets[].quoted_tweet.poll.options[].label` | `string` | The choice's text. |
| `tweets[].quoted_tweet.poll.options[].votes` | `number`, can be null | Votes for it, exact; null if X doesn't show them. |
| `tweets[].quoted_tweet.poll.ends_at` | `string`, can be null | When voting ends (or ended), ISO 8601; null if X doesn't say. |
| `tweets[].quoted_tweet.poll.closed` | `boolean` | Voting has ended, so the counts are final. |
| `tweets[].quoted_tweet.article` | `object`, can be null | An X Article (long-form post): title, preview, body and cover. Its tweet's `text` is just the article's link. null for other tweets. |
| `tweets[].quoted_tweet.article.title` | `string` | The article's title. |
| `tweets[].quoted_tweet.article.preview_text` | `string`, can be null | The opening lines X shows on the article's card; null if none. |
| `tweets[].quoted_tweet.article.text` | `string`, can be null | The full body as plain text, blocks separated by blank lines. Only the tweet endpoint has it; null elsewhere, where X sends only the preview. |
| `tweets[].quoted_tweet.article.cover` | `string`, can be null | Cover image URL; null if none. |
| `tweets[].quoted_tweet.reply_to_id` | `string`, can be null | Id of the tweet this replies to; null if it isn't a reply. |
| `tweets[].quoted_tweet.reply_to_handle` | `string`, can be null | Username of the account this replies to; null if it isn't a reply. |
| `tweets[].quoted_tweet.conversation_id` | `string`, can be null | Id of the thread's first tweet (its own id if it starts one); null if X doesn't say. |
| `tweets[].quoted_tweet.quoted_id` | `string`, can be null | Id of the tweet this one quotes; null if it isn't a quote. |
| `tweets[].quoted_tweet.possibly_sensitive` | `boolean` | X marks the media as possibly sensitive. |
| `tweets[].retweeted_tweet` | `object`, can be null | For retweets: the original tweet and its author. The retweet's own text, media, links and counts mirror it (as on x.com); its id, author and `created_at` are the retweet's. null for everything else. |
| `tweets[].retweeted_tweet.id` | `string` | Tweet id, e.g. `2104593672624886205`. |
| `tweets[].retweeted_tweet.url` | `string` | The tweet on x.com. |
| `tweets[].retweeted_tweet.text` | `string` | The text as x.com shows it: long posts in full, t.co links expanded, without a reply's leading @mentions or the trailing media link. A retweet shows the original's text. Empty for media-only tweets. |
| `tweets[].retweeted_tweet.created_at` | `string` | When it was posted, ISO 8601. |
| `tweets[].retweeted_tweet.lang` | `string`, can be null | Language as X detects it, e.g. `en` (`und` when it can't tell); null if unknown. |
| `tweets[].retweeted_tweet.source` | `string`, can be null | The app it was posted from, e.g. `Twitter for iPhone`; null if X doesn't say. |
| `tweets[].retweeted_tweet.author` | `object` | Who posted it. |
| `tweets[].retweeted_tweet.author.id` | `string` | Numeric user id. It stays the same when the handle changes. |
| `tweets[].retweeted_tweet.author.handle` | `string` | Username (handle), without @. |
| `tweets[].retweeted_tweet.author.name` | `string` | Display name. |
| `tweets[].retweeted_tweet.author.avatar` | `string`, can be null | Profile picture URL, 400×400; null if none. |
| `tweets[].retweeted_tweet.author.verified` | `boolean` | Has the blue check (X Premium). |
| `tweets[].retweeted_tweet.author.verified_type` | `string`, can be null | `Business` (gold check, a verified organization) or `Government` (grey check); null otherwise. |
| `tweets[].retweeted_tweet.author.followers` | `number`, can be null | Followers when fetched; null when X's main source was busy and we used its embed data instead. |
| `tweets[].retweeted_tweet.counts` | `object` | Engagement when fetched. Exact numbers, not rounded. A retweet shows the original's, as x.com does. |
| `tweets[].retweeted_tweet.counts.likes` | `number` | Likes. |
| `tweets[].retweeted_tweet.counts.replies` | `number` | Replies. |
| `tweets[].retweeted_tweet.counts.retweets` | `number`, can be null | Reposts (retweets); null when X's main source was busy and we used its embed data instead. |
| `tweets[].retweeted_tweet.counts.quotes` | `number`, can be null | Quote posts; null when X's main source was busy and we used its embed data instead. |
| `tweets[].retweeted_tweet.counts.bookmarks` | `number`, can be null | Bookmarks; null when X's main source was busy and we used its embed data instead. |
| `tweets[].retweeted_tweet.counts.views` | `number`, can be null | Views; null on tweets from before 2023 (X didn't count them then), and null when X's main source was busy and we used its embed data instead. |
| `tweets[].retweeted_tweet.media` | `object[]` | Attached photos, videos and GIFs, in order. Empty if none. |
| `tweets[].retweeted_tweet.media[].type` | `string` | `photo`, `video` or `gif` (X plays GIFs as silent looping MP4s). |
| `tweets[].retweeted_tweet.media[].url` | `string` | The image; for videos and GIFs, the poster (thumbnail) image. |
| `tweets[].retweeted_tweet.media[].width` | `number` | Original width in pixels. |
| `tweets[].retweeted_tweet.media[].height` | `number` | Original height in pixels. |
| `tweets[].retweeted_tweet.media[].duration_ms` | `number`, can be null | Video length in milliseconds; null for photos and GIFs. |
| `tweets[].retweeted_tweet.media[].variants` | `object[]` | Playable files for videos and GIFs: MP4s from highest to lowest bitrate, then the HLS playlist. Empty for photos. |
| `tweets[].retweeted_tweet.media[].variants[].url` | `string` | File URL on video.twimg.com. |
| `tweets[].retweeted_tweet.media[].variants[].content_type` | `string` | `video/mp4`, or `application/x-mpegURL` for the HLS playlist. |
| `tweets[].retweeted_tweet.media[].variants[].bitrate` | `number`, can be null | Bits per second; null for the HLS playlist. |
| `tweets[].retweeted_tweet.hashtags` | `string[]` | Hashtags in the text, without #. |
| `tweets[].retweeted_tweet.mentions` | `string[]` | Usernames @mentioned, including the ones a reply is addressed to. |
| `tweets[].retweeted_tweet.links` | `string[]` | Links in the text, expanded (not t.co). The tweet's own photos and videos aren't included. |
| `tweets[].retweeted_tweet.poll` | `object`, can be null | The tweet's poll; null if it has none. |
| `tweets[].retweeted_tweet.poll.options` | `object[]` | The choices, in order. |
| `tweets[].retweeted_tweet.poll.options[].label` | `string` | The choice's text. |
| `tweets[].retweeted_tweet.poll.options[].votes` | `number`, can be null | Votes for it, exact; null if X doesn't show them. |
| `tweets[].retweeted_tweet.poll.ends_at` | `string`, can be null | When voting ends (or ended), ISO 8601; null if X doesn't say. |
| `tweets[].retweeted_tweet.poll.closed` | `boolean` | Voting has ended, so the counts are final. |
| `tweets[].retweeted_tweet.article` | `object`, can be null | An X Article (long-form post): title, preview, body and cover. Its tweet's `text` is just the article's link. null for other tweets. |
| `tweets[].retweeted_tweet.article.title` | `string` | The article's title. |
| `tweets[].retweeted_tweet.article.preview_text` | `string`, can be null | The opening lines X shows on the article's card; null if none. |
| `tweets[].retweeted_tweet.article.text` | `string`, can be null | The full body as plain text, blocks separated by blank lines. Only the tweet endpoint has it; null elsewhere, where X sends only the preview. |
| `tweets[].retweeted_tweet.article.cover` | `string`, can be null | Cover image URL; null if none. |
| `tweets[].retweeted_tweet.reply_to_id` | `string`, can be null | Id of the tweet this replies to; null if it isn't a reply. |
| `tweets[].retweeted_tweet.reply_to_handle` | `string`, can be null | Username of the account this replies to; null if it isn't a reply. |
| `tweets[].retweeted_tweet.conversation_id` | `string`, can be null | Id of the thread's first tweet (its own id if it starts one); null if X doesn't say. |
| `tweets[].retweeted_tweet.quoted_id` | `string`, can be null | Id of the tweet this one quotes; null if it isn't a quote. |
| `tweets[].retweeted_tweet.possibly_sensitive` | `boolean` | X marks the media as possibly sensitive. |
| `cursor` | `string`, can be null | Pass as `cursor` for the next page; null on the last page. |

## Pagination

Results come in pages. For the next page, repeat the call with the same parameters and add the response's `cursor` as `cursor`. On the last page, `cursor` is `null`. Each page costs 6 credits.

The first five pages, in JavaScript:

```js
let cursor = null;
for (let page = 1; page <= 5; page++) {
  const params = new URLSearchParams({ query: "claude code" });
  if (cursor) params.set("cursor", cursor);
  const res = await fetch(`https://api.lurkapi.com/v1/twitter/search?${params}`, {
    headers: { "x-api-key": process.env.LURKAPI_API_KEY },
  });
  const data = await res.json();
  if (!data.success) throw new Error(`${data.code}: ${data.error}`);
  console.log(data.tweets);
  cursor = data.cursor;
  if (!cursor) break; // last page
}
```

## Cost and freshness

Each call costs 6 credits. Calls turned away before they reach the platform (invalid parameters, a key or balance problem, a rate limit) are free, and so are `5xx` errors. A `not_found` is charged, since the platform was checked. [How charging works](https://lurkapi.com/docs.md#credits).

Answers are cached for up to 1 minute. A repeat call within that time can return the same data, and costs the same.

## Errors

A failed call returns `success: false`, an `error` message, a `code` your program can check, and a `docs` link. These are the errors this endpoint can return. [All error codes](https://lurkapi.com/docs.md#errors).

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `missing_api_key` | No API key was sent. Put it in the `x-api-key` header. |
| 401 | `invalid_api_key` | This key doesn't exist or was revoked. |
| 402 | `insufficient_credits` | Not enough credits for this call. Buy a pack, or wait for tomorrow's free top-up. |
| 402 | `over_max_credits` | This call would cost more than the `max_credits` you set. The error says what it needs; raise `max_credits` to allow it. Not charged. |
| 403 | `account_suspended` | This account is suspended. Email support@lurkapi.com. Not charged. |
| 405 | `method_not_allowed` | Endpoints only take `GET`, with parameters in the URL. |
| 429 | `rate_limited` | Too many calls in a short time. Wait as many seconds as the `retry-after` header says, then retry. |
| 500 | `internal_error` | Something broke on our side. Retry. Not charged. |
| 502 | `upstream_error` | The platform didn't send a usable answer. Retry. Not charged. |
| 503 | `upstream_busy` | All our connections to the platform are busy. Retry in a few seconds. Not charged. |
| 504 | `upstream_timeout` | The platform took over 30 seconds to answer (90 for web pages). Retry. Not charged. |

## Use it in Claude

[Connect LurkAPI to Claude](https://lurkapi.com/docs.md#claude) and ask in plain English. This endpoint is the `twitter` tool with `endpoint: "search"`. For example:

Ask Claude:

```text
Use LurkAPI's twitter tool (search) with query "claude code", then summarize what you find.
```

Claude calls `twitter` with arguments like these, and each call costs 6 credits:

Tool arguments:

```json
{
  "endpoint": "search",
  "query": "claude code"
}
```

To save tokens, tool results leave out empty fields, keep one URL per image or video, and give transcripts as plain text unless you pass `timestamps=true`. A result over 45,000 characters comes in parts. Its `_note` gives the `offset` for the next part, and later parts are free for 15 minutes. Pass `trim=false` for the full response.

---

Previous: [User tweets](https://lurkapi.com/docs/twitter/user-tweets.md) · Next: [Tweet replies](https://lurkapi.com/docs/twitter/replies.md)
