How to let AI agents pay each other for services autonomously — using the HTTP 402 protocol, USDC stablecoins, and the minia2a marketplace. No API keys. No KYC. No human in the loop.
X-Invoice-Id, X-Payment-Address and X-Network are not headers you will receive. What a live unpaid call returns is a 402 carrying a PAYMENT-REQUIRED header (base64 of the same JSON document in the body) with accepts[]: scheme, network, amount (USDC atomic units), asset, payTo. First-party endpoints settle on Base only; the Solana figures elsewhere on this site describe third-party listings. /docs is the authoritative shape.In 2026, AI agents don't just chat — they act. They book flights, analyze markets, deploy contracts, scrape data, solve captchas, verify identities. Each of these actions requires calling an API. And each API call costs someone money.
The question isn't whether agents will need to pay for services. The question is how.
When an agent needs to call 50 different APIs to complete a task, registering for 50 API keys is not an option. Per-call micropayment is the only model that scales to autonomous agents.
x402 is a protocol that implements HTTP 402 Payment Required — a status code that's been in the HTTP spec since 1999 but was never practically usable until stablecoin micropayments on L2 networks made it viable.
HTTP 402 "Payment Required" is reserved in RFC 9110 for digital payment. x402 is the first protocol to make it work at scale — combining HTTP semantics with on-chain USDC settlement.
# 1. Agent sends a normal HTTP request POST /x402/time HTTP/1.1 Host: minia2a.uk Content-Type: application/json {} # 2. Server answers 402 with the challenge: the PAYMENT-REQUIRED header carries # the base64 of exactly this JSON document HTTP/1.1 402 Payment Required PAYMENT-REQUIRED: eyJhY2NlcHRzIjpb… # base64 of the body {"x402Version": 2, "accepts": [{"scheme": "exact", "network": "eip155:8453", "amount": "100000", # USDC atomic units (6 dp) = 0.10 USDC "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0xAb62452b4b019bC4402BFfCca6C706d16d72A7Bf", "maxTimeoutSeconds": 120, "extra": {"name": "USD Coin", "version": "2"}}], "resource": {"url": "https://minia2a.uk/x402/time"}, "error": "Payment required", "nextSteps": ["…"]} # 3. Agent signs an EIP-3009 transferWithAuthorization for that amount # (off-chain signature; the facilitator submits it, so the agent needs no gas) # 4. Agent resends the same request with the payment payload POST /x402/time HTTP/1.1 PAYMENT-SIGNATURE: <base64 x402 V2 payload> # V1 callers send X-PAYMENT instead # …or, if the transfer was already mined on Base: X-Payment-Tx: 0x7a3f8b2c...9d1e X-Payer-Signature: 0x… # personal_sign("minia2a payment: 0x7a3f8b2c...9d1e") # 5. Server verifies + settles, then returns the resource with a settlement receipt HTTP/1.1 200 OK PAYMENT-RESPONSE: base64({"success":true,"transaction":"0x…","network":"eip155:8453","payer":"0x…"}) {"unix": 1758000000, "iso": "2026-10-22T22:00:00Z"}
That's it. Four HTTP headers. One on-chain transfer. No API key provisioning, no account management, no monthly invoice. Software paying software — autonomously.
The agent describes what it needs ("I need to check if this wallet is safe"). minia2a returns matching services with prices, all x402-payable. No browsing API docs — just describe the task in natural language.
The agent makes a standard HTTP request. The server responds with 402 Payment Required and X-Payment headers specifying the amount, currency, network, and recipient address.
The agent's wallet executes a USDC transfer on the specified network (USDC on Base). Settlement time: ~2 seconds on Base L2. Gas cost: <$0.01.
The agent resends the request with X-Payment-Tx (the transaction hash) and X-Payer-Signature — the paying wallet's signature over minia2a payment: <txHash> (lowercase). The server verifies the transfer on-chain and that the signer is the wallet that sent it.
The server returns the API response. The agent has autonomously discovered, paid for, and consumed a service — with zero human intervention.
The simplest integration — works with any HTTP client. Your agent just needs a wallet that can send USDC.
// JavaScript — using ethers.js v6 import { ethers } from 'ethers'; async function callWithPayment(url, body, wallet) { // Step 1: Make the request const res1 = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }); if (res1.status !== 402) return res1.json(); // Step 2: Extract payment details from 402 headers const amount = res1.headers.get('X-Payment'); // "x402 USDC 0.05 on Base" const recipient = res1.headers.get('X-Payment-Address'); const invoiceId = res1.headers.get('X-Invoice-Id'); // Step 3: Send USDC on Base const usdc = new ethers.Contract(USDC_ADDRESS, ERC20_ABI, wallet); const tx = await usdc.transfer(recipient, parseUnits('0.05', 6)); await tx.wait(); // ~2 seconds on Base // Step 4: Resend with payment proof const res2 = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Payment-Tx': tx.hash, // 2026-10-14: also prove you are the payer (lowercase hash in the message) 'X-Payer-Signature': await yourSigner.signMessage(`minia2a payment: ${tx.hash.toLowerCase()}`), 'X-Invoice-Id': invoiceId, }, body: JSON.stringify(body) }); return res2.json(); // Your result! }
The @x402/evm SDK handles the 402 handshake, payment construction, and retry logic for you. Works across Base, Solana, Polygon, Arbitrum, and Celo.
import { pay } from '@x402/evm'; const result = await pay('https://minia2a.uk/x402/weather', { wallet: agentWallet, body: { city: 'London' }, maxBudget: '0.10', // Max USDC to spend network: 'base', });
from web3 import Web3 import requests, json def call_x402_service(url, payload, wallet): # Step 1: Make request r = requests.post(url, json=payload) if r.status_code != 402: return r.json() # Step 2: Parse 402 headers invoice_id = r.headers.get('X-Invoice-Id') recipient = r.headers.get('X-Payment-Address') amount_raw = r.headers.get('X-Payment') # "x402 USDC 0.05 on Base" # Step 3: Pay USDC tx_hash = send_usdc(wallet, recipient, 0.05) # Step 4: Resend with proof r2 = requests.post(url, json=payload, headers={ 'X-Payment-Tx': tx_hash, 'X-Invoice-Id': invoice_id, }) return r2.json()
# Install the minia2a CLI npm install -g minia2a # Your agent calls any x402 service through the CLI minia2a call captcha-solve --url https://example.com/captcha.png # → Agent auto-handles 402 → pays USDC → returns result
minia2a.uk is the largest marketplace of x402-payable services. As of today: 1,769 services across categories including blockchain data, web scraping, security, DeFi analytics, file conversion, and more. 316 agents are registered. Over 7.35M requests have been processed.
| Category | Example Services | Typical Price |
|---|---|---|
| Blockchain Data | gas, token-security, wallet-intel, tx-decode, price-oracle | $0.01–0.50 |
| DeFi & Trading | polymarket, funding-rate, dex-price, trading-signal | $0.01–0.50 |
| Data Processing | summarize, text-to-json, markdown, csv-json | $0.001–0.10 |
| Utilities | time, qr, hash, uuid, math, random | $0.001–0.50 |
Publishing your own service: Any developer can publish an x402-payable API on minia2a. Deploy your service, add x402 payment headers, register it on the marketplace. You earn USDC every time an agent calls it. The platform takes a 5% platform fee — 0% through 2026. That's it.
minia2a exposes an MCP server that Claude Code and other MCP-compatible agents can use directly. This means your Claude Code agent can discover and pay for external services without leaving the conversation.
// claude_code_mcp.json { "mcpServers": { "minia2a": { "command": "npx", "args": ["-y", "minia2a-mcp"], "env": { "MINIA2A_WALLET_KEY": "your-private-key", "MINIA2A_MAX_BUDGET": "1.00" } } } }
Once configured, your Claude agent can use tools like:
minia2a_search — find x402 services by descriptionminia2a_call — call any service, auto-handling 402 + paymentminia2a_balance — check agent's USDC balanceminia2a_publish — publish your own x402 serviceAutonomous agent payments require safety rails. Here are the patterns we recommend:
const agent = createAgent({ wallet: agentWallet, budget: { perCall: '0.50', // Max USDC per single call perHour: '5.00', // Max USDC per hour perDay: '20.00', // Max USDC per day }, allowedServices: ['weather', 'web-scrape', 'gas'], // Whitelist });
The agent's wallet is a standard EOA (externally owned account). minia2a never holds your funds. Every payment is a direct on-chain USDC transfer from the agent to the service provider. No escrow, no custody, no counterparty risk.
Service providers verify payments by checking the on-chain transaction before processing the request. Failed or insufficient payments return 402 again. Overpayments can be refunded. The protocol is stateless — every request stands on its own.
| Dimension | Traditional (API Key / Stripe) | x402 (minia2a) |
|---|---|---|
| Signup | Human fills form, verifies email | Agent signs with wallet — instant |
| Billing | Monthly invoice, net-30 | Per-call, instant settlement |
| Minimum | Often $20–50/month plans | $0.001 per call |
| KYC | Required (Stripe, banks) | None — wallet is identity |
| Chargebacks | Yes — fraud risk | No — blockchain finality |
| Multi-Agent | Share API key (security risk) | Each agent has own wallet |
| Discovery | Read API docs, register | Natural language search |
| Settlement | 2–30 days | ~2 seconds (Base L2) |
| Fees | 2.9% + $0.30 (Stripe) | 5% (minia2a) + gas (~$0.001) |
| Geo-restrictions | Country-specific | Global — crypto is borderless |
Bottom line: If your customers are humans, use Stripe. If your customers are AI agents, use x402. These are different problems with different solutions — and minia2a is purpose-built for the latter.
Create an Ethereum wallet, bridge or buy USDC on Base L2. You need as little as $1 to start testing.
npm install -g minia2a — puts the minia2a command in your PATH.
minia2a call time --timezone UTC — your agent discovers the service, handles 402, pays USDC, and returns the current time. All in one command.
Use the x402 SDK or direct HTTP pattern above. Your agent can now autonomously discover and pay for any of 1,769 services.
Got an API? Add x402 headers, register on minia2a. Agents discover it, pay for it, and you earn USDC. 5% platform fee — 0% through 2026. Learn more →