What is x402?
HTTP 402 Payment Required status code. Instead of a signup and an API key, a server answers an unpaid request with 402 plus machine-readable payment requirements; the client signs a stablecoin transfer (USDC on Base) and retries with an X-PAYMENT header. It lets autonomous agents pay for an API call by call with no account, no credentials, and no human in the loop.The problem it solves
Most APIs gate access behind a human-completed signup: create an account, add a card, copy an API key, store it as a secret. That flow assumes a person. An autonomous agent that discovers a useful service at runtime can't fill in a billing form — and you don't want to provision and rotate API keys for every service an agent might touch. x402 removes the account entirely: the unit of trust is a signed on-chain payment, not a stored credential.
The handshake, step by step
x402 is a two-round-trip pattern on top of ordinary HTTP. Nothing proprietary on the wire — just a status code, a header, and a stablecoin transfer.
# 1. The agent calls the endpoint with no payment GET /ledger/accounts # 2. The server answers 402 with machine-readable requirements HTTP/1.1 402 Payment Required {"x402Version":1,"accepts":[{ "scheme":"exact","network":"base", "maxAmountRequired":"2000", "asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo":"0xBEccE6dd106Cfa910F78fea188B2fcCEb73bdD0F"}]} # 3. The agent signs a USDC transfer for that amount and retries GET /ledger/accounts X-PAYMENT: <base64 signed USDC payment payload> # 4. The server verifies + settles via the facilitator, then serves the response HTTP/1.1 200 OK [{"id":1,"name":"Operating","type":"asset","balance":5000}]
The amounts are in USDC's smallest unit (6 decimals), so 2000 = $0.002 and 10000 = $0.01. Settlement runs through an x402 facilitator that verifies the signature and submits the transfer; the API never custodies funds.
Why it fits AI agents specifically
- No onboarding. An agent can discover a service and start paying in one extra round trip — no human, no form.
- No credential to leak or rotate. There is no long-lived API key sitting in the agent's environment.
- Metered to the request. You pay $0.002 for a read, not a $20/mo seat you mostly don't use.
- Discoverable. Services publish a
/.well-known/x402endpoint, so agents (and indexes like x402scan) can find and price them programmatically.
x402 on Ledger
Ledger is a double-entry accounting API that is fully x402-native. Any paid endpoint returns a 402 challenge when called without payment; its discovery document lists every priced resource:
curl https://ledger-api.novadyne.ai/.well-known/x402 # -> {"version":1,"resources":["https://ledger-api.novadyne.ai/ledger/accounts", ...]}
New to the accounting side too? Read double-entry accounting for AI agents, or jump to the 5-call quickstart.
FAQ
Is x402 a blockchain or a token?
Neither. x402 is an HTTP-level payment protocol — a convention for using the 402 status code plus a payment header. It settles in an existing stablecoin (USDC) on an existing chain (Base). There is no x402 token.
Do I need a wallet to use an x402 API?
The paying client needs a funded wallet to sign the USDC transfer. On Ledger you can skip x402 entirely by holding a capability token instead — see capability tokens vs x402.
What does a request cost on Ledger?
$0.002 per read (GET) and $0.01 per write (POST/PATCH), paid in USDC on Base. There is no signup, minimum, or subscription.
How is this different from an API key?
An API key is a stored long-lived credential tied to an account you created. x402 has no account and no stored secret — each request carries its own signed, single-use payment.
Ledger speaks x402 natively. Hit any paid endpoint without payment to see a real 402 challenge.
View the live API →Written and verified by Novadyne, June 2026. Ledger is a production double-entry accounting API at ledger-api.novadyne.ai. Examples are illustrative; the live /.well-known/x402 discovery endpoint is the source of truth for current payment requirements.