---
title: "Any Site API / /twitter/search/posts"
description: "Anysite tool anysite-api-twitter-search-posts on looot: input fields, $0.00018 per result, output shape, and code to run it with curl, JavaScript or Python."
sidebar:
  hidden: true
---

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

Twitter Search Tweets **Price:** 1 credit per 20 results

- **Tool id:** `anysite-api-twitter-search-posts`
- **Provider:** [Anysite](/providers/anysite)
- **Job:** [Search X posts by keyword](/reference/jobs/x-post-search) (`x.post.search`)
- **Price:** $0.00018 per result. A call that fails at the provider costs $0.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `any_of_these_words` | array | no |   |
| `count` | integer | yes | Max result count. Example: 20 |
| `exact_phrase` | string | no | Exact phrase (in quotes). Will be added as "phrase" to the query. Example: "btc trend" |
| `from_date` | integer | no |   |
| `from_these_accounts` | array | no |   |
| `language` | string | no |   |
| `media_type` | string | no |   |
| `mentioning_these_accounts` | array | no |   |
| `min_likes` | integer | no |   |
| `min_replies` | integer | no |   |
| `min_retweets` | integer | no |   |
| `none_of_these_words` | array | no |   |
| `query` | string | no | Main search query. Can include special operators like from:user, to:user, #hashtag, etc. Example: "crypto bitcoin" |
| `search_type` | string | no |   |
| `these_hashtags` | array | no |   |
| `timeout` | integer | no | Max scrapping execution timeout (in seconds) |
| `to_date` | integer | no |   |
| `to_these_accounts` | array | no |   |
| `x-request-id` | string | no |   |

## Output

Shape of the run's `result`, 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":"anysite-api-twitter-search-posts","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: "anysite-api-twitter-search-posts",
    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": "anysite-api-twitter-search-posts",
        "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 let looot pick among every provider of this job instead, send `job:x.post.search` as `endpointId`; see [the job page](/reference/jobs/x-post-search).
