X recent tweet search
POST /api/x-search-recentSearch public tweets from the last 7 days on X (Twitter) by query, using X API v2 search operators (keywords, from:, #hashtag, lang:, -is:retweet). Returns up to 10 tweets per call with text, created time, language, engagement metrics (likes, retweets, replies, quotes, impressions) and the author's username flattened onto each row, plus a next_token for paging.
Input
| Field | Type | Description |
|---|---|---|
query * | string | X search query (max 512 chars). Supports X operators: from:user, #tag, lang:en, -is:retweet, has:links. |
max_results | number | Tweets per page, up to 10 (default 10). The upstream bills per post returned, so the page size is capped. |
sort_order | string | recency (default) or relevancy. |
next_token | string | Pagination token from a previous response. |
Example output
{
"source": "x-api-v2",
"fetchedAt": "2026-08-20T14:10:00.000Z",
"query": "x402 -is:retweet",
"count": 1,
"tweets": [
{
"id": "1800000000000000000",
"text": "x402 lets an agent pay for an API call with one HTTP round trip.",
"createdAt": "2026-08-20T14:05:00.000Z",
"lang": "en",
"authorId": "1234567890",
"author": {
"username": "example_dev",
"name": "Example Dev",
"verified": false
},
"conversationId": "1800000000000000000",
"possiblySensitive": false,
"metrics": {
"likes": 12,
"retweets": 3,
"replies": 1,
"quotes": 0,
"bookmarks": 2,
"impressions": 1400
},
"url": "https://x.com/example_dev/status/1800000000000000000"
}
],
"nextToken": "b26v89c19zqg8o3fpzbl7xxxxx"
}
Try it - see the 402 challenge (free)
curl -i -X POST https://agent402.tools/api/x-search-recent \
-H "Content-Type: application/json" \
-d '{"query":"x402 -is:retweet","max_results":10}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
Paid call (JavaScript agent)
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/x-search-recent", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"query": "x402 -is:retweet",
"max_results": 10
}),
});
Related tools
Extract article
POST /api/extractExtract the main article content from any public URL as clean markdown. Returns title, byline, excerpt, word count, and …
try in playground →Page metadata
GET /api/metaFetch page metadata for a URL: title, description, OpenGraph, Twitter cards, canonical URL, favicon.
try in playground →Browser render
POST /api/renderRender a page in a real headless Chromium browser (JavaScript executed), then extract the main content as clean markdown…
try in playground →