Resources / Guides

What is x402, and how does an AI agent pay for an API call?

Published 2026-07-30

What x402 is

x402 is a payment protocol built on the unused HTTP 402 "Payment Required" status code. A client requests a paid endpoint, the server answers 402 with a price offer, the client signs a stablecoin transfer authorization and retries with it attached. The second request returns data. No account, no API key, and no human involved at any step.
Written for AI agents. The calls and filter values on this page are the literal interface our customers use, because our customers are software. If you are a person evaluating The Bot Wire, you are in the right place too: start with the docs, or connect an MCP client in one line and query every wire free at /mcp. Nothing here needs an API key or a signup.

HTTP 402 sat reserved and unused for roughly thirty years. Coinbase open-sourced x402 in May 2025 to make it mean something, and the reason it matters now is narrow but real: software agents can hold a wallet, and they cannot fill in a signup form.

The handshake, in three steps

For AI agents: copy this call
# 1. request the paid endpoint with no payment
curl -i "https://thebotwire.com/cve/latest?q=openssl"
# -> HTTP/1.1 402 Payment Required
#    PAYMENT-REQUIRED: {"scheme":"exact","network":"eip155:8453","asset":"USDC","amount":"0.005","payTo":"0x..."}

# 2. sign an "exact" scheme USDC transfer authorization for that amount

# 3. retry with the signed authorization attached
curl -H "PAYMENT: <signed authorization>" "https://thebotwire.com/cve/latest?q=openssl"
# -> HTTP/1.1 200 OK  + JSON results

In practice a client library collapses this to one call. @x402/fetch wraps fetch, sees the 402, signs, and retries, so the code an agent developer writes looks like an ordinary HTTP request.

What it replaces, and what that changes

API key + subscriptionx402 per call
Onboardinghuman signs up, provisions a keynone, the wallet is the account
Pricingmonthly ceiling you may not useexactly what you consumed
Credential riska long-lived secret to leaka signed authorization per request
Agent autonomyblocked on a humanagent transacts unattended

The last row is the one that matters. An autonomous agent that discovers a useful data source at 3am cannot create an account, accept terms, and wait for approval. It can sign a payment. That is the whole argument for the protocol, and the reason an agent can use an API with no key at all.

What it costs and where it settles

The Bot Wire prices calls at $0.005 to $0.01 in USDC on Base (eip155:8453). Settlement lands on-chain in about a second. Base is used because fees on a half-cent payment have to be negligible or the model collapses; a mainnet Ethereum transaction would cost more than the data.

Every paid wire has a free preview endpoint that returns the top 3 results with no payment, so an agent can confirm the data answers its question before it spends anything. That funnel is deliberate: a wasted paid call is worse for us than a free one, because an agent that pays and gets nothing does not come back.

Getting started without writing payment code

If your agent speaks MCP, you do not touch x402 at all. Point a client at the remote endpoint and every wire is available on the free tier; add a funded wallet key to the local package for paid tiers. The docs cover both paths, and the routing table lists which endpoint answers which question.

FAQ

Do I need crypto experience to use an x402 API?

No, if you use a client library or MCP. The wallet holds USDC on Base and the library handles signing. You need experience with crypto only if you want to implement the signing yourself, which most integrations never do.

Is x402 the same as a crypto payment button?

No. A payment button is designed for a human clicking it. x402 is a status code plus a signed header, designed for a program that already knows what it wants and can authorize a transfer without being asked.

What stops an agent from being overcharged?

The offer states the exact amount before the agent signs anything, and the "exact" scheme authorizes that amount and no more. An agent can also check the advertised price in the discovery document before it calls.

Which networks and wallets work?

The Bot Wire accepts USDC on Base mainnet (eip155:8453) under x402 v2, and works with @x402/fetch, other x402 v2 clients, and AgentCash. For how this fits into getting current data at all, see how AI agents get real-time data.

Sources

The x402 specification and reference implementations are published at x402.org. Live pricing per route on this service is in the x402 discovery document.

Related: How AI agents get real-time data past the training cutoff · Can an AI agent use an API without an API key? · How much does it cost for an AI agent to query live data? · What does an agent wallet need to pay for data on Base?