---
title: "Search X posts by keyword"
description: "Run job:x.post.search through the looot API: 3 providers, from $0.00018 per result. Inputs, prices, output shape and code for curl, JavaScript and Python."
sidebar:
  hidden: true
---

{/* Generated by scripts/generate-api-reference.mjs from data/api-reference.json. Do not edit. */}

Search X posts by keyword.

Job id `x.post.search`, in [Social data](/catalog/social) (X). As of 2026-10-01, 3 providers serve it through 3 tools. Run `job:x.post.search` and looot picks one of them; with `fallback` on, a miss moves on to the next. See [Jobs](/concepts/jobs).

## Inputs

Fields the job's tools take, most shared first. Any key you send passes through unchanged.

| Name | Type | Taken by | Required by | Description |
| --- | --- | --- | --- | --- |
| `cursor` | string | 2 of 3 | 0 | Opaque pagination cursor from a previous response's nextCursor. Omit for the first page; pass it to fetch the next page of search results. |
| `query` | string | 2 of 3 | 1 | Main search query. Can include special operators like from:user, to:user, #hashtag, etc. Example: "crypto bitcoin" |
| `search_type` | string | 2 of 3 | 0 |   |
| `any_of_these_words` | array | 1 of 3 | 0 |   |
| `count` | integer | 1 of 3 | 1 | Max result count. Example: 20 |
| `exact_phrase` | string | 1 of 3 | 0 | Exact phrase (in quotes). Will be added as "phrase" to the query. Example: "btc trend" |
| `from_date` | integer | 1 of 3 | 0 |   |
| `from_these_accounts` | array | 1 of 3 | 0 |   |
| `keyword` | string | 1 of 3 | 1 | Search Keyword |
| `language` | string | 1 of 3 | 0 |   |
| `limit` | integer | 1 of 3 | 0 | Per-page maximum number of results to return (1-50, default 20). A provider may return a smaller native page; follow nextCursor for more. |
| `media_type` | string | 1 of 3 | 0 |   |
| `mentioning_these_accounts` | array | 1 of 3 | 0 |   |
| `min_likes` | integer | 1 of 3 | 0 |   |
| `min_replies` | integer | 1 of 3 | 0 |   |

## Providers and prices

| Provider | Tool | Price |
| --- | --- | --- |
| [Anysite](/providers/anysite) | [`anysite-api-twitter-search-posts`](/reference/tools/anysite-api-twitter-search-posts) | $0.00018 per result |
| AnyAPI | [`anyapi-run-twitter-search`](/reference/tools/anyapi-run-twitter-search) | $0.00075 per call |
| [TikHub](/providers/tikhub) | [`tikhub-api-twitter-web-fetch-search-timeline`](/reference/tools/tikhub-api-twitter-web-fetch-search-timeline) | $0.001 per call |

A call that fails at the provider costs $0. See [What's free](/money/free-and-failures).

## Output

Each provider answers in its own shape. Shape of the run's `result` from [`anysite-api-twitter-search-posts`](/reference/tools/anysite-api-twitter-search-posts), checked against 4 real answers:

```txt
{ id, url, card: { url, @type, title, domain, card_type, image_url, vanity_url, description }, lang, poll, text, urls: { url, @type, indices: integer[], display_url, expanded_url }[], user: { url, name, @type, alias, image, rest_id, verified, verified_type, is_blue_verified }, @type, medias: { type, @type, width, height, alt_text, media_id, media_url, video_url, duration_ms, expanded_url, allow_download, source_user_id, source_status_id, preview_image_url }[], quoted: { id, url, card: { url, @type, title, domain, card_type, image_url, vanity_url, description }, lang, poll, text, urls: { url, @... ...
```

The shape is cut here. Signed in, `looot inspect anysite-api-twitter-search-posts` prints all of it.

## Run it

Every call needs your API token in `LOOOT_TOKEN`; [Sign in](/get-started/sign-in#use-the-token-in-scripts-and-agents) shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With `wait: 30` the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll `GET /v1/runs/<runId>`.

Example input with placeholder values:

<CodeGroup>

```bash curl
curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"job:x.post.search","input":{"count":20,"query":"crypto bitcoin","exact_phrase":"btc trend"},"wait":30}'
```

```js JavaScript
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "job:x.post.search",
    input: {
      count: 20,
      query: "crypto bitcoin",
      exact_phrase: "btc trend",
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
```

```python Python
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "job:x.post.search",
        "input": {
            "count": 20,
            "query": "crypto bitcoin",
            "exact_phrase": "btc trend",
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))
```

</CodeGroup>

To pin one provider, send its tool id as `endpointId` instead of `job:x.post.search`.
