Polymarket CLOB API vs Gamma API — what each one does
CLOB handles orderbook and trading; Gamma handles market discovery and metadata. Both are usually needed. Here is how they divide responsibilities.
At a glance
| Feature | CLOB API | Gamma API |
| --- | --- | --- |
| Base URL | clob.polymarket.com | gamma-api.polymarket.com |
| Purpose | Order placement + orderbook | Market discovery + metadata |
| Auth required | Yes (wallet signature for writes) | No (public read) |
| Key endpoints | /order, /book, /trade-history | /markets, /events, /market/{id} |
| Resolution data | No | Yes (outcome prices, status) |
| Fee rates | Yes (/fee-rate?token_id=) | No |
| Real-time | WebSocket feed available | REST only |
| Typical bot usage | Place, cancel, track orders | Find markets, poll resolution |
Detail by axis
Purpose
The CLOB API is the trading engine. It exposes the central limit orderbook, lets you post and cancel limit orders, and returns fill confirmations. Everything that moves money goes through the CLOB.
The Gamma API is the catalog. It returns metadata about markets: question text, category, resolution source, token IDs for YES and NO outcomes, expiry timestamps, and outcome prices once a market settles. You use it to discover what to trade and to confirm how a trade resolved.
These two APIs are complementary, not competing. Almost every predtools bot uses both.
Auth required
The CLOB requires authentication for writes. Auth uses an EIP-712 wallet signature tied to your Polygon address. Read-only endpoints like /book and /midpoint are public.
The Gamma API is entirely public. No wallet, no API key. You can call it from a browser with no setup.
Key endpoints
CLOB endpoints a bot typically calls:
| Endpoint | Use |
| --- | --- |
| POST /order | Place a limit or market order |
| DELETE /order/{id} | Cancel an open order |
| GET /book?token_id= | Fetch the current orderbook |
| GET /midpoint?token_id= | Get the current mid price |
| GET /fee-rate?token_id= | Get per-market taker fee parameters |
| GET /trade-history | Recent fills for an account |
Gamma endpoints a bot typically calls:
| Endpoint | Use |
| --- | --- |
| GET /markets?active=true | List all active markets |
| GET /market/{condition_id} | Metadata for a single market |
| GET /events | Group markets by event |
Resolution data
When a 5-minute BTC binary expires, the CLOB does not tell you who won. You poll the Gamma API for the market's outcome prices. When one outcome reaches 1.00 (or 0.00), the market has settled. Predtools bots call resolveViaGamma() which loops on GET /market/{id} until the result is unambiguous, which is the correct pattern — the CLOB has already closed, so polling CLOB for a fill price would give you nothing useful.
Fee rates
The CLOB exposes per-market fee parameters via /fee-rate?token_id=. The taker fee formula is non-linear: shares × feeRate × price × (price × (1 - price))^exponent. The fee peaks at p=0.50 and decreases toward the extremes. Always fetch the live rate for a market rather than hardcoding it, because fee structures differ between market categories (crypto binary vs sports, for example).
The Gamma API has no fee data.
Real-time data
The CLOB exposes a WebSocket feed for live orderbook updates. If you need sub-second price data for a market signal, subscribe to the CLOB WebSocket. The Gamma API is REST-only, polled at whatever interval makes sense for your resolution check (typically every 10–30 seconds).
Typical bot usage
A typical predtools bot uses both APIs in sequence:
- Boot: call
GET /markets?active=trueon Gamma to find the right market and extract its token IDs. - Trading loop: call CLOB
/bookor WebSocket for price data, thenPOST /orderto enter a position. - Resolution: after expiry, poll Gamma
/market/{id}until outcome prices settle.
Neither API alone is sufficient for a complete trading bot.
Which should I choose?
You do not choose one — you use both. The question is which to call for each task:
- CLOB API for anything involving orders, fills, or the live orderbook.
- Gamma API for market discovery, metadata, and resolution confirmation.
- If you need fee parameters, use the CLOB
/fee-rateendpoint, not Gamma. - If you need to know if a market resolved YES or NO, use Gamma outcome prices, not CLOB fills.