How payment works
The API uses x402 (HTTP 402 Payment Required) with the exact scheme. Settlement is USDC on Base ({network}). There is no account and no API key.
Sequence
- Call GET or POST on a paid path without a payment header.
- Read the 402 JSON body (and the PAYMENT-REQUIRED header). accepts[].amount is the price in atomic USDC units (6 decimals).
- Build a signed x402 payment payload for payTo {payTo}, asset {asset}.
- Retry the same request with header PAYMENT-SIGNATURE or X-PAYMENT.
Example 402 challenge
{
"x402Version": 2,
"error": "Payment required",
"resource": {
"url": "https://x402-gateway.forge-x402.workers.dev/api/iban",
"description": "IBAN validation (ISO 13616 mod-97 checksum + per-country length), returns normalised IBAN, country and BBAN.",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:8453",
"amount": "1000",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x7B8bf45ac6AcbA6D4CFB626b57D3f5fF3C9C89F7",
"maxTimeoutSeconds": 120,
"extra": {
"name": "USD Coin",
"version": "2"
}
}
]
}Pay with an x402 client
The easiest path is @x402/fetch (v2) with @x402/evm, which retries the 402 with a signed payment. See Try it in 1 call. Try it in 1 call.
MCP
The same tools are exposed at {mcp} (Streamable HTTP, stateless). Payment is passed in MCP _meta via @x402/mcp. list_endpoints is free. Failed tool calls are not settled.
Loyalty
A credit scheme (every 10 settled calls from one payer address = 1 free call) is planned only: the ledger is not fed from the gateway. See the loyalty note. Read the note.