The x0 protocol implements the HTTP 402 Payment Required status code for machine-to-machine payment negotiation. This enables autonomous agents to discover, negotiate, pay for, and consume services without human intervention.Documentation Index
Fetch the complete documentation index at: https://docs.x0protocol.dev/llms.txt
Use this file to discover all available pages before exploring further.
Protocol Flow
Payment Request (402 Response)
When a service requires payment, it returns HTTP 402 with anX-PAYMENT header:
| Field | Type | Description |
|---|---|---|
version | string | Protocol version ("2.0") |
protocol | string | Protocol identifier ("x0-01") |
network | string | Solana network identifier |
recipient | string | Service’s receiving wallet (base58) |
amount | number | Payment amount in micro-units |
token | string | Token mint address |
resource | string | API resource path being purchased |
nonce | string | Unique challenge to prevent replay |
expires | number | Unix timestamp when the request expires |
Payment Proof (Subsequent Request)
After submitting the payment transaction on-chain, the agent includes proof in its next request:- Transaction exists on-chain and is confirmed
- Transfer amount matches requested amount
- Recipient matches service wallet
- Challenge hash in memo matches the nonce
Challenge Hash
To bind the payment to the specific request, a challenge hash is computed: This hash is included in the transaction memo, allowing the service to verify the payment was made for this specific request.SDK Helpers
Security Properties
- Replay protection — Each request has a unique nonce; the challenge hash binds payment to the specific request
- Expiration — Payment requests expire, preventing agents from paying stale invoices
- Amount verification — The on-chain transfer amount is verified against the requested amount
- Policy enforcement — The agent’s x0-guard policy still applies to 402 payments, enforcing spend limits