API reference
The Context API provides programmatic access to markets, orders, and portfolio data. All endpoints use the v2 API.Base URL
Authentication
Most endpoints require an API key passed as a Bearer token in theAuthorization header:
GET /markets- List marketsGET /markets/:id- Get market detailsGET /markets/:id/quotes- Get current bid/ask pricesGET /markets/:id/orderbook- Get orderbookPOST /markets/:id/simulate- Simulate a tradeGET /markets/:id/prices- Get price historyGET /markets/:id/oracle- Get oracle dataGET /markets/:id/oracle/quotes- Get oracle probability estimatesGET /markets/:id/oracle/quotes/latest- Get latest oracle quotePOST /markets/:id/oracle/quotes- Request new oracle analysisGET /markets/:id/activity- Get market activityGET /activity- Global activity feed
- All
/orders/*endpoints - All
/portfolio/*endpoints - All
/balance/*endpoints - All
/gasless/*endpoints
can_create_markets permission):
POST /questions- Submit a question for market creationGET /questions/submissions/:id- Poll submission statusPOST /markets/create- Create market from a processed question
Request format
Content types
- Request bodies:
application/json - Orderbook streaming:
text/event-stream(viaAcceptheader)
Response format
All responses are JSON with consistent structure:Success response
Error response
Bulk operation errors
HTTP status codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created (new order) |
| 400 | Bad Request (validation error, invalid signature) |
| 403 | Forbidden (missing required permission) |
| 404 | Not Found |
| 409 | Conflict (duplicate order) |
| 429 | Rate Limited |
| 500 | Internal Server Error |
Pagination
The API uses cursor-based pagination for list endpoints. Cursors are opaque strings - don’t parse or construct them manually.cursor is null, you’ve reached the end of the results.
Price and size encoding
All prices and sizes use 6 decimal places (USDC precision):| Human readable | Encoded value |
|---|---|
| $0.50 | 500000 |
| $0.01 | 10000 |
| 1 share | 1000000 |
| 0.5 shares | 500000 |
BigInt handling
All numeric values that could exceed JavaScript’s safe integer range (prices, sizes, balances) are returned as strings:Addresses and hashes
All Ethereum addresses and hashes are returned as checksummed hex strings:Orderbook polling
TheGET /markets/:id/orderbook endpoint returns a JSON snapshot with ETag support for conditional requests. Use If-None-Match to avoid re-fetching unchanged data: