API Overview
Polymarket's trading infrastructure is powered by the CLOB (Central Limit Order Book) API. This is the same API that Polyblock and other third-party tools use to interact with Polymarket's markets.
- REST API — For fetching market data, orderbook snapshots, user positions, and placing orders.
- WebSocket API — For real-time streaming of price updates, orderbook changes, and trade events.
- Gamma API — Polymarket's market metadata API for fetching market details, categories, and resolution info.
Authentication
To place orders via the API, you need to authenticate with your Polymarket account:
- 1Generate API credentials
Create an API key through Polymarket's interface or derive credentials from your wallet signature.
- 2Sign requests
Trading requests must be signed with your private key. This proves you own the wallet.
- 3Include headers
Add your API key and signature to request headers for authenticated endpoints.
Market Data Endpoints
Key endpoints for fetching market information:
- GET /markets — List all available markets with metadata, current prices, and volume.
- GET /markets/{id} — Get detailed information about a specific market including resolution criteria.
- GET /prices — Fetch current YES/NO prices for one or more markets.
- GET /trades — Get recent trade history for a market — timestamps, prices, sizes.
Market Data Fields
- condition_id — Unique identifier for the market condition.
- token_id — The token IDs for YES and NO shares (needed for placing orders).
- outcome_prices — Current best bid/ask prices for each outcome.
- volume — Total trading volume in USDC.
Orderbook Data
The orderbook shows all pending buy and sell orders:
- GET /book — Full orderbook snapshot with all bids and asks at every price level.
- Bid side — All buy orders sorted by price (highest first). Represents demand.
- Ask side — All sell orders sorted by price (lowest first). Represents supply.
- Depth — Cumulative volume at each price level — shows where large orders are stacked.
Placing Orders
To place orders programmatically, you need to:
- 1Build the order object
Specify token_id, side (BUY/SELL), price, size, and order type (LIMIT/MARKET).
- 2Sign the order
Use your private key to sign the order according to Polymarket's EIP-712 signature scheme.
- 3Submit via POST /order
Send the signed order to the CLOB API. You'll receive an order ID and status.
- 4Monitor order status
Check if the order was filled, partially filled, or is still pending via GET /orders.
WebSocket Streaming
The WebSocket API provides real-time data streams:
- Price channel — Real-time price updates for subscribed markets.
- Book channel — Orderbook changes — new orders, cancellations, and fills.
- Trade channel — Every trade execution as it happens.
- User channel — Your personal order updates, fills, and position changes (authenticated).
Connection
Connect to the WebSocket endpoint and subscribe to specific channels and markets. Messages are delivered as JSON with event type, market ID, and payload data.
Rate Limits
- REST API — Rate-limited per IP and per API key. Typical limits are 10-100 requests per second depending on the endpoint.
- WebSocket — Connection limits per API key. Subscribe to markets individually to manage bandwidth.
- Order placement — Stricter rate limits on order submission to prevent spam. Typically 5-10 orders per second.
The Polyblock Alternative: No Code Required
Building a custom trading bot with the Polymarket API requires significant engineering effort — authentication, order signing, WebSocket management, error handling, and infrastructure.
Polyblock's Playground gives you the same result without writing a single line of code. Describe your strategy in plain English, and the AI builds, deploys, and runs it on Polyblock's infrastructure.
Custom API Bot
Days to weeks of development. Requires Python/JS skills, API knowledge, server infrastructure, and ongoing maintenance.
Polyblock Playground
5 minutes to deploy. Describe strategy in English. AI handles the technical setup. Runs 24/7 on Polyblock servers.
