x402 paid API examples you can run today
x402 lets any HTTP API charge per call: the server answers 402 Payment Required with a price, the client pays in USDC and repeats the request. Here are working examples against our live endpoints, from $0.001 a call.
Add it to Claude or Cursor free (30 seconds) See a live answer first
How an x402 call works
There are no accounts, API keys or subscriptions in the basic flow. The payment travels in a header on the same request.
- Call the API. Send a normal request. With no payment attached the server answers
402 Payment Required. - Read the price. The
PAYMENT-REQUIREDheader says how much, in which token, on which networks and to which address. Nothing has been charged. - Sign a payment. Your client signs a USDC transfer authorisation from its wallet (it doesn't send a transaction itself).
- Repeat the call with the payment. The server verifies the payment, runs the request and settles it. You get the answer and a receipt header.
1. See the price with curl (free)
This returns the 402 and the price for a DNS lookup. Nothing is charged, so it's safe to run.
curl -i "https://aayatai.com/dns?name=example.com&type=MX"2. Pay per call from TypeScript
Install the open-source x402 client (npm install @x402/fetch @x402/evm viem). It sees the 402, pays from a wallet you control and repeats the call. Use a wallet made only for your agent, with a few dollars of USDC on Base.
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
// A wallet used only by your agent, holding a little USDC on Base.
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const res = await pay("https://aayatai.com/gas?chains=base%2Cethereum%2Csolana");
console.log(await res.json());3. Check an x402 endpoint before you pay it
Not every x402 API is up. Our x402 endpoint check ($0.002) tells you if an endpoint is answering 402, whether its payment request is valid, its price per network and its response time, without ever paying it.
curl -i "https://aayatai.com/x402/check?url=https%3A%2F%2Faayatai.com%2Fdns"4. No wallet? Use an API key or MCP
Top up prepaid credits once and send Authorization: Bearer <key>: each call deducts the same price, and failed calls are refunded to your balance.
In Claude, Cursor or any MCP app you don't need code at all: add the MCP server and get 20 free calls a day.
Live example
Live check of an x402 endpoint (never pays it)
Free, no sign-up: a real answer from our own health check for this input. Your own questions cost $0.002 a call, and the first 20 a day are free in Claude or Cursor.
https://aayatai.com/x402/check?url=https%3A%2F%2Faayatai.com%2Fdns Ask your AI assistant
Once it's added, just ask in plain words. For example:
Check whether https://aayatai.com/dns is a working x402 endpoint and what it charges.Get a free key and add it All tools and prices
Tools on this page
6 of these 6 are in the free trial (20 calls a day over MCP). Prices come straight from our live price list; failed calls are never charged.
| Tool | What it answers | Price per call |
|---|---|---|
| DNS | Look up DNS records for any domain: A, AAAA, CNAME, MX, NS, TXT, SOA, CAA, SRV, PTR, DS, DNSKEY, HTTPS, or ALL common types at once. | $0.001free to try |
| Gas fees now (cheapest chain) | Live network fees on Ethereum, Base, Arbitrum, Optimism, Polygon, BNB, Avalanche, Solana and Bitcoin: slow/standard/fast fee rates, congestion and trend, and the USD cost of a send, token transfer and swap on each, plus the cheapest chain now. | $0.002free to try |
| x402 check | Live health check of any x402 endpoint before you pay it: is it up and answering 402, is the payment request valid, prices in USD per network, pay-to wallets, x402 version, Bazaar discovery metadata, response time, and its buyers in the Bazaar. | $0.002free to try |
| Check a token: is it a scam? | Rug-pull and scam check for any token on Base, Solana, Ethereum, BNB, Arbitrum, Polygon, Optimism or Avalanche. | $0.02free to try |
| Markdown | Turn any document URL into clean Markdown for LLMs: web pages, PDFs, Word (.docx), Excel (.xlsx/.xls), OpenDocument, CSV, XML and plain text, up to 10 MB. | $0.005free to try |
| Quick web search | Cheapest search: Wikipedia articles, Hacker News stories, DuckDuckGo instant answers and Stack Overflow questions in one call, merged, de-duplicated and ranked, with titles, links, snippets and dates. | $0.002free to try |
Questions people ask
What is x402?
An open standard for paying per request over HTTP, using the long-reserved 402 status code. The server states a price, the client pays in a stablecoin such as USDC and repeats the request.
Which networks and tokens do you accept?
USDC, on the networks listed in our x402 manifest, at the same price on every network.
What if a call fails after I pay?
Payments are only settled after the request succeeds. Bad inputs are rejected before payment, and failed calls are never charged.
Is there a list of all your x402 endpoints?
Yes: llms.txt for AI agents, the OpenAPI file and the pricing page with every tool and price.
Related
- x402 service directory: paid APIs that work
- Base gas price right now (and the cheapest chain)
- How to check if a crypto token is a scam
More: every use case · developer docs · llms.txt