What is x402?
x402 is a payment pattern for HTTP APIs. A client requests a paid resource, the server responds with HTTP 402 Payment Required and a structured challenge, the client pays according to that challenge, and then replays the request with a payment proof.
For AI agents, this makes paid API access more programmable. The agent does not need a subscription checkout flow; it can discover the price of one call and decide whether the answer is worth buying.
How an x402 request works
The first request looks like any normal HTTP call. If payment is missing, the response tells the client the accepted network, asset, amount, payTo address, and timeout. The client settles through a compatible payer and sends the proof back in the X-PAYMENT header.
A successful replay returns the API payload plus metadata showing that payment settled.
- Request paid endpoint.
- Receive HTTP 402 challenge.
- Settle the quoted amount.
- Replay with X-PAYMENT.
- Receive paid data and payment_status='settled'.
Why x402 fits agents
Agents often need one answer from many providers. Subscriptions and dashboards assume a human buyer. x402 lets the HTTP layer carry payment instructions so the agent can make budget-aware calls.
This works especially well for intelligence APIs where cheap discovery calls can route to occasional paid deep dives.
How Orrery uses x402
Orrery uses x402 for paid prediction-market intelligence endpoints. Health, manifest, catalog, and documentation routes are free. Paid endpoints such as attention queues, market deep dives, and resolution-risk checks challenge missing payment and return structured Decision Cards after settlement.
The result is a clean agent loop: discover, rank, pay for depth, cite sources, and stop before trade advice.
FAQ
Is x402 an API key?
No. It is a payment flow. The request carries payment proof instead of a long-lived Orrery account key.
Why does x402 use HTTP 402?
HTTP 402 means Payment Required. x402 makes that response machine-readable so software can settle and replay.
What does X-PAYMENT contain?
It contains the payment proof expected by the server's x402 verifier. Orrery validates it before returning paid data.