The X/Twitter API built for AI agents: no keys, no signup, pay per call.

Last updated July 28, 2026

A Twitter/X API for AI agents is one an agent can use end to end without a human: discover the tools, learn the price, pay, and get data — all over HTTP. twitr.sh implements exactly that loop: 14 X/Twitter tools (reads, search, timelines, bulk extraction, real-time monitors, and posting), each priced per call from $0.0012 and paid in USDC through the HTTP 402 flow. The wallet is the account.

Why API keys don't work for agents

Traditional APIs assume a human: sign up, verify an email, pick a subscription, store a secret key, rotate it when it leaks. An autonomous agent can do none of that cleanly — and a shared key turns every agent into the same billing identity. The pay-per-call model replaces all of it with two primitives agents already have: an HTTP client and a wallet. Identity is the signing wallet; authorization is the payment itself; metering is per request with the price stated up front.

The whole integration, in one exchange

# 1) call any tool — no credentials
curl -X POST https://twitr.sh/api/tools/x_search \
  -H 'Content-Type: application/json' \
  -d '{"q":"agentic payments","resultsLimit":50}'

# → 402 Payment Required
#   the challenge carries the exact USDC amount + accepted rails
#   (x402 on Base/Solana, MPP on Tempo)

# 2) an x402-aware client signs the payment and retries automatically
# → 200 + tweets + on-chain settlement receipt

Agents that speak MCP skip HTTP entirely: POST /api/mcp lists all tools for free and gates tools/call with a JSON-RPC 402. Skill-aware clients can install the full playbook with npx skills add lnvestor/twitr-skills.

What agents actually get

Reads and search — tweets, profiles, timelines, lists, communities, and full-operator search, billed per returned item with a mandatory resultsLimit cap. Bulk extraction — async jobs up to thousands of rows, fetched later by the paying wallet. Real time — account and keyword monitors emitting 21 event types to signed webhooks (~$0.025/hr, prepaid). Writes — 12 actions through a connected X account, from posting to DMs, credentials never stored. Browse every tool and its price, or start with the docs.

FAQ

Can an AI agent use the X/Twitter API without a human signing up?

Yes, through the pay-per-call model: the agent POSTs a tool endpoint, receives HTTP 402 Payment Required with an exact USDC price, signs the payment with its own wallet (x402 on Base or Solana, MPP on Tempo), and retries to get the data. No account, no API key, no human onboarding step.

How does an agent discover what the API can do?

Three machine-readable surfaces: an MCP endpoint at POST /api/mcp (tools/list is free), an llms.txt service index with per-tool pricing, and a full OpenAPI 3.1 spec with payment discovery extensions. There is also an installable agent skill at /skill.md with the complete workflow.

How does an agent control its spend?

Every 402 challenge carries the exact price before payment, volume tools require a resultsLimit so per-item bills are capped, failed calls are never charged, and resource-creating calls require an Idempotency-Key so retries never double-charge.

Can an agent receive X/Twitter events in real time?

Yes. Monitors watch an account or keyword and emit 21 event types. The agent either polls the events endpoint or registers an HTTPS webhook and receives HMAC-signed POSTs with a durable retry ladder — silence is never ambiguous because expiry emits a terminal event.