# Agent402 X (Twitter) Recent Search

> Agent402 X (Twitter) Recent Search is a paid API for AI agents from agent402.tools, paid per call via x402, $0.08/call, status unknown (last checked 2026-09-14).

Search recent posts on X (Twitter) using full X query syntax and return tweets with engagement metrics, author info, and pagination support.

## Facts

- Endpoint: POST https://agent402.tools/api/x-search-recent
- Price: $0.08/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-x-twitter-recent-search-8b35e420
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_KAS2pkmjGeKEhL0oTrd7r

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-x-twitter-recent-search-8b35e420 -d '<json body>'
```

Example prompt: Search X for recent posts about 'bitcoin ETF' that aren't retweets, sorted by recency, and give me the top 10 results with their engagement stats.

## When to prefer this

Choose this endpoint when an agent needs real-time or recent social data from X (Twitter) without managing API keys or OAuth credentials. It is ideal for crypto/finance agents monitoring social sentiment, agents tracking trending hashtags, or workflows that need structured tweet data with engagement metrics. Prefer it over direct X API access when the agent uses x402 or MPP micropayment rails and benefits from pay-per-call pricing at $0.08 USDC. Not suitable for historical tweet archives (beyond recent window) or full user timeline retrieval.

## Known failure modes

- Query exceeds 512 characters — request rejected
- Invalid X query operator syntax — upstream API error returned
- max_results above 10 — capped or error
- Invalid pagination token — empty or error response
- Payment failure via x402/MPP — 402 response before results are returned
- Upstream X API rate limit hit — error propagated to caller
- No matching tweets found — count 0, empty tweets array

## How this service works

Search 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.

## Output

Returns a JSON object containing a count of results, the original query string, a source identifier ('x-api-v2'), and an array of tweet objects. Each tweet includes its ID, URL, text, language, author details (name, username, verified status), full engagement metrics (likes, retweets, replies, quotes, bookmarks, impressions), creation timestamp, conversation ID, and a sensitivity flag. Also includes a fetchedAt timestamp and an optional nextToken for pagination.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "query": {
   "type": "string",
   "description": "X search query (max 512 chars). Supports X operators: from:user, #tag, lang:en, -is:retweet, has:links."
  },
  "next_token": {
   "type": "string",
   "description": "Pagination token from a previous response."
  },
  "sort_order": {
   "type": "string",
   "description": "recency (default) or relevancy."
  },
  "max_results": {
   "type": "number",
   "description": "Tweets per page, up to 10 (default 10). The upstream bills per post returned, so the page size is capped."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 1,
  "query": "x402 -is:retweet",
  "source": "x-api-v2",
  "tweets": [
   {
    "id": "20",
    "url": "https://x.com/jack/status/20",
    "lang": "en",
    "text": "just setting up my twttr",
    "author": {
     "name": "jack",
     "username": "jack",
     "verified": false
    },
    "metrics": {
     "likes": 180000,
     "quotes": 30000,
     "replies": 10000,
     "retweets": 120000,
     "bookmarks": 5000,
     "impressions": 0
    },
    "authorId": "12",
    "createdAt": "2006-03-21T20:50:14.000Z",
    "conversationId": "20",
    "possiblySensitive": false
   }
  ],
  "fetchedAt": "2026-08-20T14:10:00.000Z",
  "nextToken": "b26v89c19zqg8o3fpzbl7xxxxx"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-x-twitter-recent-search-8b35e420/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
