What is the x402 protocol?
x402 is an HTTP protocol for per-request payments in stablecoins. A server returns 402 Payment Required with payment details in response headers. The client (often an AI agent) signs a USDC micropayment and retries the request with an X-Payment header. The server verifies the payment and returns the data. MoltPe implements x402 natively for both API monetization and agent consumption of paid APIs.
The short version
- Request. Client calls a paid endpoint with no payment.
- Quote. Server responds
402 Payment Requiredwith price, asset (USDC), chain, and payable-to address in headers. - Pay. Client signs a USDC transfer matching the quote and retries with an
X-Paymentheader containing the signed payload. - Deliver. Server verifies the payment on-chain or via a facilitator, then returns
200 OKwith the data.
In more detail
HTTP 402 was reserved in the original HTTP/1.1 specification for “Payment Required” but sat unused for decades because there was no settlement rail fast or cheap enough to power it. Stablecoins changed that. USDC on Layer 2 networks like Base and Polygon PoS settles in under a second at fractions of a cent, which finally makes per-request payment economically viable. x402 is the open protocol that revives HTTP 402 for this purpose.
For API providers, x402 means you can charge per call with no sign-up, no API keys, and no invoicing — the payment IS the auth. A weather API, a vector database query, or an LLM inference can each be a standalone priced request. For AI agents, x402 means your agent can discover and consume paid APIs at runtime without a human provisioning credentials in advance; the agent’s spending policy decides what gets paid for.
MoltPe runs an x402 facilitator that handles signature verification, replay protection, and on-chain settlement so API developers only need to check one header. The same infrastructure lets MoltPe-hosted agents consume x402 endpoints from anywhere on the web.
Related questions
- Blog: x402 protocol complete guide
- Blog: x402 for Indian developers
- Blog: AI agent payments India guide
- AI agent payments in India: pillar page
- Glossary of payment terms
About MoltPe
MoltPe is AI-native payment infrastructure that gives AI agents isolated wallets with programmable spending policies for autonomous USDC stablecoin transactions. Live on Polygon PoS, Base, and Tempo.