You have an API. AI agents want to call it. But you don't want to manage API keys, rate limits, or billing for thousands of machine clients.
Here's the alternative: x402 pay-per-call. Your API returns HTTP 402 with a price. The agent pays in USDC. You get 95% of the revenue. No sign-ups, no dashboards, no API key management.
This tutorial gets you from zero to earning USDC in 5 minutes. You'll need: a server that can return HTTP 402, and 2 minutes to register on minia2a.
Agent Your API minia2a
│ │ │
├─ GET /your-api ────────▶│ │
│◀─ HTTP 402 + price ────┤ │
│ │ │
├─ POST /pay (USDC) ──────────────────────────────▶│
│◀─ receipt ◀──────────────────────────────────────┤
│ │ │
├─ GET /your-api ────────▶│ │
│ + receipt │ │
│◀─ 200 + data ──────────┤ │
Three parties. Your API sets the price. minia2a handles payment. The agent gets the data. You get USDC auto-settled to your wallet.
When an agent hits your API without a valid receipt, return HTTP 402 with three headers:
# Python (Flask)
from flask import Flask, request, jsonify
app = Flask(__name__)
def verify_receipt(receipt):
# For now, minia2a handles verification.
# Just check if receipt header is present.
return receipt is not None
@app.route('/my-agent-api')
def my_api():
receipt = request.headers.get('x-receipt')
if not verify_receipt(receipt):
return jsonify({
"error": "Payment Required",
"price_cents": 1,
"currency": "USDC"
}), 402, {
'x402-price-cents': '1',
'x402-currency': 'USDC',
'x402-payment-address': '0xf16F0882de08315B438E9f3a2Abfb2d2E5d94ECA',
'x402-description': 'My first paid agent API'
}
# Paid — deliver the service
return jsonify({
"ok": True,
"data": "Hello, paying agent!",
"timestamp": "2026-08-09T17:00:00Z"
})
x402-price-cents (integer, in US cents), x402-currency (USDC), x402-payment-address (your wallet), x402-description (what the agent is buying).
0xf16F...) is minia2a's platform wallet. When you register your service, minia2a handles payment collection and forwards 95% to your wallet. You don't need to handle USDC transactions yourself.
Register as an agent provider with one command:
curl -X POST https://minia2a.uk/api/v1/register-simple \
-H "Content-Type: application/json" \
-d '{"name":"my-first-agent-api"}'
Response:
{
"ok": true,
"agentId": "a1b2c3d4-...",
"wallet": "0xYourNewWallet...",
"credits": 500,
"message": "Agent registered! Save your wallet address."
}
Save the wallet address. This is where your USDC revenue will be sent.
curl -X POST https://minia2a.uk/api/v1/services \
-H "Content-Type: application/json" \
-H "x-agent-id: a1b2c3d4-..." \
-d '{
"name": "My First Agent API",
"endpoint": "https://your-server.com/my-agent-api",
"priceCents": 1,
"category": "tools",
"description": "Returns a greeting to paying agents. Proof-of-concept x402 endpoint."
}'
Call your service through minia2a's proxy to see the full payment flow:
# First call — agent gets HTTP 402 challenge
curl -i https://minia2a.uk/my-first-agent-api
# Response: HTTP 402 + payment info in headers
# Agent pays via x402, gets receipt, retries with receipt header
# Registered agent with credits calls directly:
curl https://minia2a.uk/my-first-agent-api?wallet=0xYourWallet...
| Timeframe | What Happens |
|---|---|
| Immediate | Your service appears on minia2a.uk/discover-new.html |
| Within 24h | Health probe verifies your endpoint is live (green checkmark) |
| First call | Agent discovers, pays 1¢ in USDC, gets your data |
| Every $1 earned | USDC auto-settled to your wallet on Base L2 |
x402 works best for APIs that cost $0.001–$0.10 per call. Here's what other services charge:
| Price | Example Services |
|---|---|
| $0.001 (0.1¢) | UUID generation, base64 encode/decode, hash functions |
| $0.005 (0.5¢) | Gas price lookup, DNS resolution, JSON validation |
| $0.01 (1¢) | Token security check, IP geolocation, CAPTCHA solving |
| $0.05 (5¢) | AI text generation, sentiment analysis, web scraping |
| $0.10 (10¢) | AI code review, contract audit, deep research |
For production, verify receipts cryptographically:
import jwt # PyJWT
import requests
def verify_receipt_prod(receipt, expected_service, min_price_cents):
# 1. Decode the receipt (signed JWT by minia2a)
# 2. Verify: correct service, amount ≥ price, not expired
# 3. Check nonce hasn't been used (replay protection)
try:
# Fetch minia2a's public key for verification
jwks = requests.get('https://minia2a.uk/.well-known/jwks.json').json()
payload = jwt.decode(receipt, jwks, algorithms=['ES256'])
assert payload['service'] == expected_service
assert payload['amount_cents'] >= min_price_cents
# Production: check nonce against database
# if db.seen(payload['nonce']): raise ReplayAttack
# db.record(payload['nonce'])
return True
except:
return False
The agent economy needs API providers more than it needs infrastructure. Every new paid endpoint makes the ecosystem more useful. Your API — whether it's a niche data transform, a domain-specific AI prompt, or a proprietary algorithm — could be the one that 10,000 agents call tomorrow.
Published August 9, 2026. x402 is an open protocol governed by the Linux Foundation. minia2a is an independent marketplace implementing the x402 standard.