x402
Type: full-code · Vendor: Coinbase · Language: TypeScript · License: Apache-2.0 · Status: active · Status in practice: emerging · First released: 2025-05-06
x402 is an open payment protocol that revives the HTTP 402 status code so an agent can pay per request over HTTP without accounts or manual payment flows.
Description. x402 is an open payment protocol from Coinbase that uses the HTTP 402 Payment Required status code to settle stablecoin payments directly over HTTP. When a resource requires payment, the server returns 402 with payment instructions, and the buyer retries the request carrying a signed payment. It targets both human developers and AI agents that need to access paid services without accounts or manual payment flows. The protocol is an open standard not tied to a single provider, and supports stablecoin payments such as USDC across several chains.
Agent loop shape. An agent (or any HTTP client) requests a paid resource and receives a 402 Payment Required response carrying payment instructions in a header. The agent constructs and sends a signed payment payload, then retries the request; once the payment is verified, the server returns the resource. This lets the agent settle a payment mid-request and continue, with no per-transaction human checkout.
Primary use cases
- agent payments per HTTP request
- monetizing APIs and digital content with pay-as-you-go billing
- autonomous service access without accounts or manual checkout
- stablecoin micropayments over HTTP
Key concepts
- HTTP 402 Payment Required → agent-initiated-payment (docs) — The long-dormant HTTP status code x402 revives: a server answers a request for a paid resource with 402 plus machine-readable payment instructions, turning payment into a step of the normal request/retry cycle.
- Facilitator (docs) — An x402 service that verifies and settles a buyer's payment on chain so the seller does not have to run its own blockchain infrastructure to accept payments.
- Payment payload → agent-initiated-payment (docs) — The signed proof the buyer attaches when retrying the request (carried in a payment header), built from token authorizations such as EIP-3009 or Permit2, that the server or facilitator verifies before releasing the resource.
Patterns this full-code implements —
- ★Agent-Initiated Payment
When a resource needs payment, the server returns 402 with payment instructions and the buyer responds by sending a signed payment payload and retrying, so the agent settles a payment mid-request to…
- ·Session-Scoped Payment Authorization
x402 lets an agent pay programmatically per HTTP request over the 402 Payment Required flow, so an agent can stream many autonomous micropayments for service access without per-transaction human appr…
Neighbourhood
Click any neighbour to follow the lineage. Scroll to zoom, drag to pan.