Guide · Twitter Search API
Search current public X/Twitter posts with operators you can reproduce.
xfetch turns a recent-search query into normalized JSON for apps, research, and AI pipelines. Start with a fixed no-signup Demo, then use your API key for custom queries and pagination.
Reproducible public sample
ai agents min_faves:50 lang:en -filter:replies- Returned limit
- 5
- API key
- Not required
- Freshness evidence
- Live status
Direct answer
What is a Twitter Search API?
A Twitter Search API lets software retrieve public posts matching a keyword query and operators such as author, language, date, engagement, link, hashtag, cashtag, phrase, or reply filters. xfetch exposes recent search through /v1/search/recent for tweet objects and/v1/search/recent/enriched when you also need a deduplicated author set.
Reproducible evidence
Run the same fixed query now
This public route executes the query shown below. The response is current JSON, not a hand-written example. It is rate-limited and may briefly serve a successful cached response.
curl 'https://xfetch.io/api/demo?run=search' # Fixed underlying query ai agents min_faves:50 lang:en -filter:replies
{
"data": [ { "id", "text", "author_id", "created_at" } … ],
"meta": {
"pagination": { "next_token": "opaque…" },
"credits": { "charged": 6 }
}
}Query language
Operators supported by recent search
| Intent | Operator | Example |
|---|---|---|
| Exact phrase | "…" | "AI agents" |
| Alternatives / grouping | OR, () | (bitcoin OR ethereum) |
| Author | from: | from:openai |
| Language | lang: | lang:en |
| Date window | since:, until: | since:2026-07-01 |
| Engagement | min_faves:, min_retweets: | min_faves:50 |
| Entity | #, $ | #ai, $BTC |
| Content / exclusion | filter:links, - | -filter:replies |
Combine topic terms with engagement, language, and reply filters to narrow a high-volume recency stream into a more useful research sample.
Pagination
Pass next_token unchanged
- Run the first request with
queryand optionallimit. - Read
meta.pagination.next_tokenfrom the response. - Pass it unchanged as
next_tokenon the next request. - Stop when the token is absent. Never parse or infer its contents.
Customer API request
GET /v1/search/recent?query=ai%20agents&limit=20&next_token=opaque…Authorization: Bearer <api_key>Predictable credits
Basic search or enriched search?
The numbers below are calculated from the same endpoint-pricing code used by the product. New accounts start with 1,000 credits.
| Endpoint | Returns | 5 posts | 20 posts |
|---|---|---|---|
/v1/search/recent | Tweet objects | 6 credits | 21 credits |
/v1/search/recent/enriched | Tweets + deduplicated authors | 11 credits | 41 credits |
Charges use the number of primary posts actually returned: basic is 1 base + 1 per post; enriched is 1 base + 2 per post. Failed validation, authentication, insufficient-credit, rate-limit, service-side, and internal failures are not charged. See the workload calculator for a larger estimate.
FAQ
Twitter Search API questions
- What is a Twitter Search API?
- A Twitter Search API lets software retrieve public posts that match keywords and operators. xfetch recent search returns normalized JSON over a read-only REST API, with an opaque pagination token when another page is available.
- Can I test xfetch Twitter search without signing up?
- Yes. The fixed public Search Demo runs a real operator query and returns current JSON without an API key. It is rate-limited and intentionally uses a fixed query; sign in to run your own searches.
- How does recent-search pagination work?
- Read meta.pagination.next_token from the response and pass it unchanged as next_token on the next request. Treat the token as opaque and stop when the field is absent.
- How many credits does Twitter search cost?
- Basic recent search costs 1 base credit plus 1 credit per returned post. Enriched search costs 1 base credit plus 2 credits per returned post because it also returns a deduplicated author set. Failed calls are not charged.
- When should I use enriched search?
- Use enriched search when an analysis or AI pipeline needs author profiles next to matched posts. Use basic recent search when tweet objects alone are enough and the lower per-item cost matters.
Sources & scope
Check the contract behind this guide
- Basic recent-search contract
- Enriched recent-search contract
- Machine-readable OpenAPI contract
- Machine-readable pricing and limits
- Live status, latency, and Search sample freshness
Last updated . This page documents xfetch’s read-only product behavior; pagination tokens are opaque and no completeness or platform-wide freshness SLA is implied.