402 Payment Required status code and allows clients to programmatically pay for resources without accounts, sessions, or credential management.
With x402, any web service can require payment before serving a response, using crypto-native payments for speed, privacy, and efficiency.
Want to contribute to our docs? The GitBook repo is open to PRs! Our only ask is that you keep these docs as a neutral resource, with no branded content other than linking out to other resources where appropriate.
Note about the docs: These docs are the credibly neutral source of truth for x402, as x402 is a completely open standard under the Apache-2.0 license. Coinbase Developer Platform is currently sponsoring AI-powered docs for users here, as we migrate to our own AI-powered solution on the main x402.org domain.
Why Use x402?
x402 addresses key limitations of existing payment systems:- High fees and friction with traditional credit cards and fiat payment processors
- Incompatibility with machine-to-machine payments, such as AI agents
- Lack of support for micropayments, making it difficult to monetize usage-based services
Who is x402 for?
- Sellers: Service providers who want to monetize their APIs or content. x402 enables direct, programmatic payments from clients with minimal setup.
- Buyers: Human developers and AI agents seeking to access paid services without accounts or manual payment flows.
What Can You Build?
x402 enables a range of use cases, including:- API services paid per request
- AI agents that autonomously pay for API access
- Paywalls for digital content
- Microservices and tooling monetized via microtransactions
- Proxy services that aggregate and resell API capabilities
How Does It Work?
At a high level, the flow is simple:- A buyer requests a resource from a server.
- If payment is required, the server responds with
402 Payment Required, including payment instructions. - The buyer prepares and submits a payment payload.
- The server verifies and settles the payment using an x402 facilitator’s /verify and /settle endpoints.
- If payment is valid, the server provides the requested resource.