⚡ x402 Quickstart

Pay for any AI agent API with USDC on Base. No signup. No KYC. No API keys. Just a wallet with USDC.

What is x402?

x402 is a payment protocol where APIs charge in USDC automatically. You send a normal HTTP request → the server responds 402 Payment Required with payment info → you pay and retry → you get the data. No accounts, no monthly billing, no token approval flow. Just HTTP + USDC.

Who this is for: AI agents that need to call paid APIs programmatically. If your agent can make HTTP requests and sign Ethereum transactions, it can use x402.

3-Step Flow (Copy-Paste Ready)

1 Send a request → Get 402

Make a normal GET/POST to any x402 endpoint. The server returns 402 Payment Required with a WWW-Authenticate header containing payment details.

curl -s -D - https://minia2a.uk/x402/recall \
  -H "Content-Type: application/json" \
  -d '{"query":"crypto prices"}'

The response headers will include:

HTTP/1.1 402 Payment Required
WWW-Authenticate: Payment realm="x402" version="1",
  network="base", address="0xf16F...94ECA",
  maxAmountRequired=5000, resource="b929311c"

2 Pay USDC on Base

Extract address, maxAmountRequired (in USDC units, 6 decimals), and network from the header. Send USDC to that address on Base.

# Using cast (foundry):
cast send 0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA \
  --value 0 \
  "transfer(address,uint256)" \
  0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA 5000 \
  --rpc-url https://mainnet.base.org \
  --private-key $YOUR_PRIVATE_KEY

# The payment tx hash is your receipt.
Note: 5000 = 0.005 USDC ($0.005). 6 decimal places. 1 USDC = 1,000,000 units.

3 Retry with Payment-Header → Get Data

Take your payment transaction hash and retry the original request with a Payment-Header. The server verifies the on-chain payment and returns the data.

curl -s https://minia2a.uk/x402/recall \
  -H "Content-Type: application/json" \
  -H "Payment-Header: tx=0xabc123..." \
  -d '{"query":"crypto prices"}'

Response (HTTP 200):

{
  "results": [...],
  "payment": {"tx":"0xabc123...","amount":"5000","status":"confirmed"}
}

Using the x402 SDK (JavaScript/TypeScript)

Official SDK handles the 402 → pay → retry flow automatically.

npm install @x402/fetch
import { x402fetch } from '@x402/fetch';

const response = await x402fetch('https://minia2a.uk/x402/recall', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ query: 'crypto prices' }),
  // SDK handles 402 → wallet sign → retry automatically
});
const data = await response.json();

Where to Find x402 APIs

DirectoryServicesSearch
Agentic.Market (Coinbase)25,000+Web UI
minia2a Sandbox25,000+Free, no wallet
PayAI23,000+Web UI
Voidly1,000+Web UI
MPPscan400+Web UI

Free Tools on minia2a

🔍 x402 Sandbox — Search 25K+ services, see prices, copy curl examples. No wallet needed.

x402 Validator — Check if any x402 endpoint is spec-compliant. Free.

📡 x402 Search API — Programmatic search. Returns JSON. Free tier available.

FAQ

What network does x402 use?

Currently Base (Ethereum L2). Payments in USDC. Gas costs ~$0.001 per tx.

Do I need KYC?

No. x402 is a protocol, not a platform. You only need a wallet with USDC on Base. No signup, no identity verification.

How much do x402 APIs cost?

Typically $0.001–$0.10 per call. The server sets the price in the 402 response header. You know the exact cost before paying.

What if the payment fails?

Your USDC stays in your wallet until you send the transaction. x402 uses pull payments — you initiate the transfer only after seeing the price.

Can I build my own x402 API?

Yes. Use the x402 Express middleware or check the x402 protocol docs. Test your endpoint with the free minia2a validator.

Try It Now

minia2a has 64 live x402 endpoints. Try one:

# Crypto intelligence — pay what you want
curl -s -D - https://minia2a.uk/x402/recall \
  -H "Content-Type: application/json" \
  -d '{"query":"ETH price"}'
# DEX price lookup
curl -s -D - https://minia2a.uk/x402/dex-price-live-v1 \
  -H "Content-Type: application/json" \
  -d '{"token":"ETH","network":"ethereum"}'
Real talk: x402 is early. Most endpoints have 0 reviews and low traffic. You're on the frontier. Build, experiment, and help grow the agent economy.