On this page
Yes, Polymarket has APIs. For an international market-data integration, begin with public discovery, select the exact market and outcome, then request the price or order book for that outcome. You do not need trading credentials for the public example below.
Reviewed November 21, 2026 (Pacific time). This guide covers the international product documented at docs.polymarket.com. Polymarket US has separate documentation; do not reuse international hosts or authentication assumptions for a US integration.
For a focused streaming workflow, read the Polymarket WebSocket guide, which includes a bounded public reader and an offline snapshot-recovery lesson. For one REST snapshot, use the order-book API guide.
For applications routing user orders, see the separate Polymarket Builders Program guide for codes, attribution, fees and status-dependent benefits.
For multi-outcome position mechanics, see Polymarket negative risk, conversion and partial-fill arithmetic. A payoff equivalence does not establish executable prices or a complete exit.
Which Polymarket API should you use?
| Your task | Starting point | Identifier to preserve |
|---|---|---|
| Discover events and questions | Gamma API: gamma-api.polymarket.com | Event and market IDs, slug, condition ID |
| Read an outcome's order book or midpoint | CLOB API: clob.polymarket.com | Outcome token ID |
| Analyze positions, activity or portfolio data | Data API: data-api.polymarket.com | Route-specific wallet and condition identifiers |
| Stream updates | Official real-time-data workflow | Subscribed outcome IDs and local update times |
| Place orders or manage an account | Authenticated trading workflow | Signer, account wallet and compatible credentials |
Choose an API by the question your application needs to answer. A market list is a discovery result; it is not a complete order book or evidence that every listed question currently accepts orders. The official market-data overview explains the event → market → outcome workflow.
Start with a public Gamma API request
This request retrieves a small page of non-closed markets without an API key. A fresh bounded check at 2026-11-22 00:01:09 UTC returned HTTP 200, two market records and a continuation cursor. The particular markets returned can change.
curl -fsSL 'https://gamma-api.polymarket.com/markets/keyset?closed=false&limit=2'
The keyset endpoint returns a markets array. If it returns next_cursor, pass that opaque value as after_cursor on the next request. Do not increment an offset: this endpoint explicitly rejects offset. Its documented maximum page size is 100.
Keep the continuation cursor separate from market identifiers. Stop when no continuation remains, and impose a deliberate page limit for an exploratory script. One page cannot justify a claim about the entire venue's market count.
Map the exact outcome before reading a price
One event can contain multiple market questions. Each market has distinct outcome identifiers. Save the question, slug, condition ID, selected outcome label and matching token ID together. Do not use an event ID, slug or condition ID in a parameter that requires an outcome token.
In the sampled Gamma response, outcomes and clobTokenIds were JSON-encoded strings. Decode both, verify their lengths match, and pair corresponding positions. Preserve token IDs as strings: converting these large identifiers to JavaScript numbers can lose digits.
const outcomes = JSON.parse(market.outcomes);
const tokenIds = JSON.parse(market.clobTokenIds);
if (!Array.isArray(outcomes) || !Array.isArray(tokenIds) ||
outcomes.length !== tokenIds.length) {
throw new Error("Outcome mapping is incomplete");
}
const outcomeTokens = outcomes.map((outcome, i) => ({
outcome,
tokenId: tokenIds[i],
}));
This snippet illustrates the response shape we observed, rather than a universal parser for every SDK or API version. Validate the fields at your integration boundary. Recheck the market's status, order acceptance and governing rules before interpreting it as a tradable contract.
CLOB prices: midpoint is different from an executable fill
The official pricing guide documents a public midpoint request. Supply the outcome token ID you selected:
curl -fsSL --get 'https://clob.polymarket.com/midpoint' \
--data-urlencode 'token_id=YOUR_OUTCOME_TOKEN_ID'
Replace the placeholder before running it. The midpoint is the average of the best bid and best ask. It is a reference, not a promise that your requested quantity will fill at that price. Inspect the appropriate book side, available size and fees when evaluating execution.
For a worked explanation, read our prediction-market slippage guide. For sampled price history and CSV export, use the historical-data viewer and its data guide. A historical chart does not establish current order-book depth or a resolved outcome.
How do you get a Polymarket API key?
First decide whether you need one. Public discovery and market-data reads can use an unauthenticated client. Authenticated CLOB access uses a wallet-ownership signature to create or derive credentials containing an API key, secret and passphrase. Builder attribution and relayer authorization are separate integration concerns; they are not interchangeable with the CLOB credential triple.
Follow the current wallets and authentication guide for your account wallet and signer. Preserve that relationship when reconnecting. Do not assume a copied key alone replaces the required wallet setup or signing flow. Keep secrets and private keys out of client bundles, public repositories and request logs.
The wallet guide separately shows Relayer API Keys under the account’s Settings → API Keys. That key authorizes gasless wallet operations, while CLOB L1/L2 authentication establishes wallet control and authenticates private trading requests. Identify which capability you need before creating or using a credential; a UI label containing “API key” does not make every credential equivalent.
This article's requests are public reads. They do not create credentials, deploy a wallet, grant token approvals or submit orders. A working market-data request verifies data access; it does not verify an authenticated trading integration.
Python and TypeScript: use the current SDK documentation
Polymarket now documents unified clients. The TypeScript package is @polymarket/client; the Python package is polymarket-client. The SDK migration guide distinguishes public clients from secure clients and maps older capabilities to current methods.
For a new read-only project, start with the public-client examples. For an existing project, record its installed version and migrate one workflow at a time. An older tutorial's import name or method can be incompatible with a current SDK even if the underlying REST service still works. The raw public request above avoids requiring an SDK installation for your first check.
Data API v2: update the retired v1 workflow
The current migration notice states that v1 retired November 2, 2026, including /v1/accounting/snapshot. It provides no v2 replacement for that ZIP accounting export; ordinary position/activity reads are not an equivalent accounting archive.
Use the Data API host with its documented /v2 routes. Responses wrap results in data, use snake_case fields and expose cursor pagination where applicable. Replace old market filters with condition; obsolete market/offset parameters are documented as HTTP 400 errors.
| Integration case | Current starting point |
|---|---|
| Positions and closed-position reads | /v2/positions with the relevant lifecycle status |
| Trades and activity | /v2/trades and /v2/activity |
| Open interest | /v2/oi |
| Accounting ZIP snapshot | Retired; no equivalent v2 export documented |
The notice lists unified SDK support from version 0.10.0; this is a documented minimum, not a claim about the latest release. Confirm installed versions and endpoint contracts. Do not mechanically add /v2 to Gamma or CLOB URLs.
Test the response contract, not only the URL
In a separate public read at 2026-11-22 00:01:09 UTC, GET https://data-api.polymarket.com/v2/oi returned HTTP 200 with a data array containing one global row. That observation verifies this bounded request, not private account access or every Data API route.
For the response’s scope marker, monetary units and an offline Decimal parser, see the Polymarket open-interest guide. The original examples there distinguish a selected-market subtotal, a global total, duplicates and missing observations.
Consider three invented migration fixtures. Gamma returns {markets: [...]}; a Data v2 collection returns {data: [...]}; a valid documented miss may return {data: null}. A parser that assumes every payload is a bare array, or treats every object as a market, does not preserve those distinctions.
Likewise, a HTTP 400 response is a failed request rather than an observed empty portfolio. Keep status, raw response, expected scope and retrieval time beside parsed values. If a paginated endpoint returns an opaque next cursor, follow that route’s documented cursor contract rather than inventing the next offset.
Download the original API migration review worksheet. It separates discovery, analytics and credential checks and records which evidence a read-only test does and does not establish.
For location-check semantics and disagreements between the published access references, read the supported-countries and geoblock guide. A public API response is not full trading eligibility.
API pricing, rate limits and reliable collection
The public discovery example above worked without a paid API credential. That does not establish unlimited capacity or an all-purpose pricing policy. Check current program terms and the endpoint documentation for the integration you intend to run. Trading fees are a separate cost; see our Polymarket fees guide.
The rate-limit reference describes IP-based Cloudflare limits with sliding windows and throttling. CLOB order and cancellation requests also have separate signer limits. Size your collection around the relevant endpoint, rather than applying one requests-per-second number to everything.
- Set a timeout and bounded retry policy; record failed requests instead of replacing them with sample data.
- Cache stable metadata and fetch changing prices at the cadence your use case needs.
- Preserve collection times and exact outcome IDs so a stale quote cannot masquerade as a live one.
- Handle empty results, schema changes and incomplete pages explicitly.
- On stream reconnects, rebuild the required snapshot before treating local state as current.
Use the Kalshi API guide for the other venue's workflow. Compare compatible contracts and product access in our platform comparison; similarly worded titles alone are insufficient for a data join.