Most data APIs want an account, a key and a monthly plan. An agent that needs one answer once does not want any of that. x402 turns the HTTP status code 402 ("Payment Required") into a payment step that a program can complete on its own.
The flow
- The client sends a normal request, for example
GET /v1/iban-validate?iban=…. - Without payment the server answers 402 with the price and the payment options in a header: network, asset (USDC) and the receiving address.
- The client signs a payment for exactly that amount and sends the request again with the payment attached.
- The server checks the payment, runs the call and returns the result. If the call fails, nothing is charged.
On Base and Polygon the client needs a little USDC and no gas token: the wallet signs an authorisation for the exact amount and a payment service submits it. Solana is also supported.
Try it without a wallet
Add free=1 and the call is free once per tool and IP address per day:
curl "https://api.ambolt.dev/v1/iban-validate?iban=DK5000400440116243&free=1"
Without it you get the 402 answer with the price, which shows the protocol without paying anything.
From code
The JavaScript and Python clients wrap every endpoint as a method and work with any x402-capable fetch.
import { createAmbolt } from '@ambolt/sdk';
const ambolt = createAmbolt({ fetch: payingFetch });
console.log(await ambolt.ibanValidate({ iban: 'DK5000400440116243' }));
Prices start at $0.003 a call. The full list is in the catalog, and every tool is also available as a free MCP tool at https://api.ambolt.dev/mcp.
Top comments (0)