HTTP 402 · USDC · no signup

The Twitter (X) API over x402: pay per call, no API key

An agent or script can read public X data from twitterapi.io without an account: it sends the request, gets an HTTP 402 with a price, pays that price in USDC on Base or Solana, and gets the data back. Each call is paid on its own, starting at $0.005.

33

read-only routes: tweets, users, lists, communities, Spaces, trends

$0.005

lowest price per call (a profile, an article, a Space)

2 chains

USDC on Base or on Solana, your client picks

/01

How one paid call works

  1. 1Send the normal GET request to an /x402/twitter/… route with no key and no payment.
  2. 2We answer 402 Payment Required with a PAYMENT-REQUIRED header: base64 JSON with the price, the accepted networks and the address to pay.
  3. 3Your x402 client signs a USDC payment for that exact amount and sends the same request again with it in the PAYMENT-SIGNATURE header.
  4. 4The payment is checked, the data is fetched, and you get 200 with the same JSON body as the regular endpoint.
terminal
# Step 1: ask for the price (no payment, nothing is charged)
curl -i "https://api.twitterapi.io/x402/twitter/user/info?userName=jack"

# HTTP/2 402
# payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...   (base64 JSON)
# {"error":"Payment required"}

The 402 offer for a profile lookup, decoded

This is what the header of /x402/twitter/user/info said when we requested it in 2026. There are two entries in accepts, one per chain; your client signs one of them.

FieldBaseSolanaWhat it means
schemeexactexacta fixed price, not metered
networkeip155:8453solana:5eykt4Us…Base mainnet / Solana mainnet (CAIP-2 IDs)
amount50005000USDC has 6 decimals, so 5000 = $0.005
asset0x833589fC…EPjFWdd5…the USDC token contract on each chain
payToour addressour addresswhere the USDC goes
maxTimeoutSeconds300300the signed payment is valid for 5 minutes

New to the protocol itself? Our x402 protocol explainer covers who settles the payments, the v2 spec and how x402 compares with other agent payment schemes.

/02

Call it from TypeScript

Any x402 v2 client handles steps 1 to 4. With the @x402/fetch package from the x402 project, a paid search is one wrapped fetch:

search.ts
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch"
import { ExactEvmScheme } from "@x402/evm"
import { privateKeyToAccount } from "viem/accounts"

// A wallet holding a little USDC on Base. Keep the key in an env var.
const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`)

const payFetch = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
})

// Reads the 402 offer, signs $0.006 in USDC, retries, returns the data.
const res = await payFetch(
  "https://api.twitterapi.io/x402/twitter/tweet/advanced_search" +
    "?query=" + encodeURIComponent("x402 -is:retweet") + "&queryType=Latest",
)
const page = await res.json()
console.log(page.tweets.length, "posts, next cursor:", page.next_cursor)

For Solana, register the Solana scheme client from the same project instead of the EVM one. The response body matches the regular endpoint, so code written against our x402 docs or the API reference works unchanged.

/03

All 33 routes and what one call costs

Every route is a GET under https://api.twitterapi.io/x402/twitter. Paginated routes return one page per call; pass the cursor from the response to get the next page, which is a new paid call. Agents can read the same list as JSON at /.well-known/x402 or in the OpenAPI file.

RouteOne call returnsPrice
Tweets
/tweet/advanced_search1 page, up to 20 posts$0.006
/tweetsup to 20 posts by ID$0.006
/tweet/repliesup to 20 replies$0.006
/tweet/replies/v21 large page, up to about 140 replies$0.042
/tweet/quotesup to 20 quote posts$0.006
/tweet/retweetersup to 20 users$0.006
/tweet/thread_contextthe thread around a post$0.018
/article1 X Article, full text$0.005
Users
/user/info1 profile$0.005
/user/batch_info_by_idsup to 20 profiles by ID$0.008
/user_about1 'About this account' record$0.005
/user/searchup to 20 accounts$0.008
/user/last_tweets1 page, about 20 posts$0.015
/user/tweet_timeline1 page of a timeline$0.018
/user/mentionsup to 20 posts$0.006
/user/articles1 page of X Articles$0.005
/user/followersup to 200 followers$0.008
/user/followingsup to 200 accounts$0.008
/user/verifiedFollowersup to 20 verified followers$0.005
/user/followers_idsup to 5,000 follower IDs$0.08
/user/subscriptionsup to 20 accounts$0.006
/user/check_follow_relationshipfollows / followed-by for 2 users$0.005
Lists, communities, Spaces, trends
/list/tweetsup to 20 posts$0.006
/list/tweets_timelineup to 100 posts$0.03
/list/followersup to 20 users$0.008
/list/membersup to 20 users$0.008
/community/info1 community$0.005
/community/membersup to 20 users$0.008
/community/moderatorsup to 20 users$0.008
/community/tweetsup to 20 posts$0.006
/community/get_tweets_from_all_community1 page of community posts$0.009
/spaces/detail1 Space$0.005
/trendsup to 50 trends for a location$0.015
/04

x402, an API key or the official X API?

x402 trades price for zero setup. The same reads with a prepaid twitterapi.io API key cost much less per call, and both are below the official X API's pay-per-use rates for these two reads:

Taskx402 (no account)twitterapi.io API keyOfficial X API
Look up 1 profile$0.005$0.00018$0.010
Search: 1 page of 20 posts$0.006$0.003$0.10

API key prices are $0.18 per 1,000 profiles and $0.15 per 1,000 posts (see pricing). Official X prices are $0.010 per user read and $0.005 per post read, from X's X API pricing page, checked in 2026; that route also needs an X developer account and app.

Use x402 when

an agent needs a few reads without anyone signing up, you want to pay from a wallet instead of a card, or each call is billed on to someone else.

Use an API key when

you read every day or in volume, you need the stream or write actions, or you want the lowest price per call. Measured response times are on the latency benchmarks page.

/05

When a call is and isn't charged

  • Not charged: the payment completes only after the data request succeeds. A 400 for a missing or invalid parameter (for example more than 20 IDs), or a failed data request, costs nothing.
  • Charged: a successful call that returns no results, and a lookup where some IDs are deleted or not found (they are left out of the result).
  • One use per payment: sending the same signed payment again returns 402 with Payment already used.
/06

Where our x402 routes are listed

If your agent finds paid APIs through an x402 directory, these are the places our routes appear:

  • x402scan

    An explorer for x402 servers and payments. All 33 of our routes are registered there.

    twitterapi.io on x402scan
  • PayAPI Market

    A marketplace of paid API routes. Two of ours are listed and verified: user profile lookup and advanced search.

    User profile route on PayAPI Market
  • Coinbase x402 Bazaar

    The discovery catalog in Coinbase's x402 stack. Agents that query it can find our routes by our pay-to address; there is no per-merchant page to link to.

    How the Bazaar discovery works

The second PayAPI Market listing is advanced search on PayAPI Market.

Reading every day? Use a key.

An API key covers the same data at a lower price per call, plus the stream and write actions. Agents that speak MCP can use our hosted Twitter MCP server with that key.

Get your API key