X / Twitter Search API
Search X (Twitter) with full advanced-search syntax (operators like from:, since:, until:, min_faves: work inline in the query) and get structured tweets with text, author, engagement, and cursor pagination. Limit is a per-page maximum; native pages contain approximately 20 tweets unless requireSinglePage selects a bulk lane.
Provider network
Providers ranked by traffic
capped at $0.0154 per request1 result$0.0046225 results$0.009950 results$0.0154 capYou are charged for what comes back. Lower the limit to pay less - and no single request can cost more than the cap, however much comes back.
capped at $0.0051 per request1 result$0.000225 results$0.002650 results$0.0051 capYou are charged for what comes back. Lower the limit to pay less - and no single request can cost more than the cap, however much comes back.
Try it
Make your first request
{
"data": {
"items": [
{
"authorName": "Alex Rivera",
"authorUsername": "alex_rivera",
"authorVerified": true,
"bookmarkCount": 12500,
"conversationId": "a1b2c3d4",
"createdUtc": 12.5,
"id": "a1b2c3d4",
"isReply": true,
"lang": "en",
"likeCount": 12500,
"media": [
{
"height": 42,
"type": "general",
"url": "https://example.com/page",
"videoUrl": "https://example.com/page",
"width": 1024
}
],
"quoteCount": 12500,
"replyCount": 12500,
"retweetCount": 12500,
"text": "A short example description of this item.",
"url": "https://example.com/page",
"viewCount": 12500
}
],
"nextCursor": "example"
},
"found": true
}interface TwitterSearchResponse {
data: {
items: {
authorName?: string;
authorUsername?: string;
authorVerified?: boolean;
bookmarkCount?: number;
conversationId?: string;
createdUtc?: number;
id: string;
isReply?: boolean;
lang?: string;
likeCount?: number;
media?: {
height?: number;
type: string;
url: string;
videoUrl?: string;
width?: number;
}[];
quoteCount?: number;
replyCount?: number;
retweetCount?: number;
text: string;
url: string;
viewCount?: number;
}[];
nextCursor?: string | null;
} | null;
found: boolean;
}Full parameter and response reference - every field, type, and example for this endpoint.
Reference
Request, response, and price
Last verified 2026-09-16 · uptime and latency measured over 30dcurl -X POST https://api.getanyapi.com/v1/run/twitter.search \
-H "Authorization: Bearer $ANYAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"openai"}'| Field | Type | Example value |
|---|---|---|
| Request body | ||
| query | string | "openai"Search query using X (Twitter) advanced-search syntax. IMPORTANT: bare terms are ANDed - a tweet must contain EVERY word, so a list of loosely related keywords matches nothing; use one short phrase or OR between alternatives (e.g. 'anyapi OR getanyapi'). You can embed X advanced-search operators directly in the query to filter results: from:username and to:username (author or recipient), since:YYYY-MM-DD and until:YYYY-MM-DD (date range), min_faves:N, min_retweets:N, min_replies:N (engagement floors), "exact phrase", -term to exclude, filter:media and filter:links and -filter:replies (content filters), lang:en, near:city, and geocode:lat,long,radius. Examples: 'from:OpenAI', 'AI agents min_faves:500 -filter:replies', 'nvidia since:2026-01-01 until:2026-03-01'. A query with no matches returns an empty items array; prefer the fewest words that identify the topic. |
| cursor | string | Opaque pagination cursor from a previous response's nextCursor. Omit for the first page; pass it to fetch the next page of search results. |
| limit | integer | Per-page maximum number of results to return (1-50, default 20). A provider may return a smaller native page; follow nextCursor for more. |
| queryType | enum | Result ranking: 'Latest', 'Top', 'Photos', or 'Videos' (e.g. Latest). |
| requireFields | array | Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `nextCursor` or `media`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. A named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge. On a paginated walk it applies to the first page only; later pages stay with the source that page chose, at the price it was quoted. |
| requireSinglePage | boolean | Set true to get up to limit results in one response instead of provider-native pages, served by a bulk provider when needed. |
| Response | ||
| data | object | |
| data.items | object[] | Tweet records: text, author profile, timestamp, and engagement metrics (likes, retweets, replies, views). Populated whenever the provider has data for the entity. |
| data.items[].authorName | string | Populated whenever the provider has data for the entity. |
| data.items[].authorUsername | string | Populated whenever the provider has data for the entity. |
| data.items[].authorVerifiedcan require | boolean | |
| data.items[].bookmarkCountcan require | integer | |
| data.items[].conversationIdcan require | string | |
| data.items[].createdUtc | number | UTC epoch timestamp in seconds (Unix time). Multiply by 1000 for a JS Date in milliseconds. Populated whenever the provider has data for the entity. |
| data.items[].id | string | Populated whenever the provider has data for the entity. |
| data.items[].isReplycan require | boolean | |
| data.items[].langcan require | string | |
| data.items[].likeCountcan require | integer | |
| data.items[].mediacan require | object[] | Photo, video, and GIF attachments on the post. Empty when the post has none. |
| data.items[].media[].height | integer | Pixel height of the media item, when the lane reports it. |
| data.items[].media[].type | string | One of photo, video, or gif. |
| data.items[].media[].url | string | Image URL. For a video or GIF this is the poster/thumbnail frame. X media URLs on pbs.twimg.com are publicly fetchable without authentication; append ?name=orig for the full-resolution original. |
| data.items[].media[].videoUrl | string | Playable video file URL. Present only for video and gif items. |
| data.items[].media[].width | integer | Pixel width of the media item, when the lane reports it. |
| data.items[].quoteCountcan require | integer | |
| data.items[].replyCountcan require | integer | |
| data.items[].retweetCountcan require | integer | |
| data.items[].text | string | Populated whenever the provider has data for the entity. |
| data.items[].url | string | Populated whenever the provider has data for the entity. |
| data.items[].viewCountcan require | integer | |
| data.nextCursorcan require | string | Opaque cursor for the next page of search results, or null when there are no more. Pass it back as cursor to continue. |
| found | boolean | |
| Price | ||
| Price per request | USD | $0.00065 |
| Price /1k req | USD | $0.65 |
FAQ
About the X / Twitter Search API
The AnyAPI X / Twitter Search API returns X / Twitter search data as normalized JSON from one POST call to /v1/run/twitter.search. Search X (Twitter) with full advanced-search syntax (operators like from:, since:, until:, min_faves: work inline in the query) and get structured tweets with text, author, engagement, and cursor pagination. Limit is a per-page maximum; native pages contain approximately 20 tweets unless requireSinglePage selects a bulk lane. AnyAPI routes each request across 4 sources and falls back automatically when one fails. It costs from $0.65 per 1,000 requests, in US dollars with no subscription and no monthly minimum. Over the last 30 days, 99.9% of X / Twitter search calls through AnyAPI succeeded, with a median response time of 2.2 seconds across 21,089 measured calls.