x402 is a protocol and framework that enables cryptocurrency payments for HTTP API calls, using the HTTP 402 status code to negotiate payment before granting access to resources. It supports per-request micropayments across multiple blockchain networks, with batch settlement of off-chain vouchers into a single on-chain transaction to reduce costs. The protocol also includes wallet-based signature authentication, allowing access without a payment when only identity verification is required.
The framework distinguishes itself with a service discovery registry where paid endpoints are listed with metadata and pricing, enabling autonomous agents to find and select services programmatically. It offers flexible billing models per route—fixed price, usage-based, and aggregated batch settlement—and supports gas sponsorship so users can make payments without holding native tokens. A plugin-based payment lifecycle lets developers insert custom hooks for verification, settlement, error handling, and extensions such as marketplace listing, receipts, and gas sponsorship. The system also integrates with the Model Context Protocol, wrapping tools with payment requirements so clients can pay automatically.
Additional capabilities include HTTP middleware for accepting payments, client libraries that automate the payment handshake and retry logic, and facilitator services that offload transaction signing and on-chain settlement. The framework supports multiple EVM networks with runtime registration, handles repeat payment deduplication, and allows overriding payment amounts for usage-based settlement. Payment schemes are registered using a builder pattern, and services can be published to a searchable marketplace directory accessed via natural-language queries.