← Back to blog

Polymarket API Docs: CLOB, Gamma, Python Gotchas

updated 2026-08-13 polymarket api reference market-microstructure

By the ZenHodl team — we run the trading bots this blog writes about, and the qualifying live-position record, including losses, is public with its admission rules at /results.

The official Polymarket API documentation at docs.polymarket.com now describes CLOB V2, deposit wallets, per-market fees, and WebSocket heartbeats in useful detail. The operational challenge is joining those pieces correctly — especially when an older tutorial still shows V1 packages, USDC.e collateral, or a pre-V2 wallet flow.

This is a practical guide to navigating Polymarket's API surface in 2026 based on running bots against it daily. We will cover what is well-documented, what is poorly documented, and what you have to figure out from the source code or from experience.

If you want a hands-on code walkthrough instead of an orientation, see our Polymarket API Python tutorial — that post is copy-paste code; this one is the map.

The Four API Surfaces

Polymarket exposes data and trading through separate services. A production integration normally touches four surfaces, and their identifiers are not interchangeable.

1. CLOB V2 API — https://clob.polymarket.com The Central Limit Order Book. This is where trading happens. Read orderbooks, place orders, cancel orders, check fills, and query market-level tick, order-size, neg-risk, and fee parameters. The endpoint clob.polymarket.com/prices-history?market={token_id} returns historical price series, which is useful for backtesting and CLV (closing line value) measurement.

2. Gamma API — https://gamma-api.polymarket.com Market discovery and metadata. You list available markets, resolve category or league tags to numeric IDs, filter listings with tag_id, and resolve human-readable slugs to token IDs. The Gamma API is what you use to find a market; the CLOB API is what you use to trade it.

3. Data API — https://data-api.polymarket.com Public user positions, activity, trade history, holders, open interest, and analytics. Use this for public portfolio or market analysis; use authenticated CLOB endpoints for your private order-management state.

4. WebSocket streams — wss://ws-subscriptions-clob.polymarket.com Real-time order book updates, market events, and your own fill notifications. For any latency-sensitive use case (in-game sports trading, live market making) you need this. Polling the REST CLOB endpoint every second is both rude and too slow.

CLOB V2 became production on April 28, 2026. The host did not change, but the signed order format, contracts, collateral, and supported client packages did. That unchanged hostname is why V1 code can look current while being production-incompatible.

The official docs document each service, but your application still has to join event IDs, condition IDs, and asset/token IDs correctly across them.

A Quick Map: What You Use Where

Task API
List active sports markets today Gamma /sports or /tags/slug/{league} to resolve IDs, then /markets/keyset?tag_id=...&closed=false
Get current bid/ask for a specific token CLOB /book?token_id=...
Place a buy order CLOB /order (signed)
Stream real-time price changes WebSocket market channel
Stream my fills as they happen WebSocket user channel
Historical price series for backtest CLOB /prices-history?market=...
Public positions or activity for an address Data API /positions or /activity
Find a market's condition_id from a slug Gamma /markets/slug/{slug}
Read market tick, minimum size and fee details CLOB /clob-markets/{condition_id}
Check collateral balance/allowance py-clob-client-v2 balance methods
Cancel all open orders CLOB DELETE /cancel-all

Keep this table handy. The official docs will not show it to you in one place.

What the Official Docs Cover Well

In our experience, these areas of the docs are clear and accurate:

If you stay within these areas, the docs will not steer you wrong.

What the Official Docs Cover Poorly

These are the gaps where you will lose hours if you do not know to look for them:

1. Never hardcode V1 Exchange or neg-risk addresses. CLOB V2 has new verifying contracts for standard and neg-risk markets. Let the V2 SDK resolve market type, or obtain it from current CLOB metadata. An address copied from a pre-April-2026 example signs against the wrong domain.

2. Wallet paths are not interchangeable. CLOB V2 supports EOA (0), existing Polymarket proxy (1), existing Gnosis Safe (2), and the deposit-wallet POLY_1271 flow (3). New API users should use deposit wallets with type 3; existing proxy and Safe accounts can retain their current type. In every case, funder must be the address that holds the collateral for that wallet path.

3. Rate limits are endpoint-specific. The official table has separate limits for books, prices, history, ledger reads, and trading, plus sustained limits on order operations. Code against the relevant endpoint limit and handle throttling instead of copying a single “100 requests/second” number.

4. WebSocket lifecycle is application work. The market and user channels require the client to send PING every 10 seconds. A production client still needs reconnect, backoff, re-subscription, stale-socket rejection, and snapshot reconciliation after reconnecting.

5. Settlement timing. Markets resolve via UMA oracle, and the time between event end and on-chain settlement varies. Most sports markets settle within minutes, but some take longer. If your bot assumes "match ended → I can redeem immediately" you will get failed redemption calls. Wait for the on-chain resolved flag, do not infer settlement from external sources.

6. Fill evidence can arrive in two stages. V2 order responses can include transactionsHashes; when a transaction hash is not available yet, they can return tradeIDs that you follow through trade history. Do not treat the submitted limit as the execution price, and do not assume the hash is present synchronously.

The V2 Python Client vs Raw HTTP

The py-clob-client-v2 Python library handles CLOB V2 authentication, request signing, per-market details, and order operations. The old py-clob-client repository is archived and its V1-signed orders are not accepted by production.

Polymarket also publishes a newer unified Python package, polymarket-client, for workflows spanning more than the CLOB. For a CLOB-specific bot, use a supported V2 client and pin its version; do not mix V1 examples into either SDK.

The 10% case for raw HTTP: - Custom WebSocket lifecycle and persistence logic. - Endpoints not yet wrapped (Polymarket ships new endpoints faster than the library updates). - Cross-language environments (Node.js, Go) where you would need to reimplement signing anyway.

For raw HTTP, signing is the trickiest part. L1 uses an EIP-712 wallet signature; L2 uses HMAC-SHA256 with the API secret and requires all five POLY_* headers. Use the SDK or copy the current official reference implementation exactly rather than reconstructing the canonical message from an old blog post.

Authentication Tiers — When You Need What

Polymarket-style tier terminology in their docs separates read access from authenticated trading from on-chain operations. A practical mapping:

The CLOB API documentation covers the first two reasonably well. The third — on-chain redemption — is where most production gotchas live, because most users do it through the web UI and never hit the documentation gap.

Rate Limits in Practice

The current rate-limit table is explicit and can change independently by endpoint. At the time of this update it lists, among other values, /book at 1,500 requests per 10 seconds and /prices-history at 1,000 per 10 seconds. Trading endpoints have both burst and 10-minute sustained limits.

Those are ceilings, not polling targets. Use batch endpoints, cache immutable metadata, prefer WebSocket market data, and apply exponential backoff when throttled. Centralize your rate limiter across processes that share credentials so several bots cannot collectively exceed a limit.

Common Error Modes and What They Mean

The CLOB API returns error messages as plain strings rather than typed error codes, which makes pattern-matching them in code slightly annoying. The categories you will hit most:

Data Endpoints for Backtesting

If you are building backtests rather than live trading, the endpoints you care about most:

An important correction: fidelity=5 is five minutes, not five seconds. It is too coarse to reconstruct a five-second in-game decision path. Sub-minute execution research needs event-time trades plus WebSocket book capture or another suitably timestamped depth source.

What the API Still Does Not Give You Automatically

A few things still require your own data engineering:

For a more thorough discussion of Polymarket's fee structure, see our Polymarket fees explained post.

A Realistic First Integration

If you are starting an integration today, the order we recommend:

  1. Hit the Gamma API anonymously and pull the list of active sports markets. Confirm you can resolve a slug to a condition_id and token_id.
  2. Hit the CLOB /book endpoint for one of those tokens. Confirm you can read the bid/ask.
  3. Set up the WebSocket subscription for that same token. Confirm you receive updates when the book moves.
  4. Generate L1/L2 credentials, configure the correct wallet type, fund that address with pUSD, and read its current balance and allowance.
  5. Read the selected market's minimum order size, tick size, neg-risk flag, and fee details. Place a valid small resting order and cancel it.
  6. Place a real order and let it fill. Confirm the user-channel update, trade ID, actual execution price, and eventual transaction hash.
  7. Wait for the market to resolve. Redeem your winnings (or accept your loss). Confirm the wallet-specific redemption flow worked.

Each step exercises a different API surface and authentication tier. Doing them in this order means you fail in isolated chunks rather than discovering several issues simultaneously when you try to ship.

When to Stop Reading the Docs and Start Reading the Source

For everything described here as an operational edge case, the next move is reading the py-clob-client-v2 source and the Polymarket contracts on GitHub. The signing logic, fee lookup, neg-risk routing, and wallet integration are inspectable there.

Treat the official docs as the orientation, the library source as the reference, and your own production logs as the ground truth.

Related deeper reads: - Polymarket API Python Tutorial — the hands-on companion to this orientation. - Polymarket Fees Explained — the cost side that affects every trade. - The Complete Guide to Prediction Market APIs — Polymarket in the context of Kalshi and sportsbook APIs. - Hold to Settlement, Never Sell — strategy implications of the fee and API mechanics.

Related reading

Get ZenHodl Weekly

One weekly email with live results, one model insight, and product updates.

Tuesday mornings. No spam.

Want the data behind this post?

Historical sports prediction-market datasets with measured coverage, documented schemas, and disclosed gaps.

Join the community

Discuss strategies, share results, get help.

Join Discord