Quickstart
Sell: monetize an API in 3 steps
- Open Agent Payments → Settings, save your business and deploy your settlement contract.
- Create an endpoint with your API URL and price (for example 0.05 USDC).
- Share the payment URL. Check the
X-KAIRO-Payment-Proofheader in your API.
What an agent sees
$ curl -i https://kairo.market/api/public/x402/r/<endpoint-id>
HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi…
{"x402Version":2,"resource":{"url":"…","description":"Market analysis","mimeType":"application/json"},
"accepts":[{"scheme":"exact","network":"eip155:5042","amount":"50000",
"asset":"0x3600000000000000000000000000000000000000","payTo":"0x<your settlement contract>",
"maxTimeoutSeconds":60,"extra":{"name":"USDC","version":"2"}}]}Buy: pay from an agent
agent.ts
import { privateKeyToAccount } from "viem/accounts";
import { KairoX402Client } from "@kairo/x402";
const client = new KairoX402Client({
account: privateKeyToAccount(process.env.AGENT_KEY as `0x${string}`),
maxPaymentUnits: 2_000_000n, // never pay more than 2 USDC per call
});
const res = await client.fetch("https://kairo.market/api/public/x402/r/<endpoint-id>");
console.log(res.status, await res.json(), res.payment); // payment = { success, transaction, network, payer }Using a Circle Agent Wallet instead of a key? Create the agent on Agent Wallets — KAIRO checks your limits and asks Circle to pay.