What is x402?

What Is x402?
A simple guide to the protocol that lets software pay for APIs, data, and services directly over HTTP.
For decades, online payments have been built around humans. You create an account, enter a credit card, subscribe to a service, or configure an API key.
That works for people.
It doesn't work well for AI agents.
As agents become capable of performing tasks autonomously, they increasingly need access to paid resources—APIs, datasets, compute, and premium content. x402 was created to make those payments native to HTTP.
The Missing HTTP Status Code
HTTP has long included a reserved status code:
402 Payment Required
For nearly 30 years, it had no standard implementation.
x402 gives meaning to that status code.
When a client requests a paid resource, the server responds with a 402 Payment Required message containing machine-readable payment instructions. The client pays and retries the request automatically.
- No accounts
- No API keys
- No checkout flow
How x402 Works
An x402 transaction typically follows four steps:
- A client requests a protected resource.
- The server responds with
402 Payment Requiredand payment details. - The client signs a payment authorization and resends the request.
- A facilitator verifies and settles the payment, and the server returns the resource.

Key Components
Wallet-Based Payments
Instead of accounts and API keys, x402 uses blockchain wallets as both identity and payment method.
Stablecoins
Most implementations use USDC, enabling predictable pricing and practical micropayments.
Facilitators
Facilitators verify payment proofs and handle on-chain settlement, removing blockchain complexity from both buyers and sellers.
Why It Matters
AI agents can already search, analyze, and make decisions.
What they lack is a standardized way to pay.
x402 allows software to discover a service, pay for access, and consume the result using the same protocol it already uses to communicate: HTTP.
Common Use Cases
- Paid APIs
- Data feeds
- AI inference services
- Premium content
- Agent-to-agent commerce
Conclusion
x402 turns payment into a native part of HTTP.
Instead of managing accounts, subscriptions, and API keys, software can simply request a resource, receive payment instructions, pay, and continue.
As AI agents become more autonomous, protocols like x402 could become a foundational layer of machine-to-machine commerce.