Skip to main content
The x402 Agent API is a micropayment-native API surface built on the HTTP 402 Payment Required protocol. Instead of issuing a long-lived API key, the server gates each request behind a USDC micropayment on Base L2. Your agent signs a payment authorization, includes it in the request header, and the server verifies and settles the payment before executing the call. For market creation specifically, it costs exactly $1 USDC per market — no subscription, no quota, no dashboard required.

Who this is for

The x402 API is purpose-built for three categories of developer: Autonomous AI agents that need to interact with prediction markets without human involvement in the authentication flow. An agent can hold a private key, fund the wallet with USDC, and call the API indefinitely — no key rotation, no session management. Automated systems and bots where the overhead of the standard API key flow (signing in a browser, storing a key, handling key expiry) adds friction that doesn’t make sense for a machine actor. Developers who want pay-as-you-go pricing for low-frequency queries — rather than maintaining an integration just to query the oracle feed occasionally, you pay $0.001 per call only when you need it.

How the x402 protocol works

x402 is a lightweight HTTP extension built by Coinbase for the AI agent ecosystem. When you make a request to an x402-gated endpoint without a payment header, the server returns 402 Payment Required with a JSON body describing the payment requirements. Your client constructs a USDC transfer authorization (using EIP-3009 transferWithAuthorization), signs it with your wallet’s private key, and retries the request with the signed payload in the X-PAYMENT header. The server forwards the payload to the Coinbase CDP facilitator for settlement, and if valid, executes the request. The full protocol flow:
Client                          BlockForecast API              Coinbase CDP
  │                                    │                            │
  │── GET /api/v2/x402/feed ──────────►│                            │
  │                                    │                            │
  │◄── 402 Payment Required ───────────│                            │
  │    { amount, currency, payTo,      │                            │
  │      network, nonce }              │                            │
  │                                    │                            │
  │  [sign USDC transferWithAuth]      │                            │
  │                                    │                            │
  │── GET /api/v2/x402/feed ──────────►│                            │
  │   X-PAYMENT: <signed-payload>      │                            │
  │                                    │── verify + settle ────────►│
  │                                    │◄── settlement confirmed ───│
  │◄── 200 OK + response body ─────────│                            │
The entire round-trip typically completes in 3–5 seconds.

Available endpoints

EndpointPriceDescription
GET /api/v2/x402/infoFreeLists all x402 endpoints, their prices, and the current payment requirements. Discovery endpoint — no payment needed.
GET /api/v2/x402/feed$0.001Real-time market data feed snapshot — prices, volume, and active market list.
GET /api/v2/x402/oracle/resolve$0.05Query the AI oracle for its current consensus on a given question. Returns probability and citations.
POST /api/v2/x402/markets$1.00Create a new prediction market. Requires creator approval (one-time, per wallet).
Read-only endpoints (info, feed, oracle/resolve) are open to any wallet with USDC on Base. Only POST /x402/markets requires creator approval.

x402 vs the standard API key

Standard API keyx402 Agent API
AuthenticationX-API-Key header (persistent key)X-PAYMENT signed USDC transfer
IdentityWallet that signed the key issuance requestWallet that signs each payment
Cost modelRate-limited (60 req/min default), no per-request chargePay per request, no burst limit
Signup requiredWallet signature only (one-time)None for read endpoints
Creator approvalRequired to POST /public/marketsRequired to POST /x402/markets
Best forBots, dashboards, trading integrations hitting the API repeatedlyAI agents, one-off queries, data pipelines
Both APIs run in parallel — you can use an API key for high-frequency reads and x402 for pay-per-query oracle resolution, all from the same agent wallet.

The 4-step build

Getting an agent to the point of creating markets involves four steps:
1

Get an EVM wallet for your agent

Generate a wallet programmatically with viem or use any EVM-compatible wallet (MetaMask, Coinbase Wallet, a hardware wallet). Your agent needs to hold the private key to sign payments at runtime. Store the key in a secrets manager.
2

Fund the wallet with USDC on Base

Send USDC on Base mainnet to the agent’s address. $5 covers gas plus several market creations. Bridge from Ethereum via the official Base bridge or send directly from Coinbase.
3

Apply for creator access

Visit blockforecast.io/apply, connect with the agent wallet address, and submit the form. Approval lands within 24 hours. This is a one-time step — the same wallet can create markets via the web, the public API, and x402 forever after.
4

Call POST /api/v2/x402/markets

Use an x402 client (e.g. x402-fetch from Coinbase) to handle the payment flow automatically. See Create a market via x402 for the full implementation.

Why we built this

Prediction markets are particularly well-suited to autonomous AI agents: agents are good at probability estimation, they can identify gaps in market coverage faster than humans, and they have a natural incentive to create markets — every trade on a creator-owned market sends 0.5% back to the creator’s wallet in real time. An agent that creates markets can become self-funding. x402 removes the last friction in that loop: the need for a human to approve an API key or complete an OAuth flow. The wallet that signs the payment is the authenticated identity. No persistent state, no session, no dashboard.

Next steps

Create a market via x402

Full step-by-step guide with working TypeScript code for the complete wallet → fund → approve → create flow.

Apply for creator access

Submit your creator application — reviewed within 24 hours and valid across all BlockForecast surfaces.