How x402 works: pay for web data per call
What is the x402 path?
FastAF has two ways to pay. One is an account: you sign up, verify your email (500 free credits every month, not valid on x402) and use an API key with REST or the MCP server. The other is x402, and it needs no account at all. Your agent calls GET https://api.fastaf.co/x402/v1/<name>, receives HTTP 402 Payment Required with a machine-readable price, signs a USDC authorization on Base and retries the same request with the payment attached. The data comes back in the same response as the settlement receipt.
This page covers the x402 path only. The MCP server at https://api.fastaf.co/mcp (23 tools) is not paid with x402: it uses an API key or OAuth.
Which routes can you pay for?
The x402 catalog at https://api.fastaf.co/.well-known/x402 lists 24 resources under /x402/v1/:
- Google verticals:
serp,search(an alias of serp),news,shopping,scholar,jobs,images,ai(Google AI answers),maps,patents,flights - Other search:
bing - Commerce:
amazon,walmart,ebay - Real estate:
zillow - People and jobs:
linkedin(public profiles),linkedin_jobs,x(public X profiles) - Media and community:
youtube,reddit - Generic:
scrape(any public page),screenshot,extract(JSON Schema in, validated JSON out; POST)
Every route takes query parameters, except extract, which takes a POST with a JSON body (a page URL and a JSON Schema). Parameter names, allowed values and the response schema of each route are in the OpenAPI spec at https://api.fastaf.co/openapi.json. Per-route prices are on the x402 price list, generated from the API's pricing code.
What does the 402 challenge contain?
A request without payment is cheap to make and safe to inspect:
curl -i "https://api.fastaf.co/x402/v1/serp?query=coffee"It returns HTTP 402 with a PAYMENT-REQUIRED header (base64-encoded JSON, x402 v2) and the same v2 requirements in the JSON body. The accepts entry for serp contains:
scheme:exact, so the client pays exactly the quoted amountnetwork: Base mainnet (eip155:8453in v2 terms)asset: the USDC contract on Base,0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913amount:3000; USDC has 6 decimals, so this is $0.003payTo: FastAF's receiving addressmaxTimeoutSeconds:300- a
resourcewith the URL,description,mimeType(application/json) and the docs page of what you are buying
Because the price is in the challenge, an agent can compare it with its own budget before signing anything. If the quote is higher than expected, the agent simply does not pay. A bare curl never pays: it only reads the quote.
How does a paid call work, step by step?
- Build the request. Pick the route and its query parameters from the OpenAPI spec, for example
serp?query=best+espresso+machine&country=us. - Read the challenge. Send the request without payment and parse the 402. Check
amount,assetandnetwork. - Sign. Use an x402-aware client to sign the USDC authorization for the exact amount.
- Retry with payment. Send the same request with the payment signature. FastAF verifies it, runs the request and settles.
- Use the data. You get the JSON result plus a payment response header with the settlement details.
Do you pay for failed calls?
No. Settlement happens only when the request succeeds. If the upstream source times out, blocks the fetch or returns no data, the call fails and the authorization is not settled. For agents that retry, a failed attempt costs no money, so a retry policy does not double-charge you for errors.
Options that would cost more than the fixed price of a route (for example SERP advance_search) are not sold over x402. A paid request with them is refused with options_need_api_key before anything is charged, and an unpaid one gets the 402 with invalid_parameters saying so: use API-key billing for those options.
Can you try it on testnet first?
Try FastAF free on testnet. Point your agent at GET https://api.fastaf.co/x402/v1/demo/search?query=... on Base Sepolia. It costs $0.001 in test USDC from the Circle faucet, returns up to 3 real results, and allows 5 verified attempts per IP per UTC day (failed ones count too). When it works, switch to /x402/v1/serp on Base mainnet ($0.003 per successful call). Copy-paste example: fastaf-mcp/examples/agentkit-x402.
$0.003 per Google search is the lowest price of any FastAF x402 route (the floor is $0.003).
When should you use x402, and when an API key?
Use x402 when:
- the agent has its own wallet and a spending cap, and should not hold a long-lived API key;
- usage is occasional or unpredictable and you do not want to pre-buy credits;
- you want each call priced and settled on its own, with a receipt per request.
Use an API key (REST or MCP) when:
- you work from Claude Code, Codex or Cursor through MCP, which never spends x402 payments (set it up in a minute);
- you need options that cost more than the fixed x402 price;
- you prefer one prepaid balance shared by all endpoints (credit packs).
How do agents discover the paid routes?
https://api.fastaf.co/.well-known/x402: the catalog with all 24 resources, descriptions and priceshttps://api.fastaf.co/openapi.json: parameters and response schemas, with the price in each route description- the 402 challenge itself, which carries a description and a docs URL for each route
Read the protocol setup documentation and endpoint prices and payment examples. Selling your own paid route? Run the x402 endpoint discovery checklist to see how agents find and price it.
FAQ
Do I need an account or API key to pay with x402?
No. Call https://api.fastaf.co/x402/v1/<name> directly: the 402 challenge contains everything an x402 client needs to pay.
Which currency and network does FastAF accept?
USDC on Base mainnet (eip155:8453). The testnet demo route runs on Base Sepolia with test USDC.
Am I charged if a request fails?
No. Only successful (200) responses settle.
Can I pay for MCP tool calls with x402?
No. MCP tool calls use an API key or OAuth.
Where do I check the current price?
In the 402 challenge of the route, in the x402 catalog at https://api.fastaf.co/.well-known/x402, or on the x402 price list.
Is search a different product from serp?
/x402/v1/search is an alias of serp, with the same parameters and the same price.
Start at fastaf.co.