X post search API
Find X posts by search terms, most popular or newest first; the terms may use X's own search operators, such as from:handle. Up to 20 items a call; $0.0020 per call. Errors and timeouts are not charged; an empty result is charged $0.0020.
Try it
Change a value and the request on the right follows.Sign in to run it; it runs on your own balance. New accounts can try this endpoint free, up to 50 calls.
curl -G "https://api.dataxapi.com/v1/x/posts/search" \ --data-urlencode "query=weather forecast" \ -H "Authorization: Bearer $DATAXAPI_API_KEY"
{
"code": "ok",
"request_id": "f56e2410-206b-4506-a850-44cf2be4613e",
"data": {
"items": [
{
"id": "1860387339653354774",
"url": "https://x.com/i/status/1860387339653354774",
"type": "video",
"text": "My honest take on weather forecast, a month in.",
"lang": "en",
"published_at": "2026-10-12T00:44:12.000Z",
"author": {
"id": "118815899823132376",
"username": "trail_and_lens",
"name": "Maya Chen",
"avatar_url": "https://pbs.twimg.com/profile_images/1838837416644987075/31t9r3Fm_normal.jpg",
"verified": true,
"followers": 7425
},
"metrics": {
"likes": 238,
"comments": 37,
"favorites": 145,
"views": 8357,
"reposts": 121
},
"images": [],
"hashtags": [],
"mentions": [
{
"id": "124366312906800227",
"username": "fieldnotes_studio",
"name": "Field Notes Studio"
}
],
"post_id": null,
"parent_id": null
},
// … 19 more
]
},
"page": {
"next_cursor": "c1.0BcduLiC6vViwQfDR_nS6Twlb6kjko4Qpbx3fUDt",
"cursor_expires_at": "2026-10-12T20:10:39.000Z",
"has_more": true,
"returned": 20
},
"warnings": [],
"meta": {
"capability": "x.posts.search",
"result_status": "complete",
"fetched_at": "2026-10-12T19:10:39.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"title": "platform",
"metrics.shares": "platform",
"is_pinned": "capability",
"root_id": "platform"
},
"billing": {
"amount": "0.002",
"currency": "USD",
"balance_after": "9.998"
}
}
}From a response recorded 2026-10-12 19:10 UTC. Names, text and IDs are examples, and so are the links: none is the recorded one (the page shows no one's personal data); the figures are as recorded. Long lists are cut. The request ID, cursor and balance are made up.
Size as sent: 36.4 KB in the standard view (14.8 KB compact, 37.2 KB full).
{
"code": "ok",
"request_id": "690e7ea1-9e7c-4bab-88ad-b5f73d31b098",
"data": { "items": [] },
"page": {
"next_cursor": null,
"cursor_expires_at": null,
"has_more": false,
"returned": 0
},
"warnings": [],
"meta": {
"capability": "x.posts.search",
"result_status": "empty",
"fetched_at": "2026-10-12T19:10:43.000Z",
"cached": false,
"replayed": false,
"unavailable": {
"title": "platform",
"metrics.shares": "platform",
"is_pinned": "capability",
"root_id": "platform"
},
"billing": {
"amount": "0.002",
"currency": "USD",
"balance_after": "9.998"
}
}
}From a response recorded 2026-10-12 19:10 UTC. The request ID and balance are made up.
Size as sent: 489 B in the standard view (489 B compact, 489 B full).
curl -G "https://api.dataxapi.com/v1/x/posts/search" \ --data-urlencode "query=weather forecast" \ -H "Authorization: Bearer $DATAXAPI_API_KEY"
from dataxapi import DataXAPI dx = DataXAPI() # reads DATAXAPI_API_KEY result = dx.x.posts.search(query="weather forecast") print(result["data"]["items"])
import { DataXAPI } from "@dataxapi/sdk";
const dx = new DataXAPI(); // reads DATAXAPI_API_KEY
const result = await dx.x.posts.search({ query: "weather forecast" });
console.log(result.data.items);dataxapi call x.posts.search 'query=weather forecast'{
"mcpServers": {
"dataxapi": {
"type": "http",
"url": "https://api.dataxapi.com/mcp",
"headers": {
"Authorization": "Bearer ${DATAXAPI_API_KEY}"
}
}
}
}Add this to your MCP client, then ask your agent to call x.posts.search.
Parameters
Search terms. Example: weather forecast.
Most popular first, or newest first. Values: popular (default), latest. Example: popular.
Cursor returned by the previous page. Pass page.next_cursor of the page before, unchanged. Each page is charged as a call of its own.
How much of each item to return. All three cost the same. Values: compact, standard (default), full.
Return only these fields. Each by its path, such as author.name.
Known limits
- 20 items a page. The page size is the platform's;
limitis not accepted. - For the next page pass
page.next_cursorascursor; a cursor is valid for 1 hour.page.has_moreis false on the last page. - 4 fields of the object are not available from this endpoint
Returned fields
data.items is a list of post objects. Stable: fields are only ever added.
ID; pass it unchanged to the get endpoint
Link that opens the post
Content formatvideoimagetextarticle
Title
Body text
Long text: the compact view keeps the first 500 characters and says so in warnings.
Language of the text
Show all 36 fields →
When it was published
Author
Author's account ID
Author's handle
Author's display name
Author's avatar
Whether the author is verified
Author's follower count
Engagement counts
Likes
Comments
On this platform: Replies
Shares
Saves
On this platform: Bookmarks
Views
Reposts
On this platform: Retweets; quotes are counted apart, in ext.quotes
Image addresses
Hashtags, without the #
Accounts mentioned in the text
Account ID
Handle
Display name
Whether the author pinned it
ID of the thread's root post when this is a reply; otherwise null
ID of the item it replies to directly; otherwise null
ID of the first-level reply its thread hangs under
Times it was quoted
ID of the post it quotes
Which numbers of this item are approximate or lower bounds; absent when all are exact
Path of the field, such as metrics.views
Approximate, or a lower boundapproximatelower_bound
Typical size of one item: compact 707 B, standard 1.8 KB, full 1.8 KB (measured on the response recorded 2026-10-12 19:10 UTC).
What this endpoint cannot give
titleThe platform has nonemetrics.sharesThe platform has noneis_pinnedNot provided hereroot_idThe platform has noneWhen you are charged
X-Max-Price to refuse anything above your own limit)Prices as read 2026-10-21 09:10 UTC, under price book 2, in effect since 2026-10-17 11:00 UTC; the Playground reads the price in force before a run.
Errors
What this endpoint can answer with; codes all endpoints share are on the full list.
invalid_paramsA parameter is invalidRetry: After a fixNocursor_mismatchThe cursor was issued for another endpoint or other parametersRetry: After a fixNoinsufficient_balanceThe balance is too lowRetry: After a fixNocursor_expiredThe cursor expired; start again from the first pageRetry: NoNoupstream_failedThe data source failedRetry: YesNotimeoutThe data did not arrive in time; retry with the same idempotency keyRetry: YesNoQuestions
How much does the X post search API cost?
$0.0020 per call. The most one call can cost is $0.0020.
When am I not charged?
Errors and timeouts are not charged; an empty result is charged $0.0020.
How many items does one call return, and how do I get the next page?
20 items a page. The page size is the platform's; limit is not accepted. For the next page pass page.next_cursor as cursor; a cursor is valid for 1 hour. page.has_more is false on the last page.
The same thing on other platforms
All 21 X (Twitter) endpoints
Use it in your AI
Copy this prompt
Your API key is built in, so there is nothing to configure.
No account yet? Sign-up takes an email and no card, and a failed call is never charged.
Paste it into your agent
It reads the page the prompt points to and connects itself.
Now ask something
Use one of these, or your own words.
Prefer to set it up by hand?
dataxapi setupgives the agents on your machine (Claude Code, Codex, Cursor) the DataXAPI MCP server and the base skill. The key is read from DATAXAPI_API_KEY; none is written into a file.MCP server: https://api.dataxapi.com/mcp. The entry for your client is under MCP in the request examples of this page; then ask your agent to call x.posts.search.Other clients →Show the text
Use the DataXAPI endpoint x.posts.search (X post search). Find X posts by search terms, most popular or newest first; the terms may use X's own search operators, such as from:handle. Call GET https://api.dataxapi.com/v1/x/posts/search with the header "Authorization: Bearer $DATAXAPI_API_KEY". Read the key from the environment variable DATAXAPI_API_KEY; never write it into code. Parameters: - query (required): Search terms. Example: weather forecast. - sort: Most popular first, or newest first. Values: popular (default), latest. Example: popular. - cursor: Cursor returned by the previous page. Pass page.next_cursor of the page before, unchanged. Each page is charged as a call of its own. - view: How much of each item to return. All three cost the same. Values: compact, standard (default), full. - fields: Return only these fields. Each by its path, such as author.name. Price: $0.0020 per call. Errors and timeouts are not charged; an empty result is charged $0.0020. The answer is JSON: data.items holds post; meta.billing.amount is what this call was charged. Example: curl -G "https://api.dataxapi.com/v1/x/posts/search" \ --data-urlencode "query=weather forecast" \ -H "Authorization: Bearer $DATAXAPI_API_KEY" Full reference in Markdown: https://dataxapi.com/apis/x/posts/search.md
Names and identifiers
- In Chinese
- X 帖子搜索 API
- Endpoint ID
x.posts.search- Endpoint
GET /v1/x/posts/search
Start with one key.
207 endpoints on 21 platforms, from $0.0003 a call. Errors and timeouts are not charged.