Add x402 payments to your API
How to paywall an API route with x402 v2: USDC on Base and Solana, Coinbase CDP and PayAI facilitators, optional Stripe MPP, plus discovery files and a listing checklist. Free open-source kit, or a done-for-you setup.
If you run an API and want agents to pay per call — no accounts, no API keys — x402 is the HTTP 402 payment standard for that. The caller hits a paid route, gets 402 Payment Required with a price and a receive address, signs a USDC payment, retries, and gets the JSON. Failed calls are never settled.
This page is for API sellers. If you want to call our market-data routes as a buyer, see x402 pay-per-call market data.
Start with the free kit
The open-source x402 setup kit is a small Express app that already paywalls GET /hello with the same stack we run in production: USDC on Base, optional Solana, Coinbase CDP plus PayAI as a fallback, and optional Stripe MPP (Tempo USDC). It also serves /health, /openapi.json, /.well-known/x402 and /llms.txt for free so directories can find you.
git clone https://github.com/gdietsch/x402-setup-kit.git
cd x402-setup-kit
cp .env.example .env
npm install
npm start
# in another terminal
curl -i http://localhost:4021/hello
# HTTP/1.1 402 Payment Required
Set PAYTO_ADDRESS to a dedicated Base wallet you control before you take mainnet payments. On Base Sepolia (the default) you can confirm the 402 with the placeholder address. The kit README covers mainnet, Solana, Stripe MPP and Railway.
What to put on each paid route
- An
acceptsentry with theexactscheme, a price like$0.01, the network (eip155:8453for Base, plus Solana if you setSOLANA_PAY_TO), and yourpayToaddress. - Keep
/, health and discovery files unpaid. - Return 4xx/5xx when the request is invalid or the work failed — x402 does not settle those, so you are not paid for errors.
- On mainnet, use Coinbase CDP as the primary facilitator when you have CDP keys, and leave PayAI enabled as the fallback (and for Solana plus Bazaar cataloguing).
List the API so agents can find it
Once a public HTTPS URL returns a correct 402, work through the kit's listing checklist: keep OpenAPI and llms.txt current, submit the resource to x402scan and PayAI's Bazaar, and, if you also expose an MCP server, publish it to the official MCP Registry.
Want us to do it?
We offer a done-for-you x402 setup service:
- Kit Review, $149 — we review your 402s, facilitators and wallets and send a written punch list (about 2 business days).
- Full Setup, $750 to $1,500 — we add x402 to one existing API, help you deploy, and list you on the usual discovery surfaces (about 5 business days after we have access).
Questions: gdietsch-j16thn@mail.grokbot.com.
More guides
- ES futures session brief API
- SEC insider buying API
- AI trade brief API for agents
- Solana token safety check API
- Crypto whale flow API for Base and Solana tokens
- OFAC sanctions screening API for crypto addresses and names
- Wallet pay-readiness API for Base and Solana
- SEC 13F holdings API for fund portfolios and notable holders
- Token pre-trade check API for Solana and Base
- CFTC COT positioning screener API
- Treasury auction and yields API
- x402 pay-per-call market data
- How to check if a Solana token is a rug
- Mint authority and freeze authority on Solana
- LP lock and liquidity burn
- Holder concentration, snipers and bundles
- How to check a Base token for a honeypot