← Back to blog

Polymarket API Docs: CLOB, Gamma, Python Gotchas

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

By ZenHodl. Dataset documentation, research and model evaluations are linked in the article. A separate filtered ledger of bot-attributed trades, including losses and its admission rules, is public 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 guide maps the published API surfaces and operational checks. Primary contracts and selected public GET response shapes were checked October 8, 2026; the review did not authenticate an account, submit orders or verify every production integration.

If you want a hands-on code walkthrough instead of an orientation, see our Polymarket API Python tutorial — that post scopes token-based examples to a named SDK version; this one is the map.

The Main API Surfaces

Polymarket exposes data and trading through separate services. The four surfaces below serve common workflows, 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 positions, activity, trade history and analytics. Data API v2 introduces a shared response envelope and cursor pagination; legacy v1 and current v2 routes are not interchangeable. Use authenticated CLOB endpoints for 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. REST polling can suit bounded prototypes; update-driven strategies still need a WebSocket freshness and reconnect policy.

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 /v2/positions or /v2/activity; see version-specific filters/envelope
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

The official API overview lists these hosts; this table connects them to example tasks.

What the Official Docs Cover Well

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

These contracts are a starting point; version changes and your own account lifecycle still require verification.

Operational Checks Your Application Still Owns

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. This review did not measure a settlement-time distribution. If your bot assumes "match ended → I can redeem immediately" you will get failed redemption calls. Use the resolution state and redeemability required by the selected position system; a final scoreboard is not proof redemption is ready.

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. The retained CLOB-specific examples use py-clob-client-v2 1.2.0. Its README distinguishes token_id from position_id routing; do not mix package APIs, position identifiers or signing versions. New projects should start with the unified SDK recommendation.

Reasons to use raw HTTP: - Custom WebSocket lifecycle and persistence logic. - Endpoints not yet wrapped (Polymarket ships new endpoints faster than the library updates). - A language or runtime not supported by the official SDKs; Node.js has an official TypeScript SDK and does not by itself require custom signing.

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 official error reference documents structured and HTTP error responses. Preserve status/body and classify against the contract for your endpoint and SDK version. 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 token-based CLOB examples, inspect the py-clob-client-v2 source and the current contracts reference. For new projects begin with the unified SDK, and distinguish CTF token-backed markets from position-backed markets. The signing logic, fee lookup, neg-risk routing, and wallet integration are inspectable there.

Keep the exact package/contract versions with recorded request and execution evidence. Local logs must be reconciled with exchange and wallet state rather than treated as an independent source of 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

Dataset releases, research notes, and public results, including corrections.

Research and dataset updates from ZenHodl.

Want the data behind this post?

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