Every API on the internet still works like it's 2010: a human signs up, gets a key, wires a monthly subscription, and pastes the key into a config file. π
That works when the customer is a developer. It breaks completely when the customer is an autonomous agent. An agent cannot create an account, accept terms of service, or enter a credit card for a $0.02 data call. π€·
This post walks through, step by step, how the x402 protocol fixes it β using a live catalog (I run xynaptic.io, 200+ pay-per-call endpoints) so you can reproduce every command. β
πͺ Step 1: The request
bash
curl -i https://api.xynaptic.io/v1/crypto-price
No key, no auth header, no account. What comes back? π
π° Step 2: The 402 challenge
http
HTTP/1.1 402 Payment Required
X-PAYMENT: version=2, chain=base, max-total=10000 (0.01 USDC),
pay-to=0x4ff893...a4D5e9, resource="crypto-price"
HTTP 402 (Payment Required) has existed since 1998 and nobody used it. π°οΈ x402 turns it into a machine-readable price tag: the price, the receiving address, and the network β all stated before payment, so an agent can compare providers and budget itself. π·οΈ
No login wall. No "contact sales". Just a price. β‘
π Step 3: The agent pays
The agent's x402 client builds a USDC transfer for the exact amount on the stated chain (Base, Polygon or Solana here), then retries the same request with the payment proof attached:
bash
curl https://api.xynaptic.io/v1/crypto-price \
-H "X-PAYMENT: "
The server verifies the payment on-chain, settles it, and returns the data. On xynaptic.io every response is also signed with Ed25519, and every proof is auditable at api.xynaptic.io/trust. π
π§ The full flow
GET request β 402 challenge (price, payTo, network)
β on-chain USDC transfer
β retry with proof
β 200 + your data (signed)
Three properties worth noting: π
- πΈ Pay per call, not per month. An agent that makes one $0.01 call pays one cent. No tiers, no minimums, no end-of-month invoice.
- π Nothing to leak. No API keys to rotate, no secrets to scrape from a
.envfile pushed to GitHub. - π§© It composes. An agent with a wallet can buy data, storage, watch jobs, even skills β machine-to-machine, no human in the loop.
π§ͺ Try it yourself
The cheapest way to see it is one curl:
bash
curl -i https://api.xynaptic.io/v1/crypto-price
You will get a 402. That's not an error β it's a price tag. π
- π Full catalog + docs: xynaptic.io/docs
- π MCP server:
mcp.xynaptic.io/mcp(npm client:xynaptic-mcp) - π Open catalog on GitHub: github.com/ericchengech/xynaptic-catalog
- π Protocol reference: x402.org
- π https://xynaptic.io/blog
If you build agents: is the 402 β pay β retry flow understandable enough? What data domains would you want next? I read every comment. π¬π
Top comments (0)