BLOG · X402

How an AI agent pays for an API without an API key

2026-10-18 · 6 min read · contact@xynaptic.io

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 a developer is in the loop. It breaks completely when the customer is an autonomous agent.

An agent cannot create an account, cannot accept a terms-of-service checkbox, cannot enter a credit card for a $0.02 data call. This is the gap the x402 protocol closes — and it does it with a status code the web has kept unused since 1998.

1. HTTP 402 — the status code that waited 27 years

HTTP 402 means Payment Required. It was reserved in the original spec and never really used. x402 turns it into a machine-readable price tag:

curl https://api.xynaptic.io/v1/company-kyb?siren=...

The server answers:

HTTP/1.1 402 Payment Required
X-PAYMENT: version=2, chain=base, max-total=10000 (0.01 USDC),
  pay-to=0x4ff893...a4D5e9, resource="company-kyb"

No login page, no API key wall — just a structured challenge: the price, the receiving address, and the network. Any software can read it.

2. The agent pays — and retries

The agent (or its x402 client library) builds a USDC transfer for the exact amount on the stated chain — Base, Polygon or Solana — and simply retries the same request with the payment attached:

curl https://api.xynaptic.io/v1/company-kyb?siren=... \
  -H "X-PAYMENT: <signed EIP-3009 / on-chain payment proof>"

The server verifies the payment on-chain, settles it, and returns the data. The whole handshake is:

GET request → 402 challenge (price, payTo, network)
              → on-chain USDC transfer
              → retry with proof
              → 200 + your data, cryptographically signed

3. Why this beats API keys for machine customers

4. Try it live

Xynaptic.io runs 200+ of these endpoints — company registries, crypto markets, energy, flights, news, property data — each priced from $0.005 to $0.25 per call:

curl https://api.xynaptic.io/v1/crypto-price

You will get the 402 challenge. That's not an error — it's a price tag.

If you build agents: the catalog and the MCP server are open, and the reference docs for x402 itself live at x402.org.