Update Polymarket documentation (2026-02-19)

- Added new documentation URLs from llms.txt index
- Updated TARGET.md with 244 total documentation pages
- Scraped new pages for trading, concepts, and API reference sections
- Updated changelog and new index pages
This commit is contained in:
AI Agent
2026-02-19 14:31:02 +01:00
parent 81f77eff3c
commit b2a29fe51f
250 changed files with 33306 additions and 9659 deletions
+107 -9
View File
@@ -3,6 +3,7 @@
These URLs will be scraped and organized into the repository.
## Quickstart
https://docs.polymarket.com/quickstart.md
https://docs.polymarket.com/quickstart/overview.md
https://docs.polymarket.com/quickstart/fetching-data.md
https://docs.polymarket.com/quickstart/first-order.md
@@ -11,23 +12,31 @@ https://docs.polymarket.com/quickstart/introduction/rate-limits.md
https://docs.polymarket.com/quickstart/reference/endpoints.md
## Market Makers
https://docs.polymarket.com/market-makers/overview.md
https://docs.polymarket.com/market-makers/getting-started.md
https://docs.polymarket.com/market-makers/trading.md
https://docs.polymarket.com/market-makers/liquidity-rewards.md
https://docs.polymarket.com/market-makers/maker-rebates.md
https://docs.polymarket.com/market-makers/inventory.md
https://docs.polymarket.com/developers/market-makers/introduction.md
https://docs.polymarket.com/developers/market-makers/setup.md
https://docs.polymarket.com/developers/market-makers/trading.md
https://docs.polymarket.com/developers/market-makers/liquidity-rewards.md
https://docs.polymarket.com/developers/market-makers/maker-rebates-program.md
https://docs.polymarket.com/developers/market-makers/data-feeds.md
https://docs.polymarket.com/developers/market-makers/inventory.md
## Polymarket Builders Program
https://docs.polymarket.com/builders/overview.md
https://docs.polymarket.com/builders/tiers.md
https://docs.polymarket.com/builders/api-keys.md
https://docs.polymarket.com/developers/builders/builder-intro.md
https://docs.polymarket.com/developers/builders/builder-tiers.md
https://docs.polymarket.com/developers/builders/builder-profile.md
https://docs.polymarket.com/developers/builders/order-attribution.md
https://docs.polymarket.com/developers/builders/relayer-client.md
https://docs.polymarket.com/developers/builders/blockchain-data-resources.md
https://docs.polymarket.com/developers/builders/examples.md
## Central Limit Order Book (CLOB)
https://docs.polymarket.com/trading/overview.md
https://docs.polymarket.com/trading/quickstart.md
https://docs.polymarket.com/developers/CLOB/introduction.md
https://docs.polymarket.com/developers/CLOB/status.md
https://docs.polymarket.com/developers/CLOB/quickstart.md
@@ -39,11 +48,40 @@ https://docs.polymarket.com/developers/CLOB/clients/methods-l1.md
https://docs.polymarket.com/developers/CLOB/clients/methods-l2.md
https://docs.polymarket.com/developers/CLOB/clients/methods-builder.md
## API Reference - Market Data
https://docs.polymarket.com/api-reference/introduction.md
https://docs.polymarket.com/api-reference/authentication.md
https://docs.polymarket.com/api-reference/rate-limits.md
https://docs.polymarket.com/api-reference/geoblock.md
https://docs.polymarket.com/api-reference/clients-sdks.md
## API Reference - Market Data (Data API)
https://docs.polymarket.com/market-data/overview.md
https://docs.polymarket.com/market-data/fetching-markets.md
https://docs.polymarket.com/api-reference/market-data/get-order-book.md
https://docs.polymarket.com/api-reference/market-data/get-order-books-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-market-price.md
https://docs.polymarket.com/api-reference/market-data/get-market-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-market-prices-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-midpoint-price.md
https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-midpoint-prices-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-spread.md
https://docs.polymarket.com/api-reference/market-data/get-spreads.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-price.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-prices-query-parameters.md
https://docs.polymarket.com/api-reference/market-data/get-last-trade-prices-request-body.md
https://docs.polymarket.com/api-reference/market-data/get-fee-rate.md
https://docs.polymarket.com/api-reference/market-data/get-fee-rate-by-path-parameter.md
https://docs.polymarket.com/api-reference/market-data/get-tick-size.md
https://docs.polymarket.com/api-reference/market-data/get-tick-size-by-path-parameter.md
https://docs.polymarket.com/api-reference/data/get-server-time.md
## API Reference - Orderbook
https://docs.polymarket.com/api-reference/orderbook/get-order-book-summary.md
https://docs.polymarket.com/api-reference/orderbook/get-multiple-order-books-summaries-by-request.md
## API Reference - Pricing
## API Reference - Pricing (Legacy)
https://docs.polymarket.com/api-reference/pricing/get-market-price.md
https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices.md
https://docs.polymarket.com/api-reference/pricing/get-multiple-market-prices-by-request.md
@@ -53,6 +91,20 @@ https://docs.polymarket.com/api-reference/pricing/get-price-history-for-a-traded
## API Reference - Spreads
https://docs.polymarket.com/api-reference/spreads/get-bid-ask-spreads.md
## API Reference - Trade (CLOB)
https://docs.polymarket.com/api-reference/trade/post-a-new-order.md
https://docs.polymarket.com/api-reference/trade/post-multiple-orders.md
https://docs.polymarket.com/api-reference/trade/get-single-order-by-id.md
https://docs.polymarket.com/api-reference/trade/get-user-orders.md
https://docs.polymarket.com/api-reference/trade/get-trades.md
https://docs.polymarket.com/api-reference/trade/cancel-single-order.md
https://docs.polymarket.com/api-reference/trade/cancel-multiple-orders.md
https://docs.polymarket.com/api-reference/trade/cancel-all-orders.md
https://docs.polymarket.com/api-reference/trade/cancel-orders-for-a-market.md
https://docs.polymarket.com/api-reference/trade/get-order-scoring-status.md
https://docs.polymarket.com/api-reference/trade/send-heartbeat.md
https://docs.polymarket.com/api-reference/trade/get-builder-trades.md
## Historical Timeseries Data
https://docs.polymarket.com/developers/CLOB/timeseries.md
@@ -65,24 +117,35 @@ https://docs.polymarket.com/developers/CLOB/orders/get-active-order.md
https://docs.polymarket.com/developers/CLOB/orders/check-scoring.md
https://docs.polymarket.com/developers/CLOB/orders/cancel-orders.md
https://docs.polymarket.com/developers/CLOB/orders/onchain-order-info.md
https://docs.polymarket.com/trading/orders/overview.md
https://docs.polymarket.com/trading/orders/create.md
https://docs.polymarket.com/trading/orders/cancel.md
https://docs.polymarket.com/trading/orders/attribution.md
## Trades
https://docs.polymarket.com/developers/CLOB/trades/trades-overview.md
https://docs.polymarket.com/developers/CLOB/trades/trades.md
## Websocket
https://docs.polymarket.com/market-data/websocket/overview.md
https://docs.polymarket.com/market-data/websocket/market-channel.md
https://docs.polymarket.com/developers/CLOB/websocket/wss-overview.md
https://docs.polymarket.com/quickstart/websocket/WSS-Quickstart.md
https://docs.polymarket.com/developers/CLOB/websocket/wss-auth.md
https://docs.polymarket.com/developers/CLOB/websocket/user-channel.md
https://docs.polymarket.com/developers/CLOB/websocket/market-channel.md
https://docs.polymarket.com/api-reference/wss/market.md
https://docs.polymarket.com/api-reference/wss/user.md
## Sports Websocket
https://docs.polymarket.com/developers/sports-websocket/overview.md
https://docs.polymarket.com/developers/sports-websocket/message-format.md
https://docs.polymarket.com/developers/sports-websocket/quickstart.md
https://docs.polymarket.com/market-data/websocket/sports.md
https://docs.polymarket.com/api-reference/wss/sports.md
## Real Time Data Stream
https://docs.polymarket.com/market-data/websocket/rtds.md
https://docs.polymarket.com/developers/RTDS/RTDS-overview.md
https://docs.polymarket.com/developers/RTDS/RTDS-crypto-prices.md
https://docs.polymarket.com/developers/RTDS/RTDS-comments.md
@@ -120,6 +183,10 @@ https://docs.polymarket.com/api-reference/markets/list-markets.md
https://docs.polymarket.com/api-reference/markets/get-market-by-id.md
https://docs.polymarket.com/api-reference/markets/get-market-tags-by-id.md
https://docs.polymarket.com/api-reference/markets/get-market-by-slug.md
https://docs.polymarket.com/api-reference/markets/get-prices-history.md
https://docs.polymarket.com/api-reference/markets/get-sampling-markets.md
https://docs.polymarket.com/api-reference/markets/get-simplified-markets.md
https://docs.polymarket.com/api-reference/markets/get-sampling-simplified-markets.md
## API Reference - Series
https://docs.polymarket.com/api-reference/series/list-series.md
@@ -153,12 +220,14 @@ https://docs.polymarket.com/api-reference/core/get-top-holders-for-markets.md
https://docs.polymarket.com/api-reference/core/get-total-value-of-a-users-positions.md
https://docs.polymarket.com/api-reference/core/get-closed-positions-for-a-user.md
https://docs.polymarket.com/api-reference/core/get-trader-leaderboard-rankings.md
https://docs.polymarket.com/api-reference/core/get-positions-for-a-market.md
## API Reference - Builders
https://docs.polymarket.com/api-reference/builders/get-aggregated-builder-leaderboard.md
https://docs.polymarket.com/api-reference/builders/get-daily-builder-volume-time-series.md
## Bridge & Swap - Overview
https://docs.polymarket.com/trading/bridge/overview.md
https://docs.polymarket.com/developers/misc-endpoints/bridge-overview.md
## API Reference - Bridge
@@ -167,14 +236,24 @@ https://docs.polymarket.com/api-reference/bridge/get-a-quote.md
https://docs.polymarket.com/api-reference/bridge/create-deposit-addresses.md
https://docs.polymarket.com/api-reference/bridge/create-withdrawal-addresses.md
https://docs.polymarket.com/api-reference/bridge/get-transaction-status.md
https://docs.polymarket.com/trading/bridge/deposit.md
https://docs.polymarket.com/trading/bridge/quote.md
https://docs.polymarket.com/trading/bridge/status.md
https://docs.polymarket.com/trading/bridge/supported-assets.md
https://docs.polymarket.com/trading/bridge/withdraw.md
## Subgraph
https://docs.polymarket.com/market-data/subgraph.md
https://docs.polymarket.com/developers/subgraph/overview.md
## Resolution
https://docs.polymarket.com/developers/resolution/UMA.md
## Conditional Token Frameworks (CTF)
https://docs.polymarket.com/trading/ctf/overview.md
https://docs.polymarket.com/trading/ctf/split.md
https://docs.polymarket.com/trading/ctf/merge.md
https://docs.polymarket.com/trading/ctf/redeem.md
https://docs.polymarket.com/developers/CTF/overview.md
https://docs.polymarket.com/developers/CTF/split.md
https://docs.polymarket.com/developers/CTF/merge.md
@@ -185,6 +264,7 @@ https://docs.polymarket.com/developers/CTF/deployment-resources.md
https://docs.polymarket.com/developers/proxy-wallet.md
## Negative Risk
https://docs.polymarket.com/advanced/neg-risk.md
https://docs.polymarket.com/developers/neg-risk/overview.md
## Changelog
@@ -236,8 +316,26 @@ https://docs.polymarket.com/polymarket-learn/trading/market-orders.md
https://docs.polymarket.com/polymarket-learn/trading/no-limits.md
https://docs.polymarket.com/polymarket-learn/trading/using-the-orderbook.md
## Missing from API Reference - Core
https://docs.polymarket.com/api-reference/core/get-positions-for-a-market.md
## Polymarket 101
https://docs.polymarket.com/polymarket-101.md
## Missing from Builders
https://docs.polymarket.com/developers/builders/examples.md
## Concepts
https://docs.polymarket.com/concepts/markets-events.md
https://docs.polymarket.com/concepts/order-lifecycle.md
https://docs.polymarket.com/concepts/positions-tokens.md
https://docs.polymarket.com/concepts/prices-orderbook.md
https://docs.polymarket.com/concepts/resolution.md
## Trading
https://docs.polymarket.com/trading/fees.md
https://docs.polymarket.com/trading/gasless.md
https://docs.polymarket.com/trading/orderbook.md
https://docs.polymarket.com/trading/clients/public.md
https://docs.polymarket.com/trading/clients/l1.md
https://docs.polymarket.com/trading/clients/l2.md
https://docs.polymarket.com/trading/clients/builder.md
## Index & Resources
https://docs.polymarket.com/index.md
https://docs.polymarket.com/resources/contract-addresses.md
https://docs.polymarket.com/resources/error-codes.md
+145
View File
@@ -0,0 +1,145 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Negative Risk Markets
> Capital-efficient trading for multi-outcome events
**Negative risk** is a mechanism for multi-outcome events where only one outcome can win. It enables capital-efficient trading by allowing positions across all outcomes within an event to be related through a **conversion** operation.
## How It Works
In a standard multi-outcome event, each market is independent. If you want to bet against one outcome, you must buy that outcome's No tokens—but those No tokens have no relationship to the other outcomes.
Negative risk changes this. In a neg risk event:
* A **No share** in any market can be converted into **1 Yes share in every other market**
* This conversion happens through the Neg Risk Adapter contract
### Example
Consider an event: "Who will win the 2024 Presidential Election?" with three outcomes:
| Outcome | Your Position |
| ------- | ------------- |
| Trump | — |
| Harris | — |
| Other | 1 No |
With negative risk, that 1 No on "Other" can be converted into:
| Outcome | After Conversion |
| ------- | ---------------- |
| Trump | 1 Yes |
| Harris | 1 Yes |
| Other | — |
This is capital-efficient because betting against one outcome is economically equivalent to betting *for* all other outcomes.
## Identifying Neg Risk Markets
The Gamma API includes a `negRisk` boolean on events and markets:
```json theme={null}
{
"id": "123",
"title": "Who will win the 2024 Presidential Election?",
"negRisk": true,
"markets": [...]
}
```
When placing orders on neg risk markets, you must specify this in your order options:
```typescript theme={null}
const response = await client.createAndPostOrder(
{
tokenID: "TOKEN_ID",
price: 0.5,
size: 100,
side: Side.BUY,
},
{
tickSize: "0.01",
negRisk: true, // Required for neg risk markets
},
);
```
## Contract Addresses
Neg risk markets use different contracts than standard markets:
See [Contract Addresses](/resources/contract-addresses) for the Neg Risk Adapter and Neg Risk CTF Exchange addresses.
## Augmented Negative Risk
Standard negative risk requires the complete set of outcomes to be known at market creation. But sometimes new outcomes emerge after trading begins (e.g., a new candidate enters a race).
**Augmented negative risk** solves this with:
| Outcome Type | Description |
| ------------------------ | ------------------------------------------------------------- |
| **Named outcomes** | Known outcomes (e.g., "Trump", "Harris") |
| **Placeholder outcomes** | Reserved slots that can be clarified later (e.g., "Person A") |
| **Explicit Other** | Catches any outcome not explicitly named |
### How Placeholders Work
1. Event launches with named outcomes + placeholders + "Other"
2. When a new outcome emerges, a placeholder is clarified via the bulletin board
3. The "Other" definition narrows as placeholders are assigned
### Trading Rules for Augmented Neg Risk
<Warning>
Only trade on **named outcomes**. Placeholder outcomes should be ignored until
they are named or until resolution occurs. The Polymarket UI does not display
unnamed outcomes.
</Warning>
* If the correct outcome at resolution is not named, the market resolves to "Other"
* The "Other" outcome's definition changes as placeholders are clarified—avoid trading it directly
### Identifying Augmented Neg Risk
An event is augmented neg risk when both flags are true:
```json theme={null}
{
"enableNegRisk": true,
"negRiskAugmented": true
}
```
<Note>
The Gamma API includes a boolean field `negRisk` on events and markets, which indicates whether the event uses negative risk. For augmented neg risk events, an additional `enableNegRisk` field is also `true`. When placing orders, the SDK option is always `negRisk: true` / `neg_risk: True` regardless of whether the market is standard or augmented neg risk.
</Note>
## Technical Details
### Conversion Mechanics
The conversion operation is atomic and happens through the Neg Risk Adapter:
1. You hold 1 No token for Outcome A
2. Call the convert function on the adapter
3. You receive 1 Yes token for every other outcome in the event
## Resources
* [Neg Risk Adapter Source Code](https://github.com/Polymarket/neg-risk-ctf-adapter)
* [Gamma API Documentation](/market-data/overview)
## Next Steps
<CardGroup cols={2}>
<Card title="Markets & Events" icon="calendar" href="/concepts/markets-events">
Understand how multi-market events are structured.
</Card>
<Card title="Positions & Tokens" icon="coins" href="/concepts/positions-tokens">
Learn about token operations like split, merge, and redeem.
</Card>
</CardGroup>
+377
View File
@@ -0,0 +1,377 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Authentication
> How to authenticate requests to the CLOB API
The CLOB API uses two levels of authentication: **L1 (Private Key)** and **L2 (API Key)**. Either can be accomplished using the CLOB client or REST API.
## Public vs Authenticated
<CardGroup cols={1}>
<Card title="Public (No Auth)" icon="unlock">
The **Gamma API**, **Data API**, and CLOB read endpoints (orderbook, prices, spreads) require no authentication.
</Card>
<Card title="Authenticated (CLOB)" icon="lock">
CLOB trading endpoints (placing orders, cancellations, heartbeat) require all 5 `POLY_*` L2 HTTP headers.
</Card>
</CardGroup>
***
## Two-Level Authentication Model
The CLOB uses two levels of authentication: L1 (Private Key) and L2 (API Key). Either can be accomplished using the CLOB client or REST API
### L1 Authentication (Private Key)
L1 authentication uses the wallet's private key to sign an EIP-712 message used in the request header. It proves ownership and control over the private key. The private key stays in control of the user and all trading activity remains non-custodial.
**Used for:**
* Creating API credentials
* Deriving existing API credentials
* Signing and creating user's orders locally
### L2 Authentication (API Credentials)
L2 uses API credentials (apiKey, secret, passphrase) generated from L1 authentication. These are used solely to authenticate requests made to the CLOB API. Requests are signed using HMAC-SHA256.
**Used for:**
* Cancel or get user's open orders
* Check user's balances and allowances
* Post user's signed orders
<Info>
Even with L2 authentication headers, methods that create user orders still
require the user to sign the order payload.
</Info>
***
## Getting API Credentials
Before making authenticated requests, you need to obtain API credentials using L1 authentication.
### Using the SDK (Recommended)
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient } from "@polymarket/clob-client";
import { Wallet } from "ethers"; // v5.8.0
const client = new ClobClient(
"https://clob.polymarket.com",
137, // Polygon mainnet
new Wallet(process.env.PRIVATE_KEY)
);
// Creates new credentials or derives existing ones
const credentials = await client.createOrDeriveApiKey();
console.log(credentials);
// {
// apiKey: "550e8400-e29b-41d4-a716-446655440000",
// secret: "base64EncodedSecretString",
// passphrase: "randomPassphraseString"
// }
```
</Tab>
<Tab title="Python">
```python theme={null}
from py_clob_client.client import ClobClient
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137, # Polygon mainnet
key=os.getenv("PRIVATE_KEY")
)
# Creates new credentials or derives existing ones
credentials = client.create_or_derive_api_creds()
print(credentials)
# {
# "apiKey": "550e8400-e29b-41d4-a716-446655440000",
# "secret": "base64EncodedSecretString",
# "passphrase": "randomPassphraseString"
# }
```
</Tab>
</Tabs>
<Warning>
**Never commit private keys to version control.** Always use environment
variables or secure key management systems.
</Warning>
### Using the REST API
While we highly recommend using our provided clients to handle signing and authentication, the following is for developers who choose NOT to use our [Python](https://github.com/Polymarket/py-clob-client) or [TypeScript](https://github.com/Polymarket/clob-client) clients.
**Create API Credentials**
```bash theme={null}
POST https://clob.polymarket.com/auth/api-key
```
**Derive API Credentials**
```bash theme={null}
GET https://clob.polymarket.com/auth/derive-api-key
```
Required L1 headers:
| Header | Description |
| ---------------- | ---------------------- |
| `POLY_ADDRESS` | Polygon signer address |
| `POLY_SIGNATURE` | CLOB EIP-712 signature |
| `POLY_TIMESTAMP` | Current UNIX timestamp |
| `POLY_NONCE` | Nonce (default: 0) |
The `POLY_SIGNATURE` is generated by signing the following EIP-712 struct:
<Accordion title="EIP-712 Signing Example">
<CodeGroup>
```typescript TypeScript theme={null}
const domain = {
name: "ClobAuthDomain",
version: "1",
chainId: chainId, // Polygon Chain ID 137
};
const types = {
ClobAuth: [
{ name: "address", type: "address" },
{ name: "timestamp", type: "string" },
{ name: "nonce", type: "uint256" },
{ name: "message", type: "string" },
],
};
const value = {
address: signingAddress, // The Signing address
timestamp: ts, // The CLOB API server timestamp
nonce: nonce, // The nonce used
message: "This message attests that I control the given wallet",
};
const sig = await signer._signTypedData(domain, types, value);
```
```python Python theme={null}
domain = {
"name": "ClobAuthDomain",
"version": "1",
"chainId": chainId, # Polygon Chain ID 137
}
types = {
"ClobAuth": [
{"name": "address", "type": "address"},
{"name": "timestamp", "type": "string"},
{"name": "nonce", "type": "uint256"},
{"name": "message", "type": "string"},
]
}
value = {
"address": signingAddress, # The signing address
"timestamp": ts, # The CLOB API server timestamp
"nonce": nonce, # The nonce used
"message": "This message attests that I control the given wallet",
}
sig = signer.sign_typed_data(domain, types, value)
```
</CodeGroup>
</Accordion>
Reference implementations:
* [TypeScript](https://github.com/Polymarket/clob-client/blob/main/src/signing/eip712.ts)
* [Python](https://github.com/Polymarket/py-clob-client/blob/main/py_clob_client/signing/eip712.py)
Response:
```json theme={null}
{
"apiKey": "550e8400-e29b-41d4-a716-446655440000",
"secret": "base64EncodedSecretString",
"passphrase": "randomPassphraseString"
}
```
**You'll need all three values for L2 authentication.**
***
## L2 Authentication Headers
All trading endpoints require these 5 headers:
| Header | Description |
| ----------------- | ----------------------------- |
| `POLY_ADDRESS` | Polygon signer address |
| `POLY_SIGNATURE` | HMAC signature for request |
| `POLY_TIMESTAMP` | Current UNIX timestamp |
| `POLY_API_KEY` | User's API `apiKey` value |
| `POLY_PASSPHRASE` | User's API `passphrase` value |
The `POLY_SIGNATURE` for L2 is an HMAC-SHA256 signature created using the user's API credentials `secret` value. Reference implementations can be found in the [TypeScript](https://github.com/Polymarket/clob-client/blob/main/src/signing/hmac.ts) and [Python](https://github.com/Polymarket/py-clob-client/blob/main/py_clob_client/signing/hmac.py) clients.
### CLOB Client (L2)
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
import { ClobClient } from "@polymarket/clob-client";
import { Wallet } from "ethers"; // v5.8.0
const client = new ClobClient(
"https://clob.polymarket.com",
137,
new Wallet(process.env.PRIVATE_KEY),
apiCreds, // Generated from L1 auth, API credentials enable L2 methods
1, // signatureType explained below
funderAddress // funder explained below
);
// Now you can trade!
const order = await client.createAndPostOrder(
{ tokenID: "123456", price: 0.65, size: 100, side: "BUY" },
{ tickSize: "0.01", negRisk: false }
);
```
</Tab>
<Tab title="Python">
```python theme={null}
from py_clob_client.client import ClobClient
import os
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137,
key=os.getenv("PRIVATE_KEY"),
creds=api_creds, # Generated from L1 auth, API credentials enable L2 methods
signature_type=1, # signatureType explained below
funder=os.getenv("FUNDER_ADDRESS") # funder explained below
)
# Now you can trade!
order = client.create_and_post_order(
{"token_id": "123456", "price": 0.65, "size": 100, "side": "BUY"},
{"tick_size": "0.01", "neg_risk": False}
)
```
</Tab>
</Tabs>
<Info>
Even with L2 authentication headers, methods that create user orders still
require the user to sign the order payload.
</Info>
***
## Signature Types and Funder
When initializing the L2 client, you must specify your wallet **signatureType** and the **funder** address which holds the funds:
| Signature Type | Value | Description |
| -------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| EOA | `0` | Standard Ethereum wallet (MetaMask). Funder is the EOA address and will need POL to pay gas on transactions. |
| POLY\_PROXY | `1` | A custom proxy wallet only used with users who logged in via Magic Link email/Google. Using this requires the user to have exported their PK from Polymarket.com and imported into your app. |
| GNOSIS\_SAFE | `2` | Gnosis Safe multisig proxy wallet (most common). Use this for any new or returning user who does not fit the other 2 types. |
<Tip>
The wallet address displayed to the user on Polymarket.com is the proxy wallet
and should be used as the funder. These can be deterministically derived or
you can deploy them on behalf of the user. These proxy wallets are
automatically deployed for the user on their first login to Polymarket.com.
</Tip>
***
## Security Best Practices
<AccordionGroup>
<Accordion title="Never expose private keys">
Store private keys in environment variables or secure key management systems. Never commit them to version control.
```bash theme={null}
# .env (never commit this file)
PRIVATE_KEY=0x...
```
</Accordion>
<Accordion title="Implement request signing on the server">
Never expose your API secret in client-side code. All authenticated requests should originate from your backend.
</Accordion>
</AccordionGroup>
***
## Troubleshooting
<AccordionGroup>
<Accordion title="Error: INVALID_SIGNATURE">
Your wallet's private key is incorrect or improperly formatted.
**Solutions:**
* Verify your private key is a valid hex string (starts with "0x")
* Ensure you're using the correct key for the intended address
* Check that the key has proper permissions
</Accordion>
<Accordion title="Error: NONCE_ALREADY_USED">
The nonce you provided has already been used to create an API key.
**Solutions:**
* Use `deriveApiKey()` with the same nonce to retrieve existing credentials
* Or use a different nonce with `createApiKey()`
</Accordion>
<Accordion title="Error: Invalid Funder Address">
Your funder address is incorrect or doesn't match your wallet.
**Solution:** Check your Polymarket profile address at [polymarket.com/settings](https://polymarket.com/settings).
If it does not exist or user has never logged into Polymarket.com, deploy it first before creating L2 authentication.
</Accordion>
<Accordion title="Lost both credentials and nonce">
Unfortunately, there's no way to recover lost API credentials without the nonce. You'll need to create new credentials:
```typescript theme={null}
// Create fresh credentials with a new nonce
const newCreds = await client.createApiKey();
// Save the nonce this time!
```
</Accordion>
</AccordionGroup>
***
## Next Steps
<CardGroup cols={2}>
<Card title="Place Your First Order" icon="plus" href="/trading/quickstart">
Learn how to create and submit orders.
</Card>
<Card title="Geographic Restrictions" icon="globe" href="/api-reference/geoblock">
Check trading availability by region.
</Card>
</CardGroup>
@@ -4,35 +4,16 @@
# Create deposit addresses
> Generate unique deposit addresses for depositing assets to your Polymarket wallet.
**How it works:**
1. Submit your Polymarket wallet address
2. Receive deposit addresses for each blockchain type (EVM, Solana, Bitcoin)
3. Send assets from any supported chain to the appropriate deposit address
4. Assets are automatically bridged and swapped to USDC.e on Polygon
5. USDC.e is credited to your Polymarket wallet for trading
**Supported Assets:**
Use `/supported-assets` to see all available chains and tokens you can deposit from.
## OpenAPI
````yaml api-reference/bridge-api-openapi.yaml post /deposit
````yaml api-spec/bridge-openapi.yaml post /deposit
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: >
HTTP API for Polymarket bridge and swap operations.
Polymarket uses USDC.e (Bridged USDC) on Polygon as collateral for all
trading activities. This API enables users to bridge assets from various
chains and swap them to USDC.e on Polygon for seamless trading.
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
@@ -46,30 +27,6 @@ paths:
tags:
- Bridge
summary: Create deposit addresses
description: >
Generate unique deposit addresses for depositing assets to your
Polymarket wallet.
**How it works:**
1. Submit your Polymarket wallet address
2. Receive deposit addresses for each blockchain type (EVM, Solana,
Bitcoin)
3. Send assets from any supported chain to the appropriate deposit
address
4. Assets are automatically bridged and swapped to USDC.e on Polygon
5. USDC.e is credited to your Polymarket wallet for trading
**Supported Assets:**
Use `/supported-assets` to see all available chains and tokens you can
deposit from.
requestBody:
required: true
content:
@@ -149,4 +106,4 @@ components:
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
````
@@ -4,39 +4,16 @@
# Create withdrawal addresses
> Generate unique deposit addresses for withdrawing USDC.e from your Polymarket wallet to any supported chain and token.
<Card>
**⚠️ Important:** Do not pre-generate withdrawal addresses. Only generate them when you are ready to execute the withdrawal. Each address is configured for a specific destination.
</Card>
**How it works:**
1. Specify your Polymarket wallet address, destination chain, token, and recipient address
2. Receive deposit addresses for each blockchain type (EVM, Solana, Bitcoin)
3. Send USDC.e from your Polymarket wallet to the appropriate deposit address
4. Funds are automatically bridged and swapped to your desired token
5. Funds arrive at your destination wallet
**Supported Destinations:**
Use `/supported-assets` to see all available chains and tokens you can withdraw to.
## OpenAPI
````yaml api-reference/bridge-api-openapi.yaml post /withdraw
````yaml api-spec/bridge-openapi.yaml post /withdraw
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: >
HTTP API for Polymarket bridge and swap operations.
Polymarket uses USDC.e (Bridged USDC) on Polygon as collateral for all
trading activities. This API enables users to bridge assets from various
chains and swap them to USDC.e on Polygon for seamless trading.
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
@@ -50,40 +27,6 @@ paths:
tags:
- Bridge
summary: Create withdrawal addresses
description: >
Generate unique deposit addresses for withdrawing USDC.e from your
Polymarket wallet to any supported chain and token.
<Card>
**⚠️ Important:** Do not pre-generate withdrawal addresses. Only
generate them when you are ready to execute the withdrawal. Each address
is configured for a specific destination.
</Card>
**How it works:**
1. Specify your Polymarket wallet address, destination chain, token, and
recipient address
2. Receive deposit addresses for each blockchain type (EVM, Solana,
Bitcoin)
3. Send USDC.e from your Polymarket wallet to the appropriate deposit
address
4. Funds are automatically bridged and swapped to your desired token
5. Funds arrive at your destination wallet
**Supported Destinations:**
Use `/supported-assets` to see all available chains and tokens you can
withdraw to.
requestBody:
required: true
content:
@@ -189,4 +132,4 @@ components:
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
````
+3 -42
View File
@@ -4,34 +4,16 @@
# Get a quote
> Get an estimated quote for a deposit or withdrawal, including output amounts, checkout time, and a detailed fee breakdown.
**Use Cases:**
- Preview fees and estimated output before executing a deposit or withdrawal
- Compare costs across different token/chain combinations
- Get the `quoteId` to reference this specific quote
**Notes:**
- Quotes are estimates and actual amounts may vary slightly due to market conditions
- See `/supported-assets` for a list of all supported chains and tokens
## OpenAPI
````yaml api-reference/bridge-api-openapi.yaml post /quote
````yaml api-spec/bridge-openapi.yaml post /quote
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: >
HTTP API for Polymarket bridge and swap operations.
Polymarket uses USDC.e (Bridged USDC) on Polygon as collateral for all
trading activities. This API enables users to bridge assets from various
chains and swap them to USDC.e on Polygon for seamless trading.
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
@@ -45,27 +27,6 @@ paths:
tags:
- Bridge
summary: Get a quote
description: >
Get an estimated quote for a deposit or withdrawal, including output
amounts, checkout time, and a detailed fee breakdown.
**Use Cases:**
- Preview fees and estimated output before executing a deposit or
withdrawal
- Compare costs across different token/chain combinations
- Get the `quoteId` to reference this specific quote
**Notes:**
- Quotes are estimates and actual amounts may vary slightly due to
market conditions
- See `/supported-assets` for a list of all supported chains and tokens
requestBody:
required: true
content:
@@ -260,4 +221,4 @@ components:
description: Impact cost of the transaction
example: 0
````
````
@@ -4,31 +4,16 @@
# Get supported assets
> Retrieve all supported chains and tokens for deposits and withdrawals.
**USDC.e on Polygon:**
Polymarket uses USDC.e (Bridged USDC from Ethereum) on Polygon as the native collateral for all markets. When you deposit assets from other chains, they are automatically bridged and swapped to USDC.e on Polygon. When you withdraw, your USDC.e is bridged and swapped to your desired token on the destination chain.
**Minimum Amounts:**
Each asset has a `minCheckoutUsd` field indicating the minimum amount required in USD. Make sure your deposit or withdrawal meets this minimum to avoid transaction failures.
## OpenAPI
````yaml api-reference/bridge-api-openapi.yaml get /supported-assets
````yaml api-spec/bridge-openapi.yaml get /supported-assets
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: >
HTTP API for Polymarket bridge and swap operations.
Polymarket uses USDC.e (Bridged USDC) on Polygon as collateral for all
trading activities. This API enables users to bridge assets from various
chains and swap them to USDC.e on Polygon for seamless trading.
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
@@ -42,24 +27,6 @@ paths:
tags:
- Bridge
summary: Get supported assets
description: >
Retrieve all supported chains and tokens for deposits and withdrawals.
**USDC.e on Polygon:**
Polymarket uses USDC.e (Bridged USDC from Ethereum) on Polygon as the
native collateral for all markets. When you deposit assets from other
chains, they are automatically bridged and swapped to USDC.e on Polygon.
When you withdraw, your USDC.e is bridged and swapped to your desired
token on the destination chain.
**Minimum Amounts:**
Each asset has a `minCheckoutUsd` field indicating the minimum amount
required in USD. Make sure your deposit or withdrawal meets this minimum
to avoid transaction failures.
responses:
'200':
description: Successfully retrieved supported assets
@@ -129,4 +96,4 @@ components:
description: Token decimals
example: 6
````
````
@@ -4,41 +4,16 @@
# Get transaction status
> Get the transaction status for all deposits and withdrawals associated with a given address.
**Usage:**
- Use the deposit address returned from the `/deposit` or `/withdraw` endpoint (EVM, SVM, or BTC address)
- Poll this endpoint to track the progress of your deposits and withdrawals
**Status Values:**
- `DEPOSIT_DETECTED`: Funds detected but not yet processing
- `PROCESSING`: Transaction is being routed and swapped
- `ORIGIN_TX_CONFIRMED`: Origin transaction has been confirmed on source chain
- `SUBMITTED`: Transaction has been submitted to destination chain
- `COMPLETED`: Transaction completed successfully
- `FAILED`: Transaction encountered an error and did not complete
**Notes:**
- Transactions typically complete within a few minutes, but may take longer depending on network conditions
- An empty transactions array means no transactions have been made to this address yet
## OpenAPI
````yaml api-reference/bridge-api-openapi.yaml get /status/{address}
````yaml api-spec/bridge-openapi.yaml get /status/{address}
openapi: 3.0.3
info:
title: Polymarket Bridge API
version: 1.0.0
description: >
HTTP API for Polymarket bridge and swap operations.
Polymarket uses USDC.e (Bridged USDC) on Polygon as collateral for all
trading activities. This API enables users to bridge assets from various
chains and swap them to USDC.e on Polygon for seamless trading.
description: HTTP API for Polymarket bridge and swap operations.
servers:
- url: https://bridge.polymarket.com
description: Polymarket Bridge API
@@ -52,43 +27,6 @@ paths:
tags:
- Bridge
summary: Get transaction status
description: >
Get the transaction status for all deposits and withdrawals associated
with a given address.
**Usage:**
- Use the deposit address returned from the `/deposit` or `/withdraw`
endpoint (EVM, SVM, or BTC address)
- Poll this endpoint to track the progress of your deposits and
withdrawals
**Status Values:**
- `DEPOSIT_DETECTED`: Funds detected but not yet processing
- `PROCESSING`: Transaction is being routed and swapped
- `ORIGIN_TX_CONFIRMED`: Origin transaction has been confirmed on source
chain
- `SUBMITTED`: Transaction has been submitted to destination chain
- `COMPLETED`: Transaction completed successfully
- `FAILED`: Transaction encountered an error and did not complete
**Notes:**
- Transactions typically complete within a few minutes, but may take
longer depending on network conditions
- An empty transactions array means no transactions have been made to
this address yet
parameters:
- name: address
in: path
@@ -209,4 +147,4 @@ components:
when status is DEPOSIT_DETECTED)
example: 1757531217339
````
````
@@ -4,13 +4,11 @@
# Get aggregated builder leaderboard
> Returns aggregated builder rankings with one entry per builder showing total for the specified time period. Supports pagination.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /v1/builders/leaderboard
````yaml api-spec/data-openapi.yaml get /v1/builders/leaderboard
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,9 +32,6 @@ paths:
tags:
- Builders
summary: Get aggregated builder leaderboard
description: >-
Returns aggregated builder rankings with one entry per builder showing
total for the specified time period. Supports pagination.
parameters:
- in: query
name: timePeriod
@@ -118,4 +113,4 @@ components:
required:
- error
````
````
@@ -4,13 +4,11 @@
# Get daily builder volume time-series
> Returns daily time-series volume data with multiple entries per builder (one per day), each including a `dt` timestamp. No pagination.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /v1/builders/volume
````yaml api-spec/data-openapi.yaml get /v1/builders/volume
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,9 +32,6 @@ paths:
tags:
- Builders
summary: Get daily builder volume time-series
description: >-
Returns daily time-series volume data with multiple entries per builder
(one per day), each including a `dt` timestamp. No pagination.
parameters:
- in: query
name: timePeriod
@@ -107,4 +102,4 @@ components:
required:
- error
````
````
+97
View File
@@ -0,0 +1,97 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Clients & SDKs
> Official open-source libraries for interacting with Polymarket
Polymarket provides official open-source clients in TypeScript, Python, and Rust. All three support the full CLOB API including market data, order management, and authentication.
## Installation
<CodeGroup>
```bash TypeScript theme={null}
npm install @polymarket/clob-client ethers@5
```
```bash Python theme={null}
pip install py-clob-client
```
```bash Rust theme={null}
cargo add polymarket-client-sdk
```
</CodeGroup>
## Quick Example
<CodeGroup>
```typescript TypeScript theme={null}
import { ClobClient } from "@polymarket/clob-client";
const client = new ClobClient(
"https://clob.polymarket.com",
137,
signer,
apiCreds,
);
const markets = await client.getMarkets();
```
```python Python theme={null}
from py_clob_client.client import ClobClient
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain_id=137,
creds=api_creds,
)
markets = client.get_markets()
```
</CodeGroup>
## Source Code
| Language | Package | Repository |
| ---------- | ------------------------- | ------------------------------------------------------------------------------------ |
| TypeScript | `@polymarket/clob-client` | [github.com/Polymarket/clob-client](https://github.com/Polymarket/clob-client) |
| Python | `py-clob-client` | [github.com/Polymarket/py-clob-client](https://github.com/Polymarket/py-clob-client) |
| Rust | `polymarket-client-sdk` | [github.com/Polymarket/rs-clob-client](https://github.com/Polymarket/rs-clob-client) |
Each repository includes working examples in the `/examples` directory.
## Builder SDKs
If you're building an app through the [Builder Program](/builders/overview), additional signing SDKs are available:
| Language | Package | Repository |
| ---------- | --------------------------------- | ---------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-signing-sdk` | [github.com/Polymarket/builder-signing-sdk](https://github.com/Polymarket/builder-signing-sdk) |
| Python | `py_builder_signing_sdk` | [github.com/Polymarket/py-builder-signing-sdk](https://github.com/Polymarket/py-builder-signing-sdk) |
See [Order Attribution](/trading/orders/attribution) for usage details.
## Relayer SDK
For [gasless transactions](/trading/gasless) using proxy wallets, the relayer client handles submitting transactions through Polymarket's relayer:
| Language | Package | Repository |
| ---------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-relayer-client` | [github.com/Polymarket/builder-relayer-client](https://github.com/Polymarket/builder-relayer-client) |
| Python | `py-builder-relayer-client` | [github.com/Polymarket/py-builder-relayer-client](https://github.com/Polymarket/py-builder-relayer-client) |
## Next Steps
<CardGroup cols={2}>
<Card title="Quickstart" icon="rocket" href="/quickstart">
Set up your client and place your first order.
</Card>
<Card title="Authentication" icon="lock" href="/api-reference/authentication">
Understand L1/L2 auth and API credentials.
</Card>
</CardGroup>
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /comments/{id}
````yaml api-spec/gamma-openapi.yaml get /comments/{id}
openapi: 3.0.3
info:
title: Markets API
@@ -209,4 +209,4 @@ components:
type: string
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /comments/user_address/{user_address}
````yaml api-spec/gamma-openapi.yaml get /comments/user_address/{user_address}
openapi: 3.0.3
info:
title: Markets API
@@ -234,4 +234,4 @@ components:
type: string
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /comments
````yaml api-spec/gamma-openapi.yaml get /comments
openapi: 3.0.3
info:
title: Markets API
@@ -248,4 +248,4 @@ components:
type: string
nullable: true
````
````
@@ -4,13 +4,11 @@
# Get closed positions for a user
> Fetches closed positions for a user(address)
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /closed-positions
````yaml api-spec/data-openapi.yaml get /closed-positions
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,7 +32,6 @@ paths:
tags:
- Core
summary: Get closed positions for a user
description: Fetches closed positions for a user(address)
parameters:
- in: query
name: user
@@ -194,4 +191,4 @@ components:
required:
- error
````
````
@@ -4,13 +4,11 @@
# Get current positions for a user
> Returns positions filtered by user and optional filters.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /positions
````yaml api-spec/data-openapi.yaml get /positions
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,7 +32,6 @@ paths:
tags:
- Core
summary: Get current positions for a user
description: Returns positions filtered by user and optional filters.
parameters:
- in: query
name: user
@@ -221,4 +218,4 @@ components:
required:
- error
````
````
@@ -4,14 +4,11 @@
# Get positions for a market
> Returns positions for a given market (condition_id), grouped by outcome token, with profile data, PnL breakdown, and current pricing.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /v1/market-positions
````yaml api-spec/data-openapi.yaml get /v1/market-positions
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -35,9 +32,6 @@ paths:
tags:
- Core
summary: Get positions for a market
description: >
Returns positions for a given market (condition_id), grouped by outcome
token, with profile data, PnL breakdown, and current pricing.
parameters:
- in: query
name: market
@@ -196,4 +190,4 @@ components:
outcomeIndex:
type: integer
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /holders
````yaml api-spec/data-openapi.yaml get /holders
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -137,4 +137,4 @@ components:
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x56687bf447db6ffa42ffe2204a05edaa20f55839'
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /value
````yaml api-spec/data-openapi.yaml get /value
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -94,4 +94,4 @@ components:
required:
- error
````
````
@@ -4,13 +4,11 @@
# Get trader leaderboard rankings
> Returns trader leaderboard rankings filtered by category, time period, and ordering.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /v1/leaderboard
````yaml api-spec/data-openapi.yaml get /v1/leaderboard
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,9 +32,6 @@ paths:
tags:
- Core
summary: Get trader leaderboard rankings
description: >-
Returns trader leaderboard rankings filtered by category, time period,
and ordering.
parameters:
- in: query
name: category
@@ -163,4 +158,4 @@ components:
required:
- error
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /trades
````yaml api-spec/data-openapi.yaml get /trades
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -190,4 +190,4 @@ components:
required:
- error
````
````
+2 -5
View File
@@ -4,13 +4,11 @@
# Get user activity
> Returns on-chain activity for a user.
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /activity
````yaml api-spec/data-openapi.yaml get /activity
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -34,7 +32,6 @@ paths:
tags:
- Core
summary: Get user activity
description: Returns on-chain activity for a user.
parameters:
- in: query
name: limit
@@ -230,4 +227,4 @@ components:
required:
- error
````
````
@@ -1,52 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Data API Health check
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /
openapi: 3.0.3
info:
title: Polymarket Data API
version: 1.0.0
description: >
HTTP API for Polymarket data. This specification documents all public
routes.
servers:
- url: https://data-api.polymarket.com
description: Relative server (same host)
security: []
tags:
- name: Data API Status
description: Data API health check
- name: Core
- name: Builders
- name: Misc
paths:
/:
get:
tags:
- Data API Status
summary: Data API Health check
operationId: getDataApiHealth
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/HealthResponse'
components:
schemas:
HealthResponse:
type: object
properties:
data:
type: string
example: OK
````
null
@@ -0,0 +1,79 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get server time
> Returns the current Unix timestamp of the server.
This can be used to synchronize client time with server time.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /time
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/time:
get:
tags:
- Data
summary: Get server time
description: |
Returns the current Unix timestamp of the server.
This can be used to synchronize client time with server time.
operationId: getTime
responses:
'200':
description: Successfully retrieved server time
content:
application/json:
schema:
type: integer
format: int64
description: Unix timestamp (seconds since epoch)
example: 1234567890
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /events/{id}
````yaml api-spec/gamma-openapi.yaml get /events/{id}
openapi: 3.0.3
info:
title: Markets API
@@ -1190,4 +1190,4 @@ components:
type: string
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /events/slug/{slug}
````yaml api-spec/gamma-openapi.yaml get /events/slug/{slug}
openapi: 3.0.3
info:
title: Markets API
@@ -1190,4 +1190,4 @@ components:
type: string
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /events/{id}/tags
````yaml api-spec/gamma-openapi.yaml get /events/{id}/tags
openapi: 3.0.3
info:
title: Markets API
@@ -105,4 +105,4 @@ components:
type: boolean
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /events
````yaml api-spec/gamma-openapi.yaml get /events
openapi: 3.0.3
info:
title: Markets API
@@ -1300,4 +1300,4 @@ components:
type: string
nullable: true
````
````
@@ -1,56 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Gamma API Health check
## OpenAPI
````yaml api-reference/gamma-openapi.json get /status
openapi: 3.0.3
info:
title: Markets API
version: 1.0.0
description: REST API specification for public endpoints used by the Markets service.
servers:
- url: https://gamma-api.polymarket.com
description: Polymarket Gamma API Production Server
security: []
tags:
- name: Gamma Status
description: Gamma API status and health check
- name: Sports
description: Sports-related endpoints including teams and game data
- name: Tags
description: Tag management and related tag operations
- name: Events
description: Event management and event-related operations
- name: Markets
description: Market data and market-related operations
- name: Comments
description: Comment system and user interactions
- name: Series
description: Series management and related operations
- name: Profiles
description: User profile management
- name: Search
description: Search functionality across different entity types
paths:
/status:
get:
tags:
- Gamma Status
summary: Gamma API Health check
operationId: getGammaStatus
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
example: OK
````
null
+193
View File
@@ -0,0 +1,193 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Geographic Restrictions
> Check geographic restrictions before placing orders on the Polymarket API
Polymarket restricts order placement from certain geographic locations due to regulatory requirements and compliance with international sanctions. Before placing orders, builders should verify the location.
<Warning>
Orders submitted from blocked regions will be rejected. Implement geoblock
checks in your application to provide users with appropriate feedback before
they attempt to trade.
</Warning>
***
## Geoblock Endpoint
Check the geographic eligibility of the requesting IP address:
```bash theme={null}
GET https://polymarket.com/api/geoblock
```
<Note>This endpoint is on `polymarket.com`, not the API servers.</Note>
### Response
```json theme={null}
{
"blocked": true,
"ip": "203.0.113.42",
"country": "US",
"region": "NY"
}
```
| Field | Type | Description |
| --------- | ------- | ----------------------------------------------- |
| `blocked` | boolean | Whether the user is blocked from placing orders |
| `ip` | string | Detected IP address |
| `country` | string | ISO 3166-1 alpha-2 country code |
| `region` | string | Region/state code |
***
## Blocked Countries
The following countries are restricted from placing orders on Polymarket. Countries marked as **close-only** can close existing positions but cannot open new ones:
| Country Code | Country Name | Status |
| ------------ | ------------------------------------ | ---------- |
| AU | Australia | Blocked |
| BE | Belgium | Blocked |
| BY | Belarus | Blocked |
| BI | Burundi | Blocked |
| CF | Central African Republic | Blocked |
| CD | Congo (Kinshasa) | Blocked |
| CU | Cuba | Blocked |
| DE | Germany | Blocked |
| ET | Ethiopia | Blocked |
| FR | France | Blocked |
| GB | United Kingdom | Blocked |
| IR | Iran | Blocked |
| IQ | Iraq | Blocked |
| IT | Italy | Blocked |
| KP | North Korea | Blocked |
| LB | Lebanon | Blocked |
| LY | Libya | Blocked |
| MM | Myanmar | Blocked |
| NI | Nicaragua | Blocked |
| PL | Poland | Close-only |
| RU | Russia | Blocked |
| SG | Singapore | Close-only |
| SO | Somalia | Blocked |
| SS | South Sudan | Blocked |
| SD | Sudan | Blocked |
| SY | Syria | Blocked |
| TH | Thailand | Close-only |
| TW | Taiwan | Close-only |
| UM | United States Minor Outlying Islands | Blocked |
| US | United States | Blocked |
| VE | Venezuela | Blocked |
| YE | Yemen | Blocked |
| ZW | Zimbabwe | Blocked |
***
## Blocked Regions
In addition to fully blocked countries, the following specific regions within otherwise accessible countries are also restricted:
| Country | Region | Region Code |
| ------------ | ------- | ----------- |
| Canada (CA) | Ontario | ON |
| Ukraine (UA) | Crimea | 43 |
| Ukraine (UA) | Donetsk | 14 |
| Ukraine (UA) | Luhansk | 09 |
***
## Blocking Logic
The geoblocking system includes:
1. **OFAC-Sanctioned Countries**: Countries sanctioned by the U.S. Office of Foreign Assets Control (OFAC)
2. **Additional Regulatory Restrictions**: Countries added for specific regulatory compliance reasons
***
## Server Infrastructure
* **Primary Servers**: eu-west-2
* **Closest Non-Georestricted Region**: eu-west-1
***
## Usage Examples
<Tabs>
<Tab title="TypeScript">
```typescript theme={null}
interface GeoblockResponse {
blocked: boolean;
ip: string;
country: string;
region: string;
}
async function checkGeoblock(): Promise<GeoblockResponse> {
const response = await fetch("https://polymarket.com/api/geoblock");
return response.json();
}
// Usage
const geo = await checkGeoblock();
if (geo.blocked) {
console.log(`Trading not available in ${geo.country}`);
} else {
console.log("Trading available");
}
```
</Tab>
<Tab title="Python">
```python theme={null}
import requests
def check_geoblock() -> dict:
response = requests.get("https://polymarket.com/api/geoblock")
return response.json()
# Usage
geo = check_geoblock()
if geo["blocked"]:
print(f"Trading not available in {geo['country']}")
else:
print("Trading available")
```
</Tab>
</Tabs>
***
## Why These Restrictions?
Geographic restrictions are implemented to ensure compliance with:
* International sanctions and embargoes
* Local financial regulations
* Gambling and prediction market laws
* Anti-money laundering (AML) requirements
* Know Your Customer (KYC) regulations
If you believe you are incorrectly restricted or have questions about geographic availability, please contact [Polymarket Support](https://polymarket.com/support).
***
## Next Steps
<CardGroup cols={2}>
<Card title="Authentication" icon="key" href="/api-reference/authentication">
Learn how to authenticate trading requests.
</Card>
<Card title="Place Orders" icon="plus" href="/trading/quickstart">
Start placing orders (from eligible regions).
</Card>
</CardGroup>
+59
View File
@@ -0,0 +1,59 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Introduction
> Overview of the Polymarket APIs
The Polymarket API provides programmatic access to the world's largest prediction market. The platform is served by three separate APIs, each handling a different domain.
***
## APIs
<CardGroup cols={1}>
<Card title="Gamma API" icon="database">
**`https://gamma-api.polymarket.com`**
Markets, events, tags, series, comments, sports, search, and public profiles. This is the primary API for discovering and browsing market data.
</Card>
<Card title="Data API" icon="chart-line">
**`https://data-api.polymarket.com`**
User positions, trades, activity, holder data, open interest, leaderboards, and builder analytics.
</Card>
<Card title="CLOB API" icon="arrows-rotate">
**`https://clob.polymarket.com`**
Orderbook data, pricing, midpoints, spreads, and price history. Also handles order placement, cancellation, and other trading operations. Trading endpoints require [authentication](/api-reference/authentication).
</Card>
</CardGroup>
<Info>
A separate **Bridge API** (`https://bridge.polymarket.com`) handles deposits and withdrawals. Bridges are not handled by Polymarket, it is a proxy of fun.xyz service.
</Info>
***
## Authentication
The Gamma API and Data API are fully public — no authentication required.
The CLOB API has both public endpoints (orderbook, prices) and authenticated endpoints (order management). See [Authentication](/api-reference/authentication) for details.
***
## Next Steps
<CardGroup cols={2}>
<Card title="Authentication" icon="key" href="/api-reference/authentication">
Learn how to authenticate requests for trading endpoints.
</Card>
<Card title="Clients & SDKs" icon="cube" href="/api-reference/clients-sdks">
Official TypeScript, Python, and Rust libraries.
</Card>
</CardGroup>
@@ -0,0 +1,113 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get fee rate by path parameter
> Retrieves the base fee rate for a specific token ID using the token ID as a path parameter.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /fee-rate/{token_id}
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/fee-rate/{token_id}:
get:
tags:
- Market Data
summary: Get fee rate by path parameter
description: >
Retrieves the base fee rate for a specific token ID using the token ID
as a path parameter.
operationId: getFeeRateByPath
parameters:
- name: token_id
in: path
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved fee rate
content:
application/json:
schema:
$ref: '#/components/schemas/FeeRate'
example:
base_fee: 30
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Fee rate not found for market
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: fee rate not found for market
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
FeeRate:
type: object
required:
- base_fee
properties:
base_fee:
type: integer
format: int64
description: Base fee in basis points
example: 30
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,116 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get fee rate
> Retrieves the base fee rate for a specific token ID.
The fee rate can be provided either as a query parameter or as a path parameter.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /fee-rate
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/fee-rate:
get:
tags:
- Market Data
summary: Get fee rate
description: >
Retrieves the base fee rate for a specific token ID.
The fee rate can be provided either as a query parameter or as a path
parameter.
operationId: getFeeRate
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: false
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved fee rate
content:
application/json:
schema:
$ref: '#/components/schemas/FeeRate'
example:
base_fee: 30
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Fee rate not found for market
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: fee rate not found for market
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
FeeRate:
type: object
required:
- base_fee
properties:
base_fee:
type: integer
format: int64
description: Base fee in basis points
example: 30
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,112 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade price
> Retrieves the last trade price and side for a specific token ID.
Returns default values of "0.5" for price and empty string for side if no trades found.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /last-trade-price
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/last-trade-price:
get:
tags:
- Market Data
summary: Get last trade price
description: >
Retrieves the last trade price and side for a specific token ID.
Returns default values of "0.5" for price and empty string for side if
no trades found.
operationId: getLastTradePrice
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved last trade price
content:
application/json:
schema:
type: object
required:
- price
- side
properties:
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
- ''
example: BUY
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,132 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade prices (query parameters)
> Retrieves last trade prices for multiple token IDs using query parameters.
Maximum 500 token IDs can be requested per call.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /last-trades-prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/last-trades-prices:
get:
tags:
- Market Data
summary: Get last trade prices (query parameters)
description: >
Retrieves last trade prices for multiple token IDs using query
parameters.
Maximum 500 token IDs can be requested per call.
operationId: getLastTradesPricesGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs (max 500)
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
responses:
'200':
description: Successfully retrieved last trade prices
content:
application/json:
schema:
type: array
items:
type: object
required:
- token_id
- price
- side
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
example: BUY
example:
- token_id: 0xabc123def456...
price: '0.45'
side: BUY
- token_id: 0xdef456abc123...
price: '0.52'
side: SELL
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
exceeds_limit:
summary: Payload exceeds limit
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,149 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get last trade prices (request body)
> Retrieves last trade prices for multiple token IDs using a request body.
Maximum 500 token IDs can be requested per call.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /last-trades-prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/last-trades-prices:
post:
tags:
- Market Data
summary: Get last trade prices (request body)
description: |
Retrieves last trade prices for multiple token IDs using a request body.
Maximum 500 token IDs can be requested per call.
operationId: getLastTradesPricesPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved last trade prices
content:
application/json:
schema:
type: array
items:
type: object
required:
- token_id
- price
- side
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
price:
type: string
description: Last trade price
example: '0.45'
side:
type: string
description: Last trade side (BUY or SELL)
enum:
- BUY
- SELL
example: BUY
example:
- token_id: 0xabc123def456...
price: '0.45'
side: BUY
- token_id: 0xdef456abc123...
price: '0.52'
side: SELL
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
exceeds_limit:
summary: Payload exceeds limit
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,131 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market price
> Retrieves the best market price for a specific token ID and side (bid or ask).
Returns the best bid price for BUY side or best ask price for SELL side.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /price
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/price:
get:
tags:
- Market Data
summary: Get market price
description: >
Retrieves the best market price for a specific token ID and side (bid or
ask).
Returns the best bid price for BUY side or best ask price for SELL side.
operationId: getPrice
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
- name: side
in: query
description: Order side
required: true
schema:
type: string
enum:
- BUY
- SELL
example: BUY
responses:
'200':
description: Successfully retrieved market price
content:
application/json:
schema:
type: object
required:
- price
properties:
price:
type: number
format: double
description: Market price as a decimal number
example: 0.45
example:
price: 0.45
'400':
description: Bad request - Invalid token id or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_token_id:
summary: Invalid token id
value:
error: Invalid token id
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,128 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market prices (query parameters)
> Retrieves market prices for multiple token IDs and sides using query parameters.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/prices:
get:
tags:
- Market Data
summary: Get market prices (query parameters)
description: >
Retrieves market prices for multiple token IDs and sides using query
parameters.
operationId: getPricesGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
- name: sides
in: query
description: >-
Comma-separated list of sides (BUY or SELL) corresponding to token
IDs
required: true
schema:
type: string
example: BUY,SELL
responses:
'200':
description: Successfully retrieved market prices
content:
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
type: number
format: double
description: Map of token ID to map of side to price
example:
0xabc123def456...:
BUY: 0.45
0xdef456abc123...:
SELL: 0.52
'400':
description: Bad request - Invalid payload or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,143 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market prices (request body)
> Retrieves market prices for multiple token IDs and sides using a request body.
Each request must include both token_id and side.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /prices
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/prices:
post:
tags:
- Market Data
summary: Get market prices (request body)
description: >
Retrieves market prices for multiple token IDs and sides using a request
body.
Each request must include both token_id and side.
operationId: getPricesPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
side: BUY
- token_id: 0xdef456abc123...
side: SELL
responses:
'200':
description: Successfully retrieved market prices
content:
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
type: number
format: double
description: Map of token ID to map of side to price
example:
0xabc123def456...:
BUY: 0.45
0xdef456abc123...:
SELL: 0.52
'400':
description: Bad request - Invalid payload or side
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid payload
value:
error: Invalid payload
invalid_side:
summary: Invalid side
value:
error: Invalid side
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1 @@
null
@@ -0,0 +1,102 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get midpoint prices (query parameters)
> Retrieves midpoint prices for multiple token IDs using query parameters.
The midpoint is calculated as the average of the best bid and best ask prices.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /midpoints
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/midpoints:
get:
tags:
- Market Data
summary: Get midpoint prices (query parameters)
description: >
Retrieves midpoint prices for multiple token IDs using query parameters.
The midpoint is calculated as the average of the best bid and best ask
prices.
operationId: getMidpointsGet
parameters:
- name: token_ids
in: query
description: Comma-separated list of token IDs
required: true
schema:
type: string
example: 0xabc123...,0xdef456...
responses:
'200':
description: Successfully retrieved midpoint prices
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to midpoint price
example:
0xabc123def456...: '0.45'
0xdef456abc123...: '0.52'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the mid price
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,121 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get midpoint prices (request body)
> Retrieves midpoint prices for multiple token IDs using a request body.
The midpoint is calculated as the average of the best bid and best ask prices.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /midpoints
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/midpoints:
post:
tags:
- Market Data
summary: Get midpoint prices (request body)
description: >
Retrieves midpoint prices for multiple token IDs using a request body.
The midpoint is calculated as the average of the best bid and best ask
prices.
operationId: getMidpointsPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved midpoint prices
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to midpoint price
example:
0xabc123def456...: '0.45'
0xdef456abc123...: '0.52'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the mid price
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,191 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order book
> Retrieves the order book summary for a specific token ID.
Includes bids, asks, market details, and last trade price.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /book
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/book:
get:
tags:
- Market Data
summary: Get order book
description: |
Retrieves the order book summary for a specific token ID.
Includes bids, asks, market details, and last trade price.
operationId: getBook
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved order book
content:
application/json:
schema:
$ref: '#/components/schemas/OrderBookSummary'
example:
market: '0x1234567890123456789012345678901234567890'
asset_id: 0xabc123def456...
timestamp: '1234567890'
hash: a1b2c3d4e5f6...
bids:
- price: '0.45'
size: '100'
- price: '0.44'
size: '200'
asks:
- price: '0.46'
size: '150'
- price: '0.47'
size: '250'
min_order_size: '1'
tick_size: '0.01'
neg_risk: false
last_trade_price: '0.45'
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the orderbook
security: []
components:
schemas:
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
- last_trade_price
properties:
market:
type: string
description: Market condition ID
example: '0x1234567890123456789012345678901234567890'
asset_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
timestamp:
type: string
description: Timestamp of the order book snapshot
example: '1234567890'
hash:
type: string
description: Hash of the order book summary
example: a1b2c3d4e5f6...
bids:
type: array
description: List of bid orders (sorted by price descending)
items:
$ref: '#/components/schemas/OrderSummary'
asks:
type: array
description: List of ask orders (sorted by price ascending)
items:
$ref: '#/components/schemas/OrderSummary'
min_order_size:
type: string
description: Minimum order size
example: '1'
tick_size:
type: string
description: Minimum price increment (tick size)
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled for this market
example: false
last_trade_price:
type: string
description: Last trade price
example: '0.45'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
OrderSummary:
type: object
required:
- price
- size
properties:
price:
type: string
description: Order price
example: '0.45'
size:
type: string
description: Order size
example: '100'
````
@@ -0,0 +1,191 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order books (request body)
> Retrieves order book summaries for multiple token IDs using a request body.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /books
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/books:
post:
tags:
- Market Data
summary: Get order books (request body)
description: >
Retrieves order book summaries for multiple token IDs using a request
body.
operationId: getBooksPost
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved order books
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderBookSummary'
example:
- market: '0x1234567890123456789012345678901234567890'
asset_id: 0xabc123def456...
timestamp: '1234567890'
hash: a1b2c3d4e5f6...
bids:
- price: '0.45'
size: '100'
asks:
- price: '0.46'
size: '150'
min_order_size: '1'
tick_size: '0.01'
neg_risk: false
last_trade_price: '0.45'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
- last_trade_price
properties:
market:
type: string
description: Market condition ID
example: '0x1234567890123456789012345678901234567890'
asset_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
timestamp:
type: string
description: Timestamp of the order book snapshot
example: '1234567890'
hash:
type: string
description: Hash of the order book summary
example: a1b2c3d4e5f6...
bids:
type: array
description: List of bid orders (sorted by price descending)
items:
$ref: '#/components/schemas/OrderSummary'
asks:
type: array
description: List of ask orders (sorted by price ascending)
items:
$ref: '#/components/schemas/OrderSummary'
min_order_size:
type: string
description: Minimum order size
example: '1'
tick_size:
type: string
description: Minimum price increment (tick size)
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled for this market
example: false
last_trade_price:
type: string
description: Last trade price
example: '0.45'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
OrderSummary:
type: object
required:
- price
- size
properties:
price:
type: string
description: Order price
example: '0.45'
size:
type: string
description: Order size
example: '100'
````
@@ -0,0 +1,101 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get spread
> Retrieves the spread for a specific token ID.
The spread is the difference between the best ask and best bid prices.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /spread
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/spread:
get:
tags:
- Market Data
summary: Get spread
description: |
Retrieves the spread for a specific token ID.
The spread is the difference between the best ask and best bid prices.
operationId: getSpread
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved spread
content:
application/json:
schema:
type: object
required:
- spread
properties:
spread:
type: string
description: Spread as a string
example: '0.02'
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - No orderbook exists for the requested token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: No orderbook exists for the requested token id
security: []
components:
schemas:
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,119 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get spreads
> Retrieves spreads for multiple token IDs.
The spread is the difference between the best ask and best bid prices.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /spreads
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/spreads:
post:
tags:
- Market Data
summary: Get spreads
description: |
Retrieves spreads for multiple token IDs.
The spread is the difference between the best ask and best bid prices.
operationId: getSpreads
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
example:
- token_id: 0xabc123def456...
- token_id: 0xdef456abc123...
responses:
'200':
description: Successfully retrieved spreads
content:
application/json:
schema:
type: object
additionalProperties:
type: string
description: Map of token ID to spread
example:
0xabc123def456...: '0.02'
0xdef456abc123...: '0.015'
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid payload
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: error getting the spread
security: []
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: Token ID (asset ID)
example: 0xabc123def456...
side:
type: string
description: Order side (optional, not used for midpoint calculation)
enum:
- BUY
- SELL
example: BUY
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,113 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get tick size by path parameter
> Retrieves the minimum tick size (price increment) for a specific token ID using the token ID as a path parameter.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /tick-size/{token_id}
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/tick-size/{token_id}:
get:
tags:
- Market Data
summary: Get tick size by path parameter
description: >
Retrieves the minimum tick size (price increment) for a specific token
ID using the token ID as a path parameter.
operationId: getTickSizeByPath
parameters:
- name: token_id
in: path
description: Token ID (asset ID)
required: true
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved tick size
content:
application/json:
schema:
$ref: '#/components/schemas/TickSize'
example:
minimum_tick_size: 0.01
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Market not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: market not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
TickSize:
type: object
required:
- minimum_tick_size
properties:
minimum_tick_size:
type: number
format: double
description: Minimum tick size (price increment)
example: 0.01
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -0,0 +1,117 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get tick size
> Retrieves the minimum tick size (price increment) for a specific token ID.
The tick size can be provided either as a query parameter or as a path parameter.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /tick-size
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/tick-size:
get:
tags:
- Market Data
summary: Get tick size
description: >
Retrieves the minimum tick size (price increment) for a specific token
ID.
The tick size can be provided either as a query parameter or as a path
parameter.
operationId: getTickSize
parameters:
- name: token_id
in: query
description: Token ID (asset ID)
required: false
schema:
type: string
example: 0xabc123def456...
responses:
'200':
description: Successfully retrieved tick size
content:
application/json:
schema:
$ref: '#/components/schemas/TickSize'
example:
minimum_tick_size: 0.01
'400':
description: Bad request - Invalid token id
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid token id
'404':
description: Not found - Market not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: market not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security: []
components:
schemas:
TickSize:
type: object
required:
- minimum_tick_size
properties:
minimum_tick_size:
type: number
format: double
description: Minimum tick size (price increment)
example: 0.01
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /markets/{id}
````yaml api-spec/gamma-openapi.yaml get /markets/{id}
openapi: 3.0.3
info:
title: Markets API
@@ -1186,4 +1186,4 @@ components:
type: string
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /markets/slug/{slug}
````yaml api-spec/gamma-openapi.yaml get /markets/slug/{slug}
openapi: 3.0.3
info:
title: Markets API
@@ -1186,4 +1186,4 @@ components:
type: string
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /markets/{id}/tags
````yaml api-spec/gamma-openapi.yaml get /markets/{id}/tags
openapi: 3.0.3
info:
title: Markets API
@@ -105,4 +105,4 @@ components:
type: boolean
nullable: true
````
````
@@ -0,0 +1,135 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get prices history
> Retrieve historical price data for a market.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /prices-history
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/prices-history:
get:
tags:
- Markets
summary: Get prices history
description: Retrieve historical price data for a market.
operationId: getPricesHistory
parameters:
- name: market
in: query
required: true
description: The market (asset id) to query.
schema:
type: string
- name: startTs
in: query
required: false
description: Filter by items after this unix timestamp.
schema:
type: number
format: double
- name: endTs
in: query
required: false
description: Filter by items before this unix timestamp.
schema:
type: number
format: double
- name: interval
in: query
required: false
description: Time interval for data aggregation.
schema:
type: string
enum:
- max
- all
- 1m
- 1w
- 1d
- 6h
- 1h
- name: fidelity
in: query
required: false
description: Accuracy of the data expressed in minutes. Default is 1 minute.
schema:
type: integer
responses:
'200':
description: Successful response with price history
content:
application/json:
schema:
$ref: '#/components/schemas/PricesHistoryResponse'
'400':
description: Bad Request - Missing or invalid query parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security: []
components:
schemas:
PricesHistoryResponse:
type: object
properties:
history:
type: array
items:
$ref: '#/components/schemas/MarketPrice'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
MarketPrice:
type: object
properties:
t:
type: integer
format: uint32
p:
type: number
format: float
````
@@ -0,0 +1,181 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get sampling markets
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /sampling-markets
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/sampling-markets:
get:
tags:
- Markets
summary: Get sampling markets
operationId: getSamplingMarkets
parameters:
- name: next_cursor
in: query
required: false
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedMarkets'
'400':
description: Invalid request
'500':
description: Internal server error
security: []
components:
schemas:
PaginatedMarkets:
type: object
properties:
limit:
type: integer
next_cursor:
type: string
count:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/Market'
Market:
type: object
properties:
enable_order_book:
type: boolean
active:
type: boolean
closed:
type: boolean
archived:
type: boolean
accepting_orders:
type: boolean
accepting_order_timestamp:
type: string
format: date-time
minimum_order_size:
type: number
format: double
minimum_tick_size:
type: number
format: double
condition_id:
type: string
question_id:
type: string
question:
type: string
description:
type: string
market_slug:
type: string
end_date_iso:
type: string
format: date-time
game_start_time:
type: string
format: date-time
seconds_delay:
type: integer
fpmm:
type: string
maker_base_fee:
type: integer
format: int64
taker_base_fee:
type: integer
format: int64
notifications_enabled:
type: boolean
neg_risk:
type: boolean
neg_risk_market_id:
type: string
neg_risk_request_id:
type: string
icon:
type: string
image:
type: string
rewards:
$ref: '#/components/schemas/Rewards'
is_50_50_outcome:
type: boolean
tokens:
type: array
items:
$ref: '#/components/schemas/Token'
tags:
type: array
items:
type: string
Rewards:
type: object
properties:
rates:
type: array
items:
type: object
properties:
asset_address:
type: string
rewards_daily_rate:
type: number
format: double
min_size:
type: number
format: double
max_spread:
type: number
format: double
Token:
type: object
properties:
token_id:
type: string
outcome:
type: string
price:
type: number
format: double
winner:
type: boolean
````
@@ -0,0 +1,128 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get sampling simplified markets
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /sampling-simplified-markets
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/sampling-simplified-markets:
get:
tags:
- Markets
summary: Get sampling simplified markets
operationId: getSamplingSimplifiedMarkets
parameters:
- name: next_cursor
in: query
required: false
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedSimplifiedMarkets'
'400':
description: Invalid request
'500':
description: Internal server error
security: []
components:
schemas:
PaginatedSimplifiedMarkets:
type: object
properties:
limit:
type: integer
next_cursor:
type: string
count:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/SimplifiedMarket'
SimplifiedMarket:
type: object
properties:
condition_id:
type: string
rewards:
$ref: '#/components/schemas/Rewards'
tokens:
type: array
items:
$ref: '#/components/schemas/Token'
active:
type: boolean
closed:
type: boolean
archived:
type: boolean
accepting_orders:
type: boolean
Rewards:
type: object
properties:
rates:
type: array
items:
type: object
properties:
asset_address:
type: string
rewards_daily_rate:
type: number
format: double
min_size:
type: number
format: double
max_spread:
type: number
format: double
Token:
type: object
properties:
token_id:
type: string
outcome:
type: string
price:
type: number
format: double
winner:
type: boolean
````
@@ -0,0 +1,128 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get simplified markets
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /simplified-markets
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/simplified-markets:
get:
tags:
- Markets
summary: Get simplified markets
operationId: getSimplifiedMarkets
parameters:
- name: next_cursor
in: query
required: false
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedSimplifiedMarkets'
'400':
description: Invalid request
'500':
description: Internal server error
security: []
components:
schemas:
PaginatedSimplifiedMarkets:
type: object
properties:
limit:
type: integer
next_cursor:
type: string
count:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/SimplifiedMarket'
SimplifiedMarket:
type: object
properties:
condition_id:
type: string
rewards:
$ref: '#/components/schemas/Rewards'
tokens:
type: array
items:
$ref: '#/components/schemas/Token'
active:
type: boolean
closed:
type: boolean
archived:
type: boolean
accepting_orders:
type: boolean
Rewards:
type: object
properties:
rates:
type: array
items:
type: object
properties:
asset_address:
type: string
rewards_daily_rate:
type: number
format: double
min_size:
type: number
format: double
max_spread:
type: number
format: double
Token:
type: object
properties:
token_id:
type: string
outcome:
type: string
price:
type: number
format: double
winner:
type: boolean
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /markets
````yaml api-spec/gamma-openapi.yaml get /markets
openapi: 3.0.3
info:
title: Markets API
@@ -1312,4 +1312,4 @@ components:
type: string
nullable: true
````
````
@@ -4,46 +4,11 @@
# Download an accounting snapshot (ZIP of CSVs)
> Public endpoint (no auth) that returns an `application/zip` containing two CSV files generated from the same snapshot time.
**ZIP contents**
1) `positions.csv` (0+ rows)
- Columns (in order):
- `conditionId` (string): market condition id
- `asset` (string): outcome token id (uniquely identifies the position within a market)
- `size` (number): tokens, 6 decimals
- `curPrice` (number): per-token price/value in USDC, 6 decimals
- `valuationTime` (string): RFC3339 UTC timestamp
2) `equity.csv` (0 or 1 row)
- Columns (in order):
- `cashBalance` (number): onchain USDC `balanceOf(user)` using Polygon USDC `0x2791bca1f2de4661ed88a30c99a7a9449aa84174`, 6 decimals
- `positionsValue` (number): \(\sum(\text{size} \times \text{curPrice})\) across `positions.csv`, 6 decimals
- `equity` (number): `cashBalance + positionsValue`, 6 decimals
- `valuationTime` (string): RFC3339 UTC timestamp (same snapshot time as `positions.csv`)
**Example `positions.csv`**
```csv
conditionId,asset,size,curPrice,valuationTime
0xd007d71fd17b0913b9d7ff198f617caa96a9e4aab1bed7d6f9abd76bb17dd507,65396714035221124737265515219989336303267439172398528294132309725835127126381,90548.087076,0.064500,2026-01-21T18:30:00Z
0x96f6fb6567b5938fc3c2e75f9829d7287340b9581a9c4817b8bc0aff82e1c45f,10057237541929696185971116542487795282113077727880089878027691009747516185940,45666.487374,0.495000,2026-01-21T18:30:00Z
```
**Example `equity.csv`**
```csv
cashBalance,positionsValue,equity,valuationTime
125000.000000,28481009.037705,28606009.037705,2026-01-21T18:30:00Z
```
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /v1/accounting/snapshot
````yaml api-spec/data-openapi.yaml get /v1/accounting/snapshot
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -67,55 +32,6 @@ paths:
tags:
- Misc
summary: Download an accounting snapshot (ZIP of CSVs)
description: >
Public endpoint (no auth) that returns an `application/zip` containing
two CSV files generated from the same snapshot time.
**ZIP contents**
1) `positions.csv` (0+ rows)
- Columns (in order):
- `conditionId` (string): market condition id
- `asset` (string): outcome token id (uniquely identifies the position within a market)
- `size` (number): tokens, 6 decimals
- `curPrice` (number): per-token price/value in USDC, 6 decimals
- `valuationTime` (string): RFC3339 UTC timestamp
2) `equity.csv` (0 or 1 row)
- Columns (in order):
- `cashBalance` (number): onchain USDC `balanceOf(user)` using Polygon USDC `0x2791bca1f2de4661ed88a30c99a7a9449aa84174`, 6 decimals
- `positionsValue` (number): \(\sum(\text{size} \times \text{curPrice})\) across `positions.csv`, 6 decimals
- `equity` (number): `cashBalance + positionsValue`, 6 decimals
- `valuationTime` (string): RFC3339 UTC timestamp (same snapshot time as `positions.csv`)
**Example `positions.csv`**
```csv
conditionId,asset,size,curPrice,valuationTime
0xd007d71fd17b0913b9d7ff198f617caa96a9e4aab1bed7d6f9abd76bb17dd507,65396714035221124737265515219989336303267439172398528294132309725835127126381,90548.087076,0.064500,2026-01-21T18:30:00Z
0x96f6fb6567b5938fc3c2e75f9829d7287340b9581a9c4817b8bc0aff82e1c45f,10057237541929696185971116542487795282113077727880089878027691009747516185940,45666.487374,0.495000,2026-01-21T18:30:00Z
```
**Example `equity.csv`**
```csv
cashBalance,positionsValue,equity,valuationTime
125000.000000,28481009.037705,28606009.037705,2026-01-21T18:30:00Z
```
parameters:
- in: query
name: user
@@ -158,4 +74,4 @@ components:
required:
- error
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /live-volume
````yaml api-spec/data-openapi.yaml get /live-volume
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -91,4 +91,4 @@ components:
pattern: ^0x[a-fA-F0-9]{64}$
example: '0xdd22472e552920b8438158ea7238bfadfa4f736aa4cee91a6b86c39ead110917'
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /oi
````yaml api-spec/data-openapi.yaml get /oi
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -84,4 +84,4 @@ components:
required:
- error
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/data-api-openapi.yaml get /traded
````yaml api-spec/data-openapi.yaml get /traded
openapi: 3.0.3
info:
title: Polymarket Data API
@@ -85,4 +85,4 @@ components:
required:
- error
````
````
@@ -1,177 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get multiple order books summaries by request
> Retrieves order book summaries for specified tokens via POST request
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml post /books
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/books:
post:
tags:
- Orderbook
summary: Get multiple order books summaries by request
description: Retrieves order book summaries for specified tokens via POST request
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
maxItems: 500
example:
- token_id: '1234567890'
- token_id: '0987654321'
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderBookSummary'
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalid_payload:
value:
error: Invalid payload
exceeds_limit:
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: The unique identifier for the token
example: '1234567890'
side:
type: string
enum:
- BUY
- SELL
description: Optional side parameter for certain operations
example: BUY
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
properties:
market:
type: string
description: Market identifier
example: '0x1b6f76e5b8587ee896c35847e12d11e75290a8c3934c5952e8a9d6e4c6f03cfa'
asset_id:
type: string
description: Asset identifier
example: '1234567890'
timestamp:
type: string
format: date-time
description: Timestamp of the order book snapshot
example: '2023-10-01T12:00:00Z'
hash:
type: string
description: Hash of the order book state
example: 0xabc123def456...
bids:
type: array
items:
$ref: '#/components/schemas/OrderLevel'
description: Array of bid levels
asks:
type: array
items:
$ref: '#/components/schemas/OrderLevel'
description: Array of ask levels
min_order_size:
type: string
description: Minimum order size for this market
example: '0.001'
tick_size:
type: string
description: Minimum price increment
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled
example: false
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
OrderLevel:
type: object
required:
- price
- size
properties:
price:
type: string
description: Price level (as string to maintain precision)
example: '1800.50'
size:
type: string
description: Total size at this price level
example: '10.5'
````
null
@@ -1,160 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order book summary
> Retrieves the order book summary for a specific token
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml get /book
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/book:
get:
tags:
- Orderbook
summary: Get order book summary
description: Retrieves the order book summary for a specific token
parameters:
- name: token_id
in: query
required: true
schema:
type: string
description: The unique identifier for the token
example: '1234567890'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/OrderBookSummary'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: Invalid token id
'404':
description: Order book not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: error getting the orderbook
components:
schemas:
OrderBookSummary:
type: object
required:
- market
- asset_id
- timestamp
- hash
- bids
- asks
- min_order_size
- tick_size
- neg_risk
properties:
market:
type: string
description: Market identifier
example: '0x1b6f76e5b8587ee896c35847e12d11e75290a8c3934c5952e8a9d6e4c6f03cfa'
asset_id:
type: string
description: Asset identifier
example: '1234567890'
timestamp:
type: string
format: date-time
description: Timestamp of the order book snapshot
example: '2023-10-01T12:00:00Z'
hash:
type: string
description: Hash of the order book state
example: 0xabc123def456...
bids:
type: array
items:
$ref: '#/components/schemas/OrderLevel'
description: Array of bid levels
asks:
type: array
items:
$ref: '#/components/schemas/OrderLevel'
description: Array of ask levels
min_order_size:
type: string
description: Minimum order size for this market
example: '0.001'
tick_size:
type: string
description: Minimum price increment
example: '0.01'
neg_risk:
type: boolean
description: Whether negative risk is enabled
example: false
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
OrderLevel:
type: object
required:
- price
- size
properties:
price:
type: string
description: Price level (as string to maintain precision)
example: '1800.50'
size:
type: string
description: Total size at this price level
example: '10.5'
````
null
+1 -116
View File
@@ -1,116 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get market price
> Retrieves the market price for a specific token and side
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml get /price
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/price:
get:
tags:
- Pricing
summary: Get market price
description: Retrieves the market price for a specific token and side
parameters:
- name: token_id
in: query
required: true
schema:
type: string
description: The unique identifier for the token
example: '1234567890'
- name: side
in: query
required: true
schema:
type: string
enum:
- BUY
- SELL
description: The side of the market (BUY or SELL)
example: BUY
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PriceResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalid_token:
value:
error: Invalid token id
invalid_side:
value:
error: Invalid side
'404':
description: Order book not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
PriceResponse:
type: object
required:
- price
properties:
price:
type: string
description: The market price (as string to maintain precision)
example: '1800.50'
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -1,101 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get midpoint price
> Retrieves the midpoint price for a specific token
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml get /midpoint
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/midpoint:
get:
tags:
- Pricing
summary: Get midpoint price
description: Retrieves the midpoint price for a specific token
parameters:
- name: token_id
in: query
required: true
schema:
type: string
description: The unique identifier for the token
example: '1234567890'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/MidpointResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: Invalid token id
'404':
description: Order book not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
MidpointResponse:
type: object
required:
- mid
properties:
mid:
type: string
description: The midpoint price (as string to maintain precision)
example: '1800.75'
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -1,137 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get multiple market prices by request
> Retrieves market prices for specified tokens and sides via POST request
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml post /prices
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/prices:
post:
tags:
- Pricing
summary: Get multiple market prices by request
description: Retrieves market prices for specified tokens and sides via POST request
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/PriceRequest'
maxItems: 500
example:
- token_id: '1234567890'
side: BUY
- token_id: '0987654321'
side: SELL
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PricesResponse'
'400':
description: Bad request - Invalid payload, exceeds limit, or invalid side
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalid_payload:
value:
error: Invalid payload
exceeds_limit:
value:
error: Payload exceeds the limit
invalid_side:
value:
error: Invalid side
'404':
description: Order book not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: No orderbook exists for the requested token id
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
PriceRequest:
type: object
required:
- token_id
- side
properties:
token_id:
type: string
description: The unique identifier for the token
example: '1234567890'
side:
type: string
enum:
- BUY
- SELL
description: The side of the market (BUY or SELL)
example: BUY
PricesResponse:
type: object
additionalProperties:
type: object
additionalProperties:
type: string
description: Map of token_id to side to price
example:
'1234567890':
BUY: '1800.50'
SELL: '1801.00'
'0987654321':
BUY: '50.25'
SELL: '50.30'
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -1,88 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get multiple market prices
> Retrieves market prices for multiple tokens and sides
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml get /prices
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/prices:
get:
tags:
- Pricing
summary: Get multiple market prices
description: Retrieves market prices for multiple tokens and sides
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/PricesResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
PricesResponse:
type: object
additionalProperties:
type: object
additionalProperties:
type: string
description: Map of token_id to side to price
example:
'1234567890':
BUY: '1800.50'
SELL: '1801.00'
'0987654321':
BUY: '50.25'
SELL: '50.30'
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -1,146 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get price history for a traded token
> Fetches historical price data for a specified market token
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml get /prices-history
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/prices-history:
get:
tags:
- Pricing
summary: Get price history for a traded token
description: Fetches historical price data for a specified market token
parameters:
- name: market
in: query
required: true
schema:
type: string
description: The CLOB token ID for which to fetch price history
example: '1234567890'
- name: startTs
in: query
required: false
schema:
type: number
description: The start time, a Unix timestamp in UTC
example: 1697875200
- name: endTs
in: query
required: false
schema:
type: number
description: The end time, a Unix timestamp in UTC
example: 1697961600
- name: interval
in: query
required: false
schema:
type: string
enum:
- 1m
- 1w
- 1d
- 6h
- 1h
- max
description: >-
A string representing a duration ending at the current time.
Mutually exclusive with startTs and endTs
example: 1d
- name: fidelity
in: query
required: false
schema:
type: number
description: The resolution of the data, in minutes
example: 60
responses:
'200':
description: A list of timestamp/price pairs
content:
application/json:
schema:
$ref: '#/components/schemas/PriceHistoryResponse'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Market not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
PriceHistoryResponse:
type: object
required:
- history
properties:
history:
type: array
items:
type: object
required:
- t
- p
properties:
t:
type: number
description: UTC timestamp
example: 1697875200
p:
type: number
description: Price
example: 1800.75
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /public-profile
````yaml api-spec/gamma-openapi.yaml get /public-profile
openapi: 3.0.3
info:
title: Markets API
@@ -151,4 +151,4 @@ components:
type: boolean
description: Whether the user is a moderator
````
````
+126
View File
@@ -0,0 +1,126 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Rate Limits
> API rate limits for all Polymarket endpoints
All API rate limits are enforced using Cloudflare's throttling system. When you exceed the limit for any endpoint, requests are throttled (delayed/queued) rather than immediately rejected. Limits reset on sliding time windows.
***
## General
| Endpoint | Limit |
| --------------------- | ---------------- |
| General rate limiting | 15,000 req / 10s |
| Health check (`/ok`) | 100 req / 10s |
***
## Gamma API
Base URL: `https://gamma-api.polymarket.com`
| Endpoint | Limit |
| ------------------------------ | --------------- |
| General | 4,000 req / 10s |
| `/events` | 500 req / 10s |
| `/markets` | 300 req / 10s |
| `/markets` + `/events` listing | 900 req / 10s |
| `/comments` | 200 req / 10s |
| `/tags` | 200 req / 10s |
| `/public-search` | 350 req / 10s |
***
## Data API
Base URL: `https://data-api.polymarket.com`
| Endpoint | Limit |
| -------------------- | --------------- |
| General | 1,000 req / 10s |
| `/trades` | 200 req / 10s |
| `/positions` | 150 req / 10s |
| `/closed-positions` | 150 req / 10s |
| Health check (`/ok`) | 100 req / 10s |
***
## CLOB API
Base URL: `https://clob.polymarket.com`
### General
| Endpoint | Limit |
| -------------------------- | --------------- |
| General | 9,000 req / 10s |
| `GET` balance allowance | 200 req / 10s |
| `UPDATE` balance allowance | 50 req / 10s |
### Market Data
| Endpoint | Limit |
| ----------------- | --------------- |
| `/book` | 1,500 req / 10s |
| `/books` | 500 req / 10s |
| `/price` | 1,500 req / 10s |
| `/prices` | 500 req / 10s |
| `/midpoint` | 1,500 req / 10s |
| `/midpoints` | 500 req / 10s |
| `/prices-history` | 1,000 req / 10s |
| Market tick size | 200 req / 10s |
### Ledger
| Endpoint | Limit |
| ------------------------------------------------ | ------------- |
| `/trades`, `/orders`, `/notifications`, `/order` | 900 req / 10s |
| `/data/orders` | 500 req / 10s |
| `/data/trades` | 500 req / 10s |
| `/notifications` | 125 req / 10s |
### Authentication
| Endpoint | Limit |
| ----------------- | ------------- |
| API key endpoints | 100 req / 10s |
### Trading
Trading endpoints have both **burst** limits (short spikes allowed) and **sustained** limits (longer-term average).
| Endpoint | Burst Limit | Sustained Limit |
| ------------------------------ | --------------- | ------------------- |
| `POST /order` | 3,500 req / 10s | 36,000 req / 10 min |
| `DELETE /order` | 3,000 req / 10s | 30,000 req / 10 min |
| `POST /orders` | 1,000 req / 10s | 15,000 req / 10 min |
| `DELETE /orders` | 1,000 req / 10s | 15,000 req / 10 min |
| `DELETE /cancel-all` | 250 req / 10s | 6,000 req / 10 min |
| `DELETE /cancel-market-orders` | 1,000 req / 10s | 1,500 req / 10 min |
***
## Other
| Endpoint | Limit |
| ----------------- | -------------- |
| Relayer `/submit` | 25 req / 1 min |
| User PNL API | 200 req / 10s |
***
## Next Steps
<CardGroup cols={2}>
<Card title="Authentication" icon="key" href="/api-reference/authentication">
Learn how to authenticate trading requests.
</Card>
<Card title="Clients & SDKs" icon="cube" href="/api-reference/clients-sdks">
Official TypeScript, Python, and Rust libraries.
</Card>
</CardGroup>
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /public-search
````yaml api-spec/gamma-openapi.yaml get /public-search
openapi: 3.0.3
info:
title: Markets API
@@ -1344,4 +1344,4 @@ components:
type: string
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /series/{id}
````yaml api-spec/gamma-openapi.yaml get /series/{id}
openapi: 3.0.3
info:
title: Markets API
@@ -1186,4 +1186,4 @@ components:
type: string
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /series
````yaml api-spec/gamma-openapi.yaml get /series
openapi: 3.0.3
info:
title: Markets API
@@ -1232,4 +1232,4 @@ components:
type: string
nullable: true
````
````
@@ -4,13 +4,11 @@
# Get sports metadata information
> Retrieves metadata for various sports including images, resolution sources, ordering preferences, tags, and series information. This endpoint provides comprehensive sport configuration data used throughout the platform.
## OpenAPI
````yaml api-reference/gamma-openapi.json get /sports
````yaml api-spec/gamma-openapi.yaml get /sports
openapi: 3.0.3
info:
title: Markets API
@@ -45,11 +43,6 @@ paths:
tags:
- Sports
summary: Get sports metadata information
description: >-
Retrieves metadata for various sports including images, resolution
sources, ordering preferences, tags, and series information. This
endpoint provides comprehensive sport configuration data used throughout
the platform.
operationId: getSportsMetadata
responses:
'200':
@@ -94,4 +87,4 @@ components:
Series identifier linking the sport to a specific tournament or
season series
````
````
@@ -4,13 +4,11 @@
# Get valid sports market types
> Get a list of all valid sports market types available on the platform. Use these values when filtering markets by the sportsMarketTypes parameter.
## OpenAPI
````yaml api-reference/gamma-openapi.json get /sports/market-types
````yaml api-spec/gamma-openapi.yaml get /sports/market-types
openapi: 3.0.3
info:
title: Markets API
@@ -45,10 +43,6 @@ paths:
tags:
- Sports
summary: Get valid sports market types
description: >-
Get a list of all valid sports market types available on the platform.
Use these values when filtering markets by the sportsMarketTypes
parameter.
operationId: getSportsMarketTypes
responses:
'200':
@@ -68,4 +62,4 @@ components:
items:
type: string
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /teams
````yaml api-spec/gamma-openapi.yaml get /teams
openapi: 3.0.3
info:
title: Markets API
@@ -134,4 +134,4 @@ components:
format: date-time
nullable: true
````
````
@@ -1,119 +1 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get bid-ask spreads
> Retrieves bid-ask spreads for multiple tokens
## OpenAPI
````yaml api-reference/clob-subset-openapi.yaml post /spreads
openapi: 3.0.3
info:
title: CLOB (Central Limit Order Book) API
description: >-
API for interacting with the Central Limit Order Book system, providing
orderbook data, prices, midpoints, and spreads
version: 1.0.0
contact:
name: CLOB API Team
license:
name: MIT
servers:
- url: https://clob.polymarket.com/
description: Production server
security: []
tags:
- name: Orderbook
description: Order book related operations
- name: Pricing
description: Price and midpoint operations
- name: Spreads
description: Spread calculation operations
paths:
/spreads:
post:
tags:
- Spreads
summary: Get bid-ask spreads
description: Retrieves bid-ask spreads for multiple tokens
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BookRequest'
maxItems: 500
example:
- token_id: '1234567890'
- token_id: '0987654321'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/SpreadsResponse'
'400':
description: Bad request - Invalid payload or exceeds limit
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalid_payload:
value:
error: Invalid payload
exceeds_limit:
value:
error: Payload exceeds the limit
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: error getting the spread
components:
schemas:
BookRequest:
type: object
required:
- token_id
properties:
token_id:
type: string
description: The unique identifier for the token
example: '1234567890'
side:
type: string
enum:
- BUY
- SELL
description: Optional side parameter for certain operations
example: BUY
SpreadsResponse:
type: object
additionalProperties:
type: string
description: Map of token_id to spread value
example:
'1234567890': '0.50'
'0987654321': '0.05'
Error:
type: object
required:
- error
properties:
error:
type: string
description: Error message describing what went wrong
example: Invalid token id
````
null
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/{id}/related-tags
````yaml api-spec/gamma-openapi.yaml get /tags/{id}/related-tags
openapi: 3.0.3
info:
title: Markets API
@@ -91,4 +91,4 @@ components:
type: integer
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/slug/{slug}/related-tags
````yaml api-spec/gamma-openapi.yaml get /tags/slug/{slug}/related-tags
openapi: 3.0.3
info:
title: Markets API
@@ -91,4 +91,4 @@ components:
type: integer
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/{id}
````yaml api-spec/gamma-openapi.yaml get /tags/{id}
openapi: 3.0.3
info:
title: Markets API
@@ -106,4 +106,4 @@ components:
type: boolean
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/slug/{slug}
````yaml api-spec/gamma-openapi.yaml get /tags/slug/{slug}
openapi: 3.0.3
info:
title: Markets API
@@ -106,4 +106,4 @@ components:
type: boolean
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/{id}/related-tags/tags
````yaml api-spec/gamma-openapi.yaml get /tags/{id}/related-tags/tags
openapi: 3.0.3
info:
title: Markets API
@@ -114,4 +114,4 @@ components:
type: boolean
nullable: true
````
````
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags/slug/{slug}/related-tags/tags
````yaml api-spec/gamma-openapi.yaml get /tags/slug/{slug}/related-tags/tags
openapi: 3.0.3
info:
title: Markets API
@@ -114,4 +114,4 @@ components:
type: boolean
nullable: true
````
````
+2 -2
View File
@@ -8,7 +8,7 @@
## OpenAPI
````yaml api-reference/gamma-openapi.json get /tags
````yaml api-spec/gamma-openapi.yaml get /tags
openapi: 3.0.3
info:
title: Markets API
@@ -130,4 +130,4 @@ components:
type: boolean
nullable: true
````
````
@@ -0,0 +1,168 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel all orders
> Cancels all open orders for the authenticated user. Works even in cancel-only mode.
## OpenAPI
````yaml api-spec/clob-openapi.yaml delete /cancel-all
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/cancel-all:
delete:
tags:
- Trade
summary: Cancel all orders
description: >
Cancels all open orders for the authenticated user. Works even in
cancel-only mode.
operationId: cancelAllOrders
responses:
'200':
description: Cancellation results for all orders
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrdersResponse'
examples:
canceled:
summary: All orders canceled
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
- '0xfedcba0987654321fedcba0987654321fedcba09'
not_canceled: {}
mixed:
summary: Some orders canceled, some not
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
'0xfedcba0987654321fedcba0987654321fedcba09': Order already matched
no_orders:
summary: No orders to cancel
value:
canceled: []
not_canceled: {}
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
'503':
description: >-
Service unavailable - Trading disabled (cancels still work in
cancel-only mode)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
CancelOrdersResponse:
type: object
required:
- canceled
- not_canceled
properties:
canceled:
type: array
description: Array of order IDs that were successfully canceled
items:
type: string
example:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
type: object
description: Map of order IDs that could not be canceled with error messages
additionalProperties:
type: string
example:
'0xabcdef1234567890abcdef1234567890abcdef12': Order not found or already canceled
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,208 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel multiple orders
> Cancels multiple orders by their IDs. Maximum 3000 orders per request.
Duplicate order IDs in the request are automatically ignored.
Works even in cancel-only mode.
## OpenAPI
````yaml api-spec/clob-openapi.yaml delete /orders
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/orders:
delete:
tags:
- Trade
summary: Cancel multiple orders
description: |
Cancels multiple orders by their IDs. Maximum 3000 orders per request.
Duplicate order IDs in the request are automatically ignored.
Works even in cancel-only mode.
operationId: cancelOrders
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
type: string
maxItems: 3000
example:
- '0xabcdef1234567890abcdef1234567890abcdef12'
- '0xfedcba0987654321fedcba0987654321fedcba09'
- '0x1234567890abcdef1234567890abcdef12345678'
responses:
'200':
description: Cancellation results for all orders
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrdersResponse'
examples:
all_canceled:
summary: All orders canceled
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
- '0xfedcba0987654321fedcba0987654321fedcba09'
- '0x1234567890abcdef1234567890abcdef12345678'
not_canceled: {}
mixed:
summary: Some orders canceled, some not
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
- '0xfedcba0987654321fedcba0987654321fedcba09'
not_canceled:
'0x1234567890abcdef1234567890abcdef12345678': Order already matched
partial:
summary: Partial cancellation
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
'0xfedcba0987654321fedcba0987654321fedcba09': Order not found
'0x1234567890abcdef1234567890abcdef12345678': Order already canceled
'400':
description: Bad request - Invalid order IDs or payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_order_id:
summary: Invalid order ID
value:
error: Invalid orderID
invalid_payload:
summary: Invalid payload
value:
error: Invalid order payload
too_many_orders:
summary: Too many orders
value:
error: 'Too many orders in payload, max allowed: 3000'
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
'503':
description: >-
Service unavailable - Trading disabled (cancels still work in
cancel-only mode)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
CancelOrdersResponse:
type: object
required:
- canceled
- not_canceled
properties:
canceled:
type: array
description: Array of order IDs that were successfully canceled
items:
type: string
example:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
type: object
description: Map of order IDs that could not be canceled with error messages
additionalProperties:
type: string
example:
'0xabcdef1234567890abcdef1234567890abcdef12': Order not found or already canceled
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,203 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel orders for a market
> Cancels all open orders for the authenticated user in a specific market (condition) and asset.
Works even in cancel-only mode.
## OpenAPI
````yaml api-spec/clob-openapi.yaml delete /cancel-market-orders
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/cancel-market-orders:
delete:
tags:
- Trade
summary: Cancel orders for a market
description: >
Cancels all open orders for the authenticated user in a specific market
(condition) and asset.
Works even in cancel-only mode.
operationId: cancelMarketOrders
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OrderMarketCancelParams'
example:
market: >-
0x0000000000000000000000000000000000000000000000000000000000000001
asset_id: 0xabc123def456...
responses:
'200':
description: Cancellation results for market orders
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrdersResponse'
examples:
canceled:
summary: All market orders canceled
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
- '0xfedcba0987654321fedcba0987654321fedcba09'
not_canceled: {}
mixed:
summary: Some orders canceled, some not
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
'0xfedcba0987654321fedcba0987654321fedcba09': Order already matched
no_orders:
summary: No orders found for this market
value:
canceled: []
not_canceled: {}
'400':
description: Bad request - Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid order payload
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
'503':
description: >-
Service unavailable - Trading disabled (cancels still work in
cancel-only mode)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
OrderMarketCancelParams:
type: object
required:
- market
- asset_id
properties:
market:
type: string
description: Market (condition ID)
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
asset_id:
type: string
description: Asset ID (token ID)
example: 0xabc123def456...
CancelOrdersResponse:
type: object
required:
- canceled
- not_canceled
properties:
canceled:
type: array
description: Array of order IDs that were successfully canceled
items:
type: string
example:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
type: object
description: Map of order IDs that could not be canceled with error messages
additionalProperties:
type: string
example:
'0xabcdef1234567890abcdef1234567890abcdef12': Order not found or already canceled
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,192 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Cancel single order
> Cancels a single order by its ID. Works even in cancel-only mode.
## OpenAPI
````yaml api-spec/clob-openapi.yaml delete /order
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/order:
delete:
tags:
- Trade
summary: Cancel single order
description: |
Cancels a single order by its ID. Works even in cancel-only mode.
operationId: cancelOrder
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrderPayload'
example:
orderID: '0xabcdef1234567890abcdef1234567890abcdef12'
responses:
'200':
description: Order cancellation result
content:
application/json:
schema:
$ref: '#/components/schemas/CancelOrdersResponse'
examples:
canceled:
summary: Order successfully canceled
value:
canceled:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled: {}
not_canceled:
summary: Order could not be canceled
value:
canceled: []
not_canceled:
'0xabcdef1234567890abcdef1234567890abcdef12': Order not found or already canceled
'400':
description: Bad request - Invalid order ID or payload
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_order_id:
summary: Invalid order ID
value:
error: Invalid orderID
invalid_payload:
summary: Invalid payload
value:
error: Invalid order payload
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
'503':
description: >-
Service unavailable - Trading disabled (cancels still work in
cancel-only mode)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
CancelOrderPayload:
type: object
required:
- orderID
properties:
orderID:
type: string
description: Order ID (order hash) to cancel
example: '0xabcdef1234567890abcdef1234567890abcdef12'
CancelOrdersResponse:
type: object
required:
- canceled
- not_canceled
properties:
canceled:
type: array
description: Array of order IDs that were successfully canceled
items:
type: string
example:
- '0xabcdef1234567890abcdef1234567890abcdef12'
not_canceled:
type: object
description: Map of order IDs that could not be canceled with error messages
additionalProperties:
type: string
example:
'0xabcdef1234567890abcdef1234567890abcdef12': Order not found or already canceled
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,364 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get builder trades
> Retrieves originated trades for a given builder.
Builders can only see their own originated trades.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /builder/trades
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/builder/trades:
get:
tags:
- Trade
summary: Get builder trades
description: |
Retrieves originated trades for a given builder.
Builders can only see their own originated trades.
operationId: getBuilderTrades
parameters:
- name: id
in: query
description: Trade ID to filter by specific trade
required: false
schema:
type: string
example: trade-123
- name: builder
in: query
description: >-
Builder identifier (automatically set from authenticated builder, or
can be specified with admin token)
required: false
schema:
type: string
example: 0199bfa0-f4c1-7a98-9c2b-b29cc6d39e10
- name: market
in: query
description: Market (condition ID) to filter trades
required: false
schema:
type: string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
- name: asset_id
in: query
description: Asset ID (token ID) to filter trades
required: false
schema:
type: string
example: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
- name: before
in: query
description: Filter trades before this Unix timestamp
required: false
schema:
type: string
pattern: ^\d+$
example: '1700000000'
- name: after
in: query
description: Filter trades after this Unix timestamp
required: false
schema:
type: string
pattern: ^\d+$
example: '1600000000'
- name: next_cursor
in: query
description: Cursor for pagination (base64 encoded offset)
required: false
schema:
type: string
example: MA==
responses:
'200':
description: Successfully retrieved builder trades
content:
application/json:
schema:
$ref: '#/components/schemas/BuilderTradesResponse'
examples:
example:
summary: Builder trades response
value:
limit: 300
next_cursor: MzAw
count: 2
data:
- id: trade-123
tradeType: TAKER
takerOrderHash: '0xabcdef1234567890abcdef1234567890abcdef12'
builder: 0199bfa0-f4c1-7a98-9c2b-b29cc6d39e10
market: >-
0x0000000000000000000000000000000000000000000000000000000000000001
assetId: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
side: BUY
size: '100000000'
sizeUsdc: '50000000'
price: '0.5'
status: TRADE_STATUS_CONFIRMED
outcome: 'YES'
outcomeIndex: 0
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker: '0x1234567890123456789012345678901234567890'
transactionHash: >-
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
matchTime: '1700000000'
bucketIndex: 0
fee: '300000'
feeUsdc: '150000'
createdAt: '2024-01-01T00:00:00Z'
updatedAt: '2024-01-01T00:00:00Z'
'400':
description: Bad request - Invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid builder trade params
'401':
description: Unauthorized - Invalid builder API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: could not fetch builder trades
security:
- polyBuilderApiKey: []
polyBuilderPassphrase: []
polyBuilderSignature: []
polyBuilderTimestamp: []
components:
schemas:
BuilderTradesResponse:
type: object
description: Paginated builder trades response
required:
- limit
- next_cursor
- count
- data
properties:
limit:
type: integer
description: Maximum number of items per page
example: 300
next_cursor:
type: string
description: >-
Cursor for next page (base64 encoded offset). "LTE=" indicates no
more pages
example: MzAw
count:
type: integer
description: Number of items in current response
example: 2
data:
type: array
description: Array of builder trades
items:
$ref: '#/components/schemas/BuilderTrade'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
BuilderTrade:
type: object
description: Builder trade information
required:
- id
- tradeType
- takerOrderHash
- builder
- market
- assetId
- side
- size
- sizeUsdc
- price
- status
- outcome
- outcomeIndex
- owner
- maker
- transactionHash
- matchTime
- bucketIndex
- fee
- feeUsdc
properties:
id:
type: string
description: Trade ID
example: trade-123
tradeType:
type: string
description: Trade type
example: TAKER
takerOrderHash:
type: string
description: Taker order hash
example: '0xabcdef1234567890abcdef1234567890abcdef12'
builder:
type: string
description: Builder identifier
example: 0199bfa0-f4c1-7a98-9c2b-b29cc6d39e10
market:
type: string
description: Market (condition ID)
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
assetId:
type: string
description: Asset ID (token ID)
example: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
side:
type: string
description: Trade side
enum:
- BUY
- SELL
example: BUY
size:
type: string
description: Trade size
example: '100000000'
sizeUsdc:
type: string
description: Trade size in USDC
example: '50000000'
price:
type: string
description: Trade price
example: '0.5'
status:
type: string
description: Trade status
example: TRADE_STATUS_CONFIRMED
outcome:
type: string
description: Market outcome
example: 'YES'
outcomeIndex:
type: integer
description: Outcome index
example: 0
owner:
type: string
description: Owner UUID
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker:
type: string
description: Maker address
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x1234567890123456789012345678901234567890'
transactionHash:
type: string
description: Transaction hash
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
matchTime:
type: string
description: Match time (Unix timestamp)
example: '1700000000'
bucketIndex:
type: integer
description: Bucket index
example: 0
fee:
type: string
description: Fee amount
example: '300000'
feeUsdc:
type: string
description: Fee amount in USDC
example: '150000'
err_msg:
type:
- string
- 'null'
description: Error message (if any)
example: null
createdAt:
type: string
format: date-time
description: Creation timestamp
example: '2024-01-01T00:00:00Z'
updatedAt:
type: string
format: date-time
description: Last update timestamp
example: '2024-01-01T00:00:00Z'
securitySchemes:
polyBuilderApiKey:
type: apiKey
in: header
name: POLY_BUILDER_API_KEY
description: Builder API key for authentication
polyBuilderPassphrase:
type: apiKey
in: header
name: POLY_BUILDER_PASSPHRASE
description: Passphrase for builder authentication
polyBuilderSignature:
type: apiKey
in: header
name: POLY_BUILDER_SIGNATURE
description: HMAC signature for builder authentication
polyBuilderTimestamp:
type: apiKey
in: header
name: POLY_BUILDER_TIMESTAMP
description: Unix timestamp for builder authentication
````
@@ -0,0 +1,186 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get order scoring status
> Checks if a specific order is currently scoring for rewards.
An order is considered "scoring" if it meets all the criteria for earning maker rewards:
- The order is live on a rewards-eligible market
- The order meets the minimum size requirements
- The order is within the valid spread range
- The order has been live for the required duration
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /order-scoring
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/order-scoring:
get:
tags:
- Trade
summary: Get order scoring status
description: >
Checks if a specific order is currently scoring for rewards.
An order is considered "scoring" if it meets all the criteria for
earning maker rewards:
- The order is live on a rewards-eligible market
- The order meets the minimum size requirements
- The order is within the valid spread range
- The order has been live for the required duration
operationId: getOrderScoring
parameters:
- name: order_id
in: query
description: The order ID (order hash) to check scoring status for
required: true
schema:
type: string
example: '0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'
responses:
'200':
description: Successfully retrieved order scoring status
content:
application/json:
schema:
$ref: '#/components/schemas/OrderScoringResponse'
examples:
scoring:
summary: Order is scoring
value:
scoring: true
not_scoring:
summary: Order is not scoring
value:
scoring: false
'400':
description: Bad request - Invalid order ID
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid order_id
'401':
description: Unauthorized - Invalid API key or order doesn't belong to user
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'404':
description: Market not found for the order
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: market not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
'503':
description: Service unavailable - Trading disabled
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
OrderScoringResponse:
type: object
description: Response indicating whether an order is currently scoring for rewards
required:
- scoring
properties:
scoring:
type: boolean
description: Whether the order is currently scoring for maker rewards
example: true
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,251 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get single order by ID
> Retrieves a specific order by its ID (order hash) for the authenticated user.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /order/{orderID}
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/order/{orderID}:
get:
tags:
- Trade
summary: Get single order by ID
description: >
Retrieves a specific order by its ID (order hash) for the authenticated
user.
operationId: getOrder
parameters:
- name: orderID
in: path
description: Order ID (order hash)
required: true
schema:
type: string
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
responses:
'200':
description: Successfully retrieved order
content:
application/json:
schema:
$ref: '#/components/schemas/OpenOrder'
example:
id: '0xabcdef1234567890abcdef1234567890abcdef12'
status: ORDER_STATUS_LIVE
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address: '0x1234567890123456789012345678901234567890'
market: >-
0x0000000000000000000000000000000000000000000000000000000000000001
asset_id: 0xabc123def456...
side: BUY
original_size: '100000000'
size_matched: '0'
price: '0.5'
outcome: 'YES'
expiration: '1735689600'
order_type: GTC
associate_trades: []
created_at: 1700000000
'400':
description: Bad request - Invalid order ID
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid orderID
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'404':
description: Order not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Order not found
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
OpenOrder:
type: object
required:
- id
- status
- owner
- maker_address
- market
- asset_id
- side
- original_size
- size_matched
- price
- expiration
- order_type
- created_at
- outcome
properties:
id:
type: string
description: Order ID (order hash)
example: '0xabcdef1234567890abcdef1234567890abcdef12'
status:
type: string
description: Order status
enum:
- ORDER_STATUS_LIVE
- ORDER_STATUS_INVALID
- ORDER_STATUS_CANCELED_MARKET_RESOLVED
- ORDER_STATUS_CANCELED
- ORDER_STATUS_MATCHED
owner:
type: string
description: UUID of the order owner
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address:
type: string
description: Ethereum address of the maker
example: '0x1234567890123456789012345678901234567890'
market:
type: string
description: Market (condition ID)
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
asset_id:
type: string
description: Asset ID (token ID)
example: 0xabc123def456...
side:
type: string
description: Order side
enum:
- BUY
- SELL
example: BUY
original_size:
type: string
description: Original order size in fixed-math with 6 decimals
example: '100000000'
size_matched:
type: string
description: Size that has been matched in fixed-math with 6 decimals
example: '0'
price:
type: string
description: Order price
example: '0.5'
outcome:
type: string
description: Market outcome (YES/NO)
example: 'YES'
expiration:
type: string
description: Unix timestamp when the order expires
example: '1735689600'
order_type:
type: string
description: Order type
enum:
- GTC
- FOK
- GTD
- FAK
example: GTC
associate_trades:
type: array
description: Array of associated trade IDs
items:
type: string
example:
- trade-123
created_at:
type: integer
description: Unix timestamp when the order was created
example: 1700000000
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
+387
View File
@@ -0,0 +1,387 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get trades
> Retrieves trades for the authenticated user. Returns paginated results.
Requires readonly or level 2 API key authentication.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /trades
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/trades:
get:
tags:
- Trade
summary: Get trades
description: |
Retrieves trades for the authenticated user. Returns paginated results.
Requires readonly or level 2 API key authentication.
operationId: getTrades
parameters:
- name: id
in: query
description: Trade ID to filter by specific trade
required: false
schema:
type: string
example: trade-123
- name: maker_address
in: query
description: Maker address to filter trades
required: true
schema:
type: string
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x1234567890123456789012345678901234567890'
- name: market
in: query
description: Market (condition ID) to filter trades
required: false
schema:
type: string
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
- name: asset_id
in: query
description: Asset ID (token ID) to filter trades
required: false
schema:
type: string
example: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
- name: before
in: query
description: Filter trades before this Unix timestamp
required: false
schema:
type: string
pattern: ^\d+$
example: '1700000000'
- name: after
in: query
description: Filter trades after this Unix timestamp
required: false
schema:
type: string
pattern: ^\d+$
example: '1600000000'
- name: next_cursor
in: query
description: Cursor for pagination (base64 encoded offset)
required: false
schema:
type: string
example: MA==
responses:
'200':
description: Successfully retrieved trades
content:
application/json:
schema:
$ref: '#/components/schemas/TradesResponse'
examples:
example:
summary: User trades response
value:
limit: 100
next_cursor: MTAw
count: 2
data:
- id: trade-123
taker_order_id: '0xabcdef1234567890abcdef1234567890abcdef12'
market: >-
0x0000000000000000000000000000000000000000000000000000000000000001
asset_id: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
side: BUY
size: '100000000'
fee_rate_bps: '30'
price: '0.5'
status: TRADE_STATUS_CONFIRMED
match_time: '1700000000'
last_update: '1700000000'
outcome: 'YES'
bucket_index: 0
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address: '0x1234567890123456789012345678901234567890'
transaction_hash: >-
0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
trader_side: TAKER
maker_orders: []
'400':
description: Bad request - Invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid trade params payload
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
TradesResponse:
type: object
description: Paginated trades response
required:
- limit
- next_cursor
- count
- data
properties:
limit:
type: integer
description: Maximum number of items per page
example: 100
next_cursor:
type: string
description: >-
Cursor for next page (base64 encoded offset). "LTE=" indicates no
more pages
example: MTAw
count:
type: integer
description: Number of items in current response
example: 2
data:
type: array
description: Array of trades
items:
$ref: '#/components/schemas/Trade'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
Trade:
type: object
description: Trade information
required:
- id
- taker_order_id
- market
- asset_id
- side
- size
- price
- status
- match_time
- last_update
- outcome
- bucket_index
- owner
- maker_address
- trader_side
properties:
id:
type: string
description: Trade ID
example: trade-123
taker_order_id:
type: string
description: Taker order ID (hash)
example: '0xabcdef1234567890abcdef1234567890abcdef12'
market:
type: string
description: Market (condition ID)
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
asset_id:
type: string
description: Asset ID (token ID)
example: >-
15871154585880608648532107628464183779895785213830018178010423617714102767076
side:
type: string
description: Trade side
enum:
- BUY
- SELL
example: BUY
size:
type: string
description: Trade size
example: '100000000'
fee_rate_bps:
type: string
description: Fee rate in basis points
example: '30'
price:
type: string
description: Trade price
example: '0.5'
status:
type: string
description: Trade status
enum:
- TRADE_STATUS_CONFIRMED
- TRADE_STATUS_FAILED
- TRADE_STATUS_RETRYING
- TRADE_STATUS_MATCHED
- TRADE_STATUS_MINED
example: TRADE_STATUS_CONFIRMED
match_time:
type: string
description: Match time (Unix timestamp)
example: '1700000000'
match_time_nano:
type: string
description: Match time in nanoseconds
example: '1700000000000000000'
last_update:
type: string
description: Last update time (Unix timestamp)
example: '1700000000'
outcome:
type: string
description: Market outcome
example: 'YES'
bucket_index:
type: integer
description: Bucket index
example: 0
owner:
type: string
description: Owner UUID
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address:
type: string
description: Maker address
pattern: ^0x[a-fA-F0-9]{40}$
example: '0x1234567890123456789012345678901234567890'
transaction_hash:
type: string
description: Transaction hash
pattern: ^0x[a-fA-F0-9]{64}$
example: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
err_msg:
type:
- string
- 'null'
description: Error message (if any)
example: null
maker_orders:
type: array
description: Array of maker orders associated with this trade
items:
type: object
properties:
order_id:
type: string
description: Order ID (hash)
owner:
type: string
description: Owner UUID
maker_address:
type: string
description: Maker address
matched_amount:
type: string
description: Matched amount
price:
type: string
description: Price
fee_rate_bps:
type: string
description: Fee rate in basis points
asset_id:
type: string
description: Asset ID
outcome:
type: string
description: Outcome
side:
type: string
enum:
- BUY
- SELL
example: []
trader_side:
type: string
description: Trader side (TAKER or MAKER)
enum:
- TAKER
- MAKER
example: TAKER
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
+315
View File
@@ -0,0 +1,315 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Get user orders
> Retrieves open orders for the authenticated user. Returns paginated results.
## OpenAPI
````yaml api-spec/clob-openapi.yaml get /orders
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/orders:
get:
tags:
- Trade
summary: Get user orders
description: >
Retrieves open orders for the authenticated user. Returns paginated
results.
operationId: getOrders
parameters:
- name: id
in: query
description: Order ID (hash) to filter by specific order
required: false
schema:
type: string
example: '0xabcdef1234567890abcdef1234567890abcdef12'
- name: market
in: query
description: Market (condition ID) to filter orders
required: false
schema:
type: string
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
- name: asset_id
in: query
description: Asset ID (token ID) to filter orders
required: false
schema:
type: string
example: 0xabc123def456...
- name: next_cursor
in: query
description: Cursor for pagination (base64 encoded offset)
required: false
schema:
type: string
example: MA==
responses:
'200':
description: Successfully retrieved orders
content:
application/json:
schema:
$ref: '#/components/schemas/OrdersResponse'
examples:
example:
summary: User orders response
value:
limit: 100
next_cursor: MTAw
count: 2
data:
- id: '0xabcdef1234567890abcdef1234567890abcdef12'
status: ORDER_STATUS_LIVE
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address: '0x1234567890123456789012345678901234567890'
market: >-
0x0000000000000000000000000000000000000000000000000000000000000001
asset_id: 0xabc123def456...
side: BUY
original_size: '100000000'
size_matched: '0'
price: '0.5'
outcome: 'YES'
expiration: '1735689600'
order_type: GTC
associate_trades: []
created_at: 1700000000
- id: '0xfedcba0987654321fedcba0987654321fedcba09'
status: ORDER_STATUS_LIVE
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address: '0x1234567890123456789012345678901234567890'
market: >-
0x0000000000000000000000000000000000000000000000000000000000000002
asset_id: 0xdef456abc789...
side: SELL
original_size: '200000000'
size_matched: '50000000'
price: '0.75'
outcome: 'NO'
expiration: '1735689600'
order_type: GTC
associate_trades:
- trade-123
created_at: 1700000001
'400':
description: Bad request - Invalid parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: invalid order params payload
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
OrdersResponse:
type: object
required:
- limit
- next_cursor
- count
- data
properties:
limit:
type: integer
description: Maximum number of results per page
example: 100
next_cursor:
type: string
description: >-
Cursor for pagination (base64 encoded offset). Empty if no more
results.
example: MTAw
count:
type: integer
description: Number of orders in this response
example: 2
data:
type: array
description: Array of open orders
items:
$ref: '#/components/schemas/OpenOrder'
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
OpenOrder:
type: object
required:
- id
- status
- owner
- maker_address
- market
- asset_id
- side
- original_size
- size_matched
- price
- expiration
- order_type
- created_at
- outcome
properties:
id:
type: string
description: Order ID (order hash)
example: '0xabcdef1234567890abcdef1234567890abcdef12'
status:
type: string
description: Order status
enum:
- ORDER_STATUS_LIVE
- ORDER_STATUS_INVALID
- ORDER_STATUS_CANCELED_MARKET_RESOLVED
- ORDER_STATUS_CANCELED
- ORDER_STATUS_MATCHED
owner:
type: string
description: UUID of the order owner
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
maker_address:
type: string
description: Ethereum address of the maker
example: '0x1234567890123456789012345678901234567890'
market:
type: string
description: Market (condition ID)
example: '0x0000000000000000000000000000000000000000000000000000000000000001'
asset_id:
type: string
description: Asset ID (token ID)
example: 0xabc123def456...
side:
type: string
description: Order side
enum:
- BUY
- SELL
example: BUY
original_size:
type: string
description: Original order size in fixed-math with 6 decimals
example: '100000000'
size_matched:
type: string
description: Size that has been matched in fixed-math with 6 decimals
example: '0'
price:
type: string
description: Order price
example: '0.5'
outcome:
type: string
description: Market outcome (YES/NO)
example: 'YES'
expiration:
type: string
description: Unix timestamp when the order expires
example: '1735689600'
order_type:
type: string
description: Order type
enum:
- GTC
- FOK
- GTD
- FAK
example: GTC
associate_trades:
type: array
description: Array of associated trade IDs
items:
type: string
example:
- trade-123
created_at:
type: integer
description: Unix timestamp when the order was created
example: 1700000000
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,376 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Post a new order
> Creates a new order in the order book
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /order
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/order:
post:
tags:
- Trade
summary: Post a new order
description: |
Creates a new order in the order book
operationId: postOrder
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SendOrder'
examples:
example:
summary: Send order example
value:
order:
maker: '0x1234567890123456789012345678901234567890'
signer: '0x1234567890123456789012345678901234567890'
taker: '0x0000000000000000000000000000000000000000'
tokenId: 0xabc123def456...
makerAmount: '100000000'
takerAmount: '200000000'
side: BUY
expiration: '1735689600'
nonce: '0'
feeRateBps: '30'
signature: 0x1234abcd...
salt: 1234567890
signatureType: 0
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
orderType: GTC
deferExec: false
responses:
'200':
description: Order successfully processed
content:
application/json:
schema:
$ref: '#/components/schemas/SendOrderResponse'
examples:
live_order:
summary: Order placed on book
value:
success: true
orderID: '0xabcdef1234567890abcdef1234567890abcdef12'
status: live
makingAmount: '100000000'
takingAmount: '200000000'
errorMsg: ''
matched_order:
summary: Order immediately matched
value:
success: true
orderID: '0xabcdef1234567890abcdef1234567890abcdef12'
status: matched
makingAmount: '100000000'
takingAmount: '200000000'
transactionsHashes:
- '0x1234567890abcdef1234567890abcdef12345678'
tradeIDs:
- trade-123
errorMsg: ''
delayed_order:
summary: Order delayed
value:
success: true
orderID: '0xabcdef1234567890abcdef1234567890abcdef12'
status: delayed
makingAmount: '100000000'
takingAmount: '200000000'
errorMsg: ''
'400':
description: Bad request - Invalid order payload or validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid order payload
value:
error: Invalid order payload
owner_mismatch:
summary: Owner mismatch
value:
error: the order owner has to be the owner of the API KEY
signer_mismatch:
summary: Signer mismatch
value:
error: >-
the order signer address has to be the address of the API
KEY
banned_address:
summary: Banned address
value:
error: '''0x1234...'' address banned'
closed_only_mode:
summary: Closed only mode violation
value:
error: '''0x1234...'' address in closed only mode'
invalid_order:
summary: Invalid order details
value:
error: >-
order 0xabc... is invalid. Price (100) breaks minimum tick
size rule: 0.1
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: could not insert order
'503':
description: Service unavailable - Trading disabled or cancel-only mode
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
trading_disabled:
summary: Trading disabled
value:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
cancel_only:
summary: Cancel-only mode
value:
error: >-
Trading is currently cancel-only. New orders are not
accepted, but cancels are allowed.
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
SendOrder:
type: object
required:
- order
- owner
properties:
order:
$ref: '#/components/schemas/Order'
owner:
type: string
description: UUID of the API key owner
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
orderType:
type: string
description: Time in force
enum:
- GTC
- FOK
- GTD
- FAK
default: GTC
deferExec:
type: boolean
description: Whether to defer execution
default: false
SendOrderResponse:
type: object
required:
- success
- orderID
- status
properties:
success:
type: boolean
description: Whether the order was successfully processed
example: true
orderID:
type: string
description: Unique identifier for the order (order hash)
example: '0xabcdef1234567890abcdef1234567890abcdef12'
status:
type: string
description: Status of the order after processing
enum:
- live
- matched
- delayed
makingAmount:
type: string
description: Amount the maker is providing in fixed-math with 6 decimals
example: '100000000'
takingAmount:
type: string
description: Amount the taker is providing in fixed-math with 6 decimals
example: '200000000'
transactionsHashes:
type: array
description: Array of transaction hashes (present when status is 'matched')
items:
type: string
example:
- '0x1234567890abcdef1234567890abcdef12345678'
tradeIDs:
type: array
description: Array of trade IDs (present when status is 'matched')
items:
type: string
errorMsg:
type: string
description: Error message (empty on success)
example: ''
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
Order:
type: object
required:
- maker
- signer
- taker
- tokenId
- makerAmount
- takerAmount
- side
- expiration
- nonce
- feeRateBps
- signature
- salt
- signatureType
properties:
maker:
type: string
description: >-
Ethereum address of the maker (In the default case, this is your
proxy address)
example: '0x1234567890123456789012345678901234567890'
signer:
type: string
description: Ethereum address of the signer
example: '0x1234567890123456789012345678901234567890'
taker:
type: string
description: Ethereum address of the taker (0x0 for open orders)
example: '0x0000000000000000000000000000000000000000'
tokenId:
type: string
description: Token ID (asset ID) for the order
example: 0xabc123def456...
makerAmount:
type: string
description: Amount the maker is providing in fixed-math with 6 decimals
example: '100000000'
takerAmount:
type: string
description: Amount the taker is providing in fixed-math with 6 decimals
example: '200000000'
side:
type: string
description: Order side
enum:
- BUY
- SELL
example: BUY
expiration:
type: string
description: Unix timestamp when the order expires
example: '1735689600'
nonce:
type: string
description: Order nonce
example: '0'
feeRateBps:
type: string
description: Fee rate in basis points
example: '30'
signature:
type: string
description: Cryptographic signature of the order
example: 0x1234abcd...
salt:
type: integer
description: Random salt for order uniqueness
example: 1234567890
signatureType:
type: integer
description: Type of signature (0 = EOA, 1 = POLY_PROXY, 2 = POLY_GNOSIS_SAFE)
enum:
- 0
- 1
- 2
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
@@ -0,0 +1,398 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Post multiple orders
> Creates multiple new orders in the order book. Orders are processed in parallel.
Maximum 15 orders per request.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /orders
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/orders:
post:
tags:
- Trade
summary: Post multiple orders
description: >
Creates multiple new orders in the order book. Orders are processed in
parallel.
Maximum 15 orders per request.
operationId: postOrders
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SendOrder'
maxItems: 15
examples:
example:
summary: Send multiple orders example
value:
- order:
maker: '0x1234567890123456789012345678901234567890'
signer: '0x1234567890123456789012345678901234567890'
taker: '0x0000000000000000000000000000000000000000'
tokenId: 0xabc123def456...
makerAmount: '100000000'
takerAmount: '200000000'
side: BUY
expiration: '1735689600'
nonce: '0'
feeRateBps: '30'
signature: 0x1234abcd...
salt: 1234567890
signatureType: 0
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
orderType: GTC
deferExec: false
- order:
maker: '0x1234567890123456789012345678901234567890'
signer: '0x1234567890123456789012345678901234567890'
taker: '0x0000000000000000000000000000000000000000'
tokenId: 0xdef456abc789...
makerAmount: '200000000'
takerAmount: '100000000'
side: SELL
expiration: '1735689600'
nonce: '0'
feeRateBps: '30'
signature: 0x5678efgh...
salt: 1234567891
signatureType: 0
owner: f4f247b7-4ac7-ff29-a152-04fda0a8755a
orderType: GTC
deferExec: false
responses:
'200':
description: >-
Orders successfully processed. Returns an array of order responses,
one for each order in the request.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SendOrderResponse'
examples:
mixed_results:
summary: Mixed order results
value:
- success: true
orderID: '0xabcdef1234567890abcdef1234567890abcdef12'
status: live
makingAmount: '100000000'
takingAmount: '200000000'
errorMsg: ''
- success: true
orderID: '0xfedcba0987654321fedcba0987654321fedcba09'
status: matched
makingAmount: '200000000'
takingAmount: '100000000'
transactionsHashes:
- '0x1234567890abcdef1234567890abcdef12345678'
tradeIDs:
- trade-123
errorMsg: ''
- success: false
orderID: ''
status: delayed
errorMsg: 'Rate limit exceeded for tokenId: 0xdef456abc789...'
'400':
description: Bad request - Invalid order payload or validation error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
invalid_payload:
summary: Invalid order payload
value:
error: Invalid order payload
empty_payload:
summary: Empty orders array
value:
error: Invalid order payload
too_many_orders:
summary: Too many orders
value:
error: 'Too many orders in payload: 20, max allowed: 15'
owner_mismatch:
summary: Owner mismatch
value:
error: the order owner has to be the owner of the API KEY
signer_mismatch:
summary: Signer mismatch
value:
error: >-
the order signer address has to be the address of the API
KEY
banned_address:
summary: Banned address
value:
error: '''0x1234...'' address banned'
closed_only_mode:
summary: Closed only mode violation
value:
error: '''0x1234...'' address in closed only mode'
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: could not insert order
'503':
description: Service unavailable - Trading disabled or cancel-only mode
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
trading_disabled:
summary: Trading disabled
value:
error: >-
Trading is currently disabled. Check polymarket.com for
updates
cancel_only:
summary: Cancel-only mode
value:
error: >-
Trading is currently cancel-only. New orders are not
accepted, but cancels are allowed.
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
SendOrder:
type: object
required:
- order
- owner
properties:
order:
$ref: '#/components/schemas/Order'
owner:
type: string
description: UUID of the API key owner
example: f4f247b7-4ac7-ff29-a152-04fda0a8755a
orderType:
type: string
description: Time in force
enum:
- GTC
- FOK
- GTD
- FAK
default: GTC
deferExec:
type: boolean
description: Whether to defer execution
default: false
SendOrderResponse:
type: object
required:
- success
- orderID
- status
properties:
success:
type: boolean
description: Whether the order was successfully processed
example: true
orderID:
type: string
description: Unique identifier for the order (order hash)
example: '0xabcdef1234567890abcdef1234567890abcdef12'
status:
type: string
description: Status of the order after processing
enum:
- live
- matched
- delayed
makingAmount:
type: string
description: Amount the maker is providing in fixed-math with 6 decimals
example: '100000000'
takingAmount:
type: string
description: Amount the taker is providing in fixed-math with 6 decimals
example: '200000000'
transactionsHashes:
type: array
description: Array of transaction hashes (present when status is 'matched')
items:
type: string
example:
- '0x1234567890abcdef1234567890abcdef12345678'
tradeIDs:
type: array
description: Array of trade IDs (present when status is 'matched')
items:
type: string
errorMsg:
type: string
description: Error message (empty on success)
example: ''
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
Order:
type: object
required:
- maker
- signer
- taker
- tokenId
- makerAmount
- takerAmount
- side
- expiration
- nonce
- feeRateBps
- signature
- salt
- signatureType
properties:
maker:
type: string
description: >-
Ethereum address of the maker (In the default case, this is your
proxy address)
example: '0x1234567890123456789012345678901234567890'
signer:
type: string
description: Ethereum address of the signer
example: '0x1234567890123456789012345678901234567890'
taker:
type: string
description: Ethereum address of the taker (0x0 for open orders)
example: '0x0000000000000000000000000000000000000000'
tokenId:
type: string
description: Token ID (asset ID) for the order
example: 0xabc123def456...
makerAmount:
type: string
description: Amount the maker is providing in fixed-math with 6 decimals
example: '100000000'
takerAmount:
type: string
description: Amount the taker is providing in fixed-math with 6 decimals
example: '200000000'
side:
type: string
description: Order side
enum:
- BUY
- SELL
example: BUY
expiration:
type: string
description: Unix timestamp when the order expires
example: '1735689600'
nonce:
type: string
description: Order nonce
example: '0'
feeRateBps:
type: string
description: Fee rate in basis points
example: '30'
signature:
type: string
description: Cryptographic signature of the order
example: 0x1234abcd...
salt:
type: integer
description: Random salt for order uniqueness
example: 1234567890
signatureType:
type: integer
description: Type of signature (0 = EOA, 1 = POLY_PROXY, 2 = POLY_GNOSIS_SAFE)
enum:
- 0
- 1
- 2
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
+138
View File
@@ -0,0 +1,138 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Send heartbeat
> Sends a heartbeat signal to maintain active session status.
If heartbeats are not sent regularly, all open orders for the user will be automatically canceled.
This is useful for automated trading systems that need to ensure orders are canceled
if the system becomes unresponsive.
## OpenAPI
````yaml api-spec/clob-openapi.yaml post /heartbeats
openapi: 3.1.0
info:
title: Polymarket CLOB API
description: Polymarket CLOB API Reference
license:
name: MIT
identifier: MIT
version: 1.0.0
servers:
- url: https://clob.polymarket.com
description: Production CLOB API
- url: https://clob-staging.polymarket.com
description: Staging CLOB API
security: []
tags:
- name: Trade
description: Trade endpoints
- name: Markets
description: Market data endpoints
- name: Account
description: Account and authentication endpoints
- name: Notifications
description: User notification endpoints
- name: Rewards
description: Rewards and earnings endpoints
paths:
/heartbeats:
post:
tags:
- Trade
summary: Send heartbeat
description: >
Sends a heartbeat signal to maintain active session status.
If heartbeats are not sent regularly, all open orders for the user will
be automatically canceled.
This is useful for automated trading systems that need to ensure orders
are canceled
if the system becomes unresponsive.
operationId: sendHeartbeat
responses:
'200':
description: Heartbeat acknowledged
content:
application/json:
schema:
$ref: '#/components/schemas/HeartbeatResponse'
example:
status: ok
'401':
description: Unauthorized - Invalid API key or authentication failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Invalid API key
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
error: Internal server error
security:
- polyApiKey: []
polyAddress: []
polySignature: []
polyPassphrase: []
polyTimestamp: []
components:
schemas:
HeartbeatResponse:
type: object
description: Response for heartbeat request
required:
- status
properties:
status:
type: string
description: Status of the heartbeat acknowledgment
example: ok
ErrorResponse:
type: object
required:
- error
properties:
error:
type: string
description: Error message
securitySchemes:
polyApiKey:
type: apiKey
in: header
name: POLY_API_KEY
description: Your API key
polyAddress:
type: apiKey
in: header
name: POLY_ADDRESS
description: Ethereum address associated with the API key
polySignature:
type: apiKey
in: header
name: POLY_SIGNATURE
description: HMAC signature of the request
polyPassphrase:
type: apiKey
in: header
name: POLY_PASSPHRASE
description: API key passphrase
polyTimestamp:
type: apiKey
in: header
name: POLY_TIMESTAMP
description: Unix timestamp of the request
````
+7
View File
@@ -0,0 +1,7 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Market Channel
> Public WebSocket for real-time orderbook, price, and market lifecycle updates.
+7
View File
@@ -0,0 +1,7 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Sports Channel
> Public WebSocket for real-time sports match results.
+7
View File
@@ -0,0 +1,7 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# User Channel
> Authenticated WebSocket for real-time order and trade updates.
+147
View File
@@ -0,0 +1,147 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# API Keys
> Create and manage your Builder API credentials
Builder API keys authenticate your application with Polymarket's relayer and enable order attribution. You'll need these credentials to access gasless transactions and track volume.
## Accessing Your Builder Profile
<Steps>
<Step title="Direct Link">
Go to
[polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
</Step>
<Step title="From Menu">Click your profile image → Select "Builders"</Step>
</Steps>
## Creating API Keys
In the **Builder Keys** section of your profile:
1. Click **"+ Create New"** to generate a new API key
2. **Copy all three values immediately** — the secret and passphrase are only shown once
3. Store them securely in your secrets manager or environment variables
Each API key includes three components:
| Component | Description | Example |
| ------------ | ------------------------------------------ | ----------------------- |
| `key` | Public identifier for your builder account | `abc123-def456-...` |
| `secret` | Secret key for signing requests | `base64-encoded-secret` |
| `passphrase` | Additional authentication value | `your-passphrase` |
<Warning>
The `secret` and `passphrase` are only displayed once when created. If you
lose them, you'll need to generate a new key.
</Warning>
## Managing Keys
Create separate keys for different environments:
| Environment | Purpose |
| ----------- | ----------------------------- |
| Development | Testing and local development |
| Staging | Pre-production testing |
| Production | Live trading |
## Profile Settings
Your builder profile includes customizable settings:
| Setting | Description |
| ------------------- | ----------------------------------------------------------------------- |
| **Profile Picture** | Displayed on the [Builder Leaderboard](https://builders.polymarket.com) |
| **Builder Name** | Public name shown on the leaderboard |
| **Builder Address** | Your unique builder identifier (read-only) |
| **Current Tier** | Your rate limit tier: Unverified, Verified, or Partner |
## Environment Variables
Store your credentials as environment variables:
<Tabs>
<Tab title="Bash">
```bash .env theme={null}
POLY_BUILDER_API_KEY=your-api-key
POLY_BUILDER_SECRET=your-secret
POLY_BUILDER_PASSPHRASE=your-passphrase
```
</Tab>
<Tab title="TypeScript">
```typescript theme={null}
import { BuilderApiKeyCreds } from "@polymarket/builder-signing-sdk";
const builderCreds: BuilderApiKeyCreds = {
key: process.env.POLY_BUILDER_API_KEY!,
secret: process.env.POLY_BUILDER_SECRET!,
passphrase: process.env.POLY_BUILDER_PASSPHRASE!,
};
```
</Tab>
<Tab title="Python">
```python theme={null}
import os
from py_builder_signing_sdk import BuilderApiKeyCreds
builder_creds = BuilderApiKeyCreds(
key=os.environ["POLY_BUILDER_API_KEY"],
secret=os.environ["POLY_BUILDER_SECRET"],
passphrase=os.environ["POLY_BUILDER_PASSPHRASE"],
)
```
</Tab>
</Tabs>
## Security Best Practices
| Practice | Description |
| ----------------------------- | --------------------------------------------------------- |
| **Never commit credentials** | Use `.gitignore` to exclude `.env` files |
| **Use environment variables** | Load credentials from env vars, not hardcoded strings |
| **Use a secrets manager** | AWS Secrets Manager, HashiCorp Vault, etc. for production |
| **Separate environments** | Use different keys for dev, staging, and production |
| **Monitor usage** | Check the leaderboard for unexpected volume changes |
<Warning>
**Never expose Builder API credentials in client-side code.** Your secret and
passphrase must stay on your server.
</Warning>
## Troubleshooting
<AccordionGroup>
<Accordion title="Rate limit exceeded">
**Cause:** You've exceeded your tier's daily transaction limit.
**Solution:**
* Wait until the daily limit resets
* [Contact Polymarket](/builders/tiers#contact) to upgrade your tier
</Accordion>
<Accordion title="Lost secret or passphrase">
**Cause:** The secret and passphrase are only shown once when created.
**Solution:** Create a new API key. You cannot recover the original values.
</Accordion>
</AccordionGroup>
## Next Steps
<CardGroup cols={2}>
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
Configure your client to credit trades to your account.
</Card>
<Card title="Understand Tiers" icon="layer-group" href="/builders/tiers">
Learn about rate limits and how to upgrade.
</Card>
</CardGroup>
+218
View File
@@ -0,0 +1,218 @@
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.
# Builder Program
> Build applications that route orders through Polymarket
A **builder** is a person, group, or organization that routes orders from users to Polymarket. If you've created a platform that allows users to trade on Polymarket through your system, this program is for you.
## Program Benefits
<CardGroup cols={2}>
<Card title="Gasless Transactions" icon="gas-pump">
All onchain operations are gas-free through our relayer
</Card>
<Card title="Order Attribution" icon="tag">
Get credit for orders and compete for grants on the Builder Leaderboard
</Card>
</CardGroup>
<Card title="Revenue Share" icon="percent">
Earn a share of fees on orders you route
</Card>
### What You Get
| Benefit | Description |
| ------------------- | ------------------------------------------------------------------------------- |
| **Relayer Access** | Gas-free wallet deployment, approvals, order execution and CTF operations |
| **Volume Tracking** | All orders attributed to your builder profile |
| **Weekly Rewards** | USDC rewards program based on volume (Verified+) |
| **Leaderboard** | Public visibility on [builders.polymarket.com](https://builders.polymarket.com) |
| **Support** | Telegram channel and engineering support (Verified+) |
<Warning>
EOA wallets do not have relayer access. Users trading directly from an EOA pay
their own gas fees.
</Warning>
## How It Works
<Steps>
<Step title="User Places Order">
User places an order through your application.
</Step>
<Step title="Sign Request">
Your app signs the request with Builder API credentials.
</Step>
<Step title="Submit to CLOB">
Order is submitted to Polymarket's CLOB with attribution headers.
</Step>
<Step title="Trade Execution">
Polymarket matches the order and covers gas fees for onchain operations.
</Step>
<Step title="Volume Attribution">
Volume is credited to your builder account.
</Step>
</Steps>
## Getting Started
<Steps>
<Step title="Create Builder Profile">
Go to
[polymarket.com/settings?tab=builder](https://polymarket.com/settings?tab=builder)
and generate your API keys.
</Step>
<Step title="Configure Attribution">
Set up your CLOB client to include builder authentication headers with every
order.
</Step>
<Step title="Enable Gasless Transactions">
Use the Relayer Client for gas-free wallet deployment and onchain
operations.
</Step>
<Step title="Track Performance">
Monitor your volume on the [Builder
Leaderboard](https://builders.polymarket.com).
</Step>
</Steps>
## SDKs & Libraries
<CardGroup cols={2}>
<Card title="CLOB Client (TypeScript)" icon="github" href="https://github.com/Polymarket/clob-client">
Place orders with builder attribution
</Card>
<Card title="CLOB Client (Python)" icon="github" href="https://github.com/Polymarket/py-clob-client">
Place orders with builder attribution
</Card>
<Card title="Relayer Client (TypeScript)" icon="github" href="https://github.com/Polymarket/builder-relayer-client">
Gasless onchain transactions
</Card>
<Card title="Relayer Client (Python)" icon="github" href="https://github.com/Polymarket/py-builder-relayer-client">
Gasless onchain transactions
</Card>
<Card title="CLOB Client (Rust)" icon="github" href="https://github.com/Polymarket/rs-clob-client">
Place orders with builder attribution
</Card>
<Card title="Signing SDK (TypeScript)" icon="github" href="https://github.com/Polymarket/builder-signing-sdk">
Sign builder authentication headers
</Card>
<Card title="Signing SDK (Python)" icon="github" href="https://github.com/Polymarket/py-builder-signing-sdk">
Sign builder authentication headers
</Card>
</CardGroup>
## Examples
These open-source demo applications show how to integrate Polymarket's CLOB Client and Builder Relayer Client for gasless trading with builder order attribution.
<CardGroup cols={3}>
<Card title="Authentication" icon="user-check">
Multiple wallet providers
</Card>
<Card title="Gasless Trading" icon="gas-pump">
Safe & Proxy wallet support
</Card>
<Card title="Full Integration" icon="puzzle-piece">
Orders, positions, CTF ops
</Card>
</CardGroup>
### Safe Wallet Examples
Deploy Gnosis Safe wallets for your users:
<CardGroup cols={2}>
<Card title="wagmi + Safe" icon="wallet" href="https://github.com/Polymarket/wagmi-safe-builder-example">
MetaMask, Phantom, Rabby, and other browser wallets
</Card>
<Card title="Privy + Safe" icon="shield-check" href="https://github.com/Polymarket/privy-safe-builder-example">
Privy embedded wallets
</Card>
<Card title="Magic Link + Safe" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-safe-builder-example">
Magic Link email/social authentication
</Card>
<Card title="Turnkey + Safe" icon="key" href="https://github.com/Polymarket/turnkey-safe-builder-example">
Turnkey embedded wallets
</Card>
</CardGroup>
### Proxy Wallet Examples
For existing Magic Link users from Polymarket.com:
<CardGroup cols={1}>
<Card title="Magic Link + Proxy" icon="wand-magic-sparkles" href="https://github.com/Polymarket/magic-proxy-builder-example">
Auto-deploying proxy wallets for Polymarket.com Magic users
</Card>
</CardGroup>
### What Each Demo Covers
<Tabs>
<Tab title="Authentication">
* User sign-in via wallet provider
* User API credential derivation (L2 auth)
* Builder config with remote signing
* Signature types for Safe vs Proxy wallets
</Tab>
<Tab title="Wallet Operations">
* Safe wallet deployment via Relayer
* Batch token approvals (USDC.e + outcome tokens)
* CTF operations (split, merge, redeem)
* Transaction monitoring
</Tab>
<Tab title="Trading">
* CLOB client initialization
* Order placement with builder attribution
* Position and order management
* Market discovery via Gamma API
</Tab>
</Tabs>
***
## Next Steps
<CardGroup cols={2}>
<Card title="Get API Keys" icon="key" href="/builders/api-keys">
Create and manage your Builder API credentials.
</Card>
<Card title="Understand Tiers" icon="layer-group" href="/builders/tiers">
Learn about rate limits and how to upgrade.
</Card>
<Card title="Attribute Orders" icon="tag" href="/trading/orders/attribution">
Configure your client to credit trades to your account.
</Card>
<Card title="Gasless Guide" icon="gas-pump" href="/trading/gasless">
Set up gasless transactions for your users.
</Card>
</CardGroup>

Some files were not shown because too many files have changed in this diff Show More