> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# Threads Search

Structured Threads data: send `queries`. Cursor-paginated, 1 credit per successful call.

`GET|POST https://api.scrapier.io/api/v2/threads-search/` · 1 credit per successful call · Cursor-paginated

## Overview

Call `GET /api/v2/threads-search/` with `queries`. The results are in `data.posts`; send `data.next_cursor` back as `cursor` to get the next page. 6 optional parameters refine the call (see Parameters).

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/threads-search/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "queries=AI" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/threads-search/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"queries": "AI"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["posts"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `queries` | string | yes | e.g. `AI` | Threads search term / hashtag / phrase. Required first call. Aliases: search_query, q. |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `sort` | string | no | `top` | top \| recent. One of: `top`, `recent`. Locked in cursor. |
| `from` | string | no | — | Only keep posts from this username (client-side). Locked in cursor. |
| `before` | string | no | — | Only keep posts before this date (YYYY-MM-DD). Locked in cursor. |
| `after` | string | no | — | Only keep posts after this date (YYYY-MM-DD). Locked in cursor. |
| `session_id` | string | no | — | Optional Threads sessionid cookie, resolved fresh on every call (not locked into the cursor). Anonymous still works, capped at one page. |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.posts`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "query": "AI",
    "page": 1,
    "page_size": 18,
    "posts": [
      {
        "postId": "3921506418558274796",
        "postUrl": "https://www.threads.com/@theeconomist/post/DLabcXYZ",
        "username": "theeconomist",
        "isVerified": true,
        "captionText": "Today the cost of providing AI services is subsidised by the labs...",
        "likeCount": 1240,
        "directReplyCount": 87,
        "repostCount": 34,
        "takenAt": 1718628028,
        "takenAtISO": "2026-06-17T12:40:28.000Z",
        "nextCursor": "GDA6...opaque-end-cursor",
        "keyword": "AI",
        "scraped_at": "2026-06-18T12:00:00.000Z"
      }
    ],
    "next_cursor": "eyJxIjoiQUkiLCJyIjowLCJhIjoiR0RBNi4uLiIsImxrIjp7fSwicCI6MX0"
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `query` | string | `AI` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `18` |  |
| `posts` | array | `[1 item]` | The results. |
| `next_cursor` | string | `eyJxIjoiQUkiLCJyIjowLCJhIjoiR0RBNi4uLiIsImxrI…` | Pass back as `cursor` for the next page. `null` on the last page. |
| `posts[].postId` | string | `3921506418558274796` |  |
| `posts[].postUrl` | string | `https://www.threads.com/@theeconomist/post/DL…` |  |
| `posts[].username` | string | `theeconomist` |  |
| `posts[].isVerified` | boolean | `true` |  |
| `posts[].captionText` | string | `Today the cost of providing AI services is su…` |  |
| `posts[].likeCount` | integer | `1240` |  |
| `posts[].directReplyCount` | integer | `87` |  |
| `posts[].repostCount` | integer | `34` |  |
| `posts[].takenAt` | integer | `1718628028` |  |
| `posts[].takenAtISO` | string | `2026-06-17T12:40:28.000Z` |  |
| `posts[].nextCursor` | string | `GDA6...opaque-end-cursor` |  |
| `posts[].keyword` | string | `AI` |  |
| `posts[].scraped_at` | string | `2026-06-18T12:00:00.000Z` |  |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/threads-search/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"queries": "AI"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("posts") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- Locked into the cursor: `sort`, `from`, `before`, `after`. Set them on the first call; later pages reuse them.

## Related

- [Threads Profile Info](https://docs.scrapier.io/api-reference/threads/threads-profile-info.md): Structured Threads data: send `usernames`. Single lookup, 1 credit per successful call.
- [Threads Search Users](https://docs.scrapier.io/api-reference/threads/threads-search-users.md): Structured Threads data: send `queries`. Cursor-paginated, 1 credit per successful call.
- [Threads Single Post](https://docs.scrapier.io/api-reference/threads/threads-single-post.md): Structured Threads data: send `urls`. Single lookup, 1 credit per successful call.
- [Threads User Posts](https://docs.scrapier.io/api-reference/threads/threads-user-posts.md): Structured Threads data: send `usernames`. Cursor-paginated, 1 credit per successful call.
