# Search posts

Search posts with X search operators, newest or most engaged first. Paginate with `cursor` and `has_more`. A malformed query returns 400; no matches return an empty `posts` array.

- Platform: X (Twitter)
- Request: `GET https://api.toolzerhub.com/v1/x/search`
- Auth: `x-api-key` header
- Cost: 5 credits per successful request. Failed requests are not billed.
- Page: https://docs.toolzerhub.com/reference/x-twitter/search/search-x-posts

| Parameter | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `query` | query | yes | string | Search text with X search operators, such as from:NASA, "exact phrase", since:2026-10-01, or #hashtag. |
| `sort` | query | no | enum: latest, top | latest returns newest posts first; top returns the most engaged posts. Default: latest. |
| `cursor` | query | no | string | cursor from the previous response. Omit for the first page and send it unchanged for later pages. |

## Example request

```bash
curl "https://api.toolzerhub.com/v1/x/search?query=<query>" \
  -H "x-api-key: $TOOLZERHUB_API_KEY"
```

Success responses are wrapped as `{ "data": ... }`. Errors return `{ "error": { "code", "status", "message", "retryable", "details" } }`. See https://docs.toolzerhub.com/docs/responses-and-errors.
