Prediction Market API for Developers
/api/v2/public/* with API-key auth and 60 req/min default rate limit, plus /api/v2/x402/* for AI agents to pay USDC per request — no signup required.
If you build trading bots, dashboards, alpha-data tools, AI agents that interact with markets, or arbitrage strategies, you need a real API. BlockForecast was designed with developer access as a first-class product.
Two access paths
1. API key (bots, dashboards, exchanges)
Standard wallet-signed authentication. Sign a message with your wallet → receive an API key → pass it as a header on every request.
curl -X POST https://blockforecast.io/api/v2/auth/token \
-H "Content-Type: application/json" \
-d '{"address":"0x...","signature":"0x...","message":"..."}'
# returns: { "apiKey": "bf_live_xxxxxxxxxxxx" }
curl https://blockforecast.io/api/v2/public/markets \
-H "X-API-Key: bf_live_xxxxxxxxxxxx"
Default rate limit 60 req/min per key. Higher rate limits available on request.
2. x402 pay-per-request (AI agents)
HTTP 402 Payment Required protocol. Agents pay USDC on Base per call — no signup, no API key, just a wallet. Perfect for autonomous AI agents that don't want a long-term integration. Read the Agent Quickstart → for a copy-paste 4-step end-to-end build (wallet → fund → apply → call).
curl https://blockforecast.io/api/v2/x402/info # returns 402 Payment Required + payment instructions if not paid # After signing a USDC transfer on Base: curl https://blockforecast.io/api/v2/x402/feed \ -H "X-PAYMENT: <signed-payment-payload>"
Pricing: info free · feed $0.001 USDC · oracle/resolve $0.05 USDC · markets (create) $1 USDC. Network: Base mainnet (CAIP-2 eip155:8453). Facilitator: Coinbase CDP by default.
Endpoints — public REST API
| Method | Path | Returns |
|---|---|---|
| POST | /api/v2/auth/token | API key from wallet signature |
| POST | /api/v2/auth/revoke | Revoke a key |
| GET | /api/v2/public/markets | Paginated, filterable market list |
| GET | /api/v2/public/markets/:id | Single market detail |
| GET | /api/v2/public/markets/:id/price | Current LSMR price + price impact for a quote size |
| GET | /api/v2/public/markets/:id/history | OHLC price history |
| POST | /api/v2/public/markets/:id/trade | Place a trade |
| GET | /api/v2/public/positions | Open positions for the API key's wallet |
| GET | /api/v2/public/positions/history | Trade history |
| GET | /api/v2/public/balance | USDC balance |
Endpoints — x402 pay-per-request
| Method | Path | Price | Use case |
|---|---|---|---|
| GET | /api/v2/x402/info | Free | Discovery, pricing |
| GET | /api/v2/x402/feed | $0.001 | Real-time market data feed |
| GET | /api/v2/x402/oracle/resolve | $0.05 | Query oracle consensus on a question |
| POST | /api/v2/x402/markets | $1.00 | AI agent creates a market |
Why this matters
Most prediction markets treat developers as second-class. Polymarket has a CLOB API but it's narrow. Kalshi has an API but it's behind a regulated review. Neither has anything like x402 for AI agents.
BlockForecast was built so a single developer can:
- Build a market-discovery dashboard in an afternoon
- Run an arbitrage bot across markets without rate-limit pain
- Wire an autonomous AI agent that pays per call
- Pull real-time data into a trading desk or analytics stack
Stack
- Engine: Fastify 4 + Node 20 + TypeScript
- Database: PostgreSQL
- Math precision: decimal.js
- Real-time: WebSocket broadcaster, 500ms batched
- Custody: Vault.sol on Base L2
- Settlement: USDC (6-decimal)
FAQ
Do I need to be a creator to use the API?
No. Trading, market reads, oracle queries, and the data feed are open to any wallet (with USDC for x402 endpoints). Creating markets — via the public API or x402 — requires the wallet to be an approved creator. Apply here; reviewed in under 24 hours. Same approval works for both API and x402 paths. See the Agent Quickstart for the full agent flow.
Is there a paper-trading mode?
Testnet endpoints exist for development. Production trades require real USDC on Base.
How are 402-paid agents authenticated?
The wallet that signed the USDC payment is the authenticated identity for that single request. No persistent identity required.
Can I get higher rate limits?
Yes. Email [email protected] with your use case.