The Polymarket API is a set of public web services for reading Polymarket’s markets and trading on them from code. You can pull every market and its prices, read live order books, stream price and trade updates, and place and cancel orders on your own account. Reading data needs no key. Trading needs API credentials tied to your wallet.
Many people who search for it want to build a Polymarket trading bot. I run one, and the second half of this guide covers what that involves. In short, bots are for advanced traders, a mistake in one can cost a lot, and you should never download a ready-made bot from the internet. The official API docs are the reference for everything technical here.
The Polymarket APIs and What Each Does
Polymarket splits its API into separate services. Each has its own base URL and its own rate limits.
| API | Base URL | What it is for | Key needed? |
|---|---|---|---|
| Gamma API | gamma-api.polymarket.com | Finding events and markets, with their metadata and token IDs | No |
| CLOB API | clob.polymarket.com | Prices, order books, midpoints, then placing and managing orders | Only for orders and account data |
| Data API (v2) | data-api.polymarket.com/v2/ | Positions, trades, activity, holders, leaderboards, P&L | No |
| WebSockets | ws-subscriptions-clob.polymarket.com and others | Live order book updates and your own order and trade updates | Market channel no, user channel yes |
| Relayer API | relayer-v2.polymarket.com | Gasless wallet transactions, so the account does not need POL for gas | Relayer API key |
| Bridge API | bridge.polymarket.com | Deposits and withdrawals in supported assets | See its docs |
Source: Polymarket’s API overview and API getting-started page.
A few details that trip people up:
- Gamma is where you start. Each market has two outcome token IDs in its
clobTokenIdsfield. You look those up in Gamma, then use them with the CLOB endpoints. The field comes back as a JSON-encoded string, so parse it before you use the IDs. - Data API v1 is gone. The old unversioned endpoints such as
/tradesnow return HTTP 410. Use the/v2/paths, which have cursor pagination and a shared response format. The docs have a v1 to v2 migration guide. - Not every stream is public. The CLOB market channel is public. The user channel needs your credentials, and so do reference price subscriptions (crypto and equity prices) on Polymarket’s live data feed.
Here is a public request that needs nothing but curl. It lists open markets from the Gamma API:
curl -G "https://gamma-api.polymarket.com/markets" \
--data-urlencode "closed=false" \
--data-urlencode "limit=1"
It returns a JSON array of markets, each with its question, slug, outcome prices and clobTokenIds. Pass one of those token IDs to https://clob.polymarket.com/midpoint?token_id=... and you get the current midpoint price. Both calls worked without a key when checked on November 19, 2026.
Getting Started with the Polymarket API
Pick an SDK
Polymarket’s current SDKs are unified: one client covers market data, trading, account data and real-time subscriptions.
The older py-clob-client and the TypeScript CLOB client still appear in a lot of tutorials and GitHub repos. They are the previous generation, and the docs have a migration guide from the legacy SDKs to the unified SDKs. A unified Rust SDK is in development.
My current bot is written in TypeScript on Node.js with @polymarket/client. My earlier bots were Python with py-clob-client.
Keys, wallets and signing
Trading authentication has two layers (docs):
- L1: your wallet signs an EIP-712 message. That proves you control the wallet and lets you create or derive CLOB API credentials: an API key, a secret and a passphrase.
- L2: every private request (placing orders, listing your orders) is signed with that secret using HMAC-SHA256 and sent with five
POLY_headers.
Each order is also signed by the wallet itself, so the API key alone cannot place an order. The SDKs handle all of this. You only write it by hand if you call the API directly.
Account wallets created on or after May 4, 2026 are Deposit Wallets. To connect an existing polymarket.com account, you also create a Relayer API key under Settings, API Keys, Relayer API Keys, which authorizes gasless wallet operations. A Deposit Wallet can give a separate signer scoped, time-limited trading access through session keys. A session key can trade but cannot withdraw funds, so your main key can stay off the bot’s server. Older accounts created through Magic Link, Google or an external wallet use Proxy or Safe wallets, which the SDKs also support (wallets and authentication).
Geographic rules for API users
Polymarket restricts order placement by location, and the rules for the API are not always the same as for the website. The docs list three groups (geographic restrictions):
| Group | Website | API |
|---|---|---|
| OFAC-sanctioned (Iran, Syria, Cuba, North Korea, Crimea, Donetsk, Luhansk) | Blocked completely, including closing positions | Blocked completely |
| Close-only on website and API (includes the US, the UK, France, Germany and others) | Close existing positions only | Close existing positions only |
| Close-only on the website only (includes Ireland, Japan, the Netherlands and Malta for sports markets) | Close existing positions only | Not restricted |
Local law is a separate matter from this list, and Japan in particular has its own gambling rules. Countries that block polymarket.com at the internet provider level are also a separate issue from Polymarket’s own restrictions. Our country checker shows each country’s status.
Your code can check the current status with GET https://polymarket.com/api/geoblock, which returns whether the calling IP is blocked, plus its country and region. The docs recommend running this check before placing orders, because orders from blocked regions are rejected.
Rate limits
There are two kinds of limit.
IP-based limits run through Cloudflare. When you exceed one, requests are throttled (delayed and queued) rather than rejected outright. A sample from the rate limits page:
| Endpoint | Limit |
|---|---|
| Gamma API, general | 4,000 requests per 10 seconds |
Gamma /markets | 300 per 10 seconds |
| CLOB API, general | 9,000 per 10 seconds |
CLOB /book | 1,500 per 10 seconds |
POST /order | 5,000 per 10 seconds burst, 120,000 per 10 minutes sustained |
| Data API v2, general | 800 per 10 seconds |
Per-signer limits are token buckets on order and cancel requests, tiered by your 30-day volume (trading rate limits). The Standard tier allows 40 orders per second with a burst of 60, and 80 cancels per second with a burst of 120. Tiers rise to 600 orders per second at $10M+ of volume. Under live enforcement, a request over the limit gets HTTP 429 with a Retry-After header. While the limiter runs in warning mode, requests still go through and the would-be rejections carry a Poly-RateLimit-Warning: true header. Check the docs for the current status, and handle both.
For most bots, subscribing to the WebSocket market channel works better than polling order books. The market-making docs recommend the same.
Building a Polymarket Trading Bot
Bots are for advanced traders. A bot places orders faster than you can watch them, so a bug or a wrong assumption can lose a lot of money before you notice. If you have not traded Polymarket by hand for a while, start there.
Everyone uses AI to help write code now. With a bot that trades real money, you still have to know what every part of the code does, because a glitch costs real money.
Strategy types
Three kinds of strategy are realistic for an individual.
Arbitrage. These bots look for prices on Polymarket that do not add up. In a multi-outcome event, for example, the outcome prices should sum to about $1. A complete set of YES and NO shares always redeems for $1, so a pair that costs less than that, after fees, is a gap.
Market making. A market maker posts bids and asks around a fair value and earns the spread when other traders fill them. Orders cannot be edited in place, so every price change means a cancel and a replacement order. You also manage inventory: buy orders use pUSD and sell orders need the outcome tokens. See our market-making strategy guide for the trading side.
I started with a few arbitrage bots, then moved to market making, and my current bot mixes the two. It is almost entirely a maker bot and takes liquidity only when prices are significantly away from fair value.
News and event reaction. These bots watch a news or data source and trade when something changes the odds. This is what I would build next, especially for smaller markets without big competitors. Our news trading guide covers the manual version of this strategy.
Fees and maker rebates
Fees decide which strategies can work. On Polymarket only takers pay a trading fee; makers, whose resting orders get filled, pay none. The taker fee follows the formula fee = shares × feeRate × price × (1 − price), with a rate set by market category, and geopolitics markets are fee-free. Makers can also earn rebates funded by taker fees. Rates and rebate rules change from time to time, so check our fees guide for the current numbers.
For a bot, a strategy that takes on every trade pays the fee every time, so its edge has to be bigger than the fee. A maker strategy pays no fee but carries the risk of being filled just before the price moves against it.
Infrastructure and latency
The docs list Polymarket’s primary servers in AWS eu-west-2 (London), with eu-west-1 as the closest region that is not georestricted. Traders who complete a KYC/KYB form can co-locate directly in eu-west-2. That option is open to market makers and individual traders on their own accounts, and closed to Builder Program participants and apps that trade on behalf of users (geographic restrictions page).
Polymarket is also building a new exchange engine, NEX, which it describes as a drop-in replacement for the CLOB API. It is in a sandbox beta on a test network for approved testers (NEX overview).
My bot runs on a VPS in an Amsterdam data center. I am not very latency-sensitive, and most of the latency comes from the blockchain side anyway, so a few milliseconds from being in another country makes no difference to my strategy. Being right next to Polymarket’s servers requires KYC.
Risk controls
The docs list several controls for market makers (market making, manage orders, matching engine restarts). They apply to any bot:
- Size limits. Cap position size per market and in total, and check balances before quoting.
- Price guards. Compare every order price with the book midpoint and reject outliers before they are sent.
- A kill switch. Cancel all open orders when errors pile up or a position limit is hit.
- Order heartbeats (optional). Once you send a first heartbeat, the server queues a best-effort cancel-all of that API key’s open orders whenever 10 seconds pass without another, so plan to send one every 5 seconds. There is no endpoint to switch it off, and a single test call with production credentials can put your live orders at risk.
- Restart handling. The matching engine restarts for maintenance and rejects order actions while it is down. Afterwards it runs in post-only mode for two minutes: cancels work, and new orders must be post-only maker orders. Restarts are announced in advance on Polymarket’s Trading APIs Telegram channel and Discord.
- Reconciliation. After any disconnect, fetch your open orders and recent trades before the bot resumes.
Start with small sizes and watch the bot trade for a while before you give it more money.
Bot Scams and “Copy Trading Bots”
Never download a “Polymarket trading bot” from a website, a GitHub repo you found through an ad, a Telegram group or a YouTube video. Many are scams that steal your money, and some carry malware. Never give anyone your private key.
“Copy trading bots” that mirror large wallets are a common pitch. I am strongly against them. You buy after the trader you copy has already moved the price, and the information behind their trade is usually priced in by the time you see it. Our guide to copy trading on Polymarket explains why it fails.
If you want a bot, build it yourself from the official SDKs and the official docs, and make sure you understand every line.
Open an Account Before You Build
A bot trades from an ordinary Polymarket account, so you need one with funds in it. Signing up is free. The SDK connects to the account with the wallet address from your profile menu and a Relayer API key. Check your country’s status first, then open your Polymarket account and make a deposit.
Sign up for PolymarketRelated Guides
- Market Making on Polymarket: the trading side of quoting both sides
- Polymarket Fees Explained: taker fees by category
- News Trading: trading on events as they happen
- Copy Trading on Polymarket: why mirroring wallets fails
- Country Availability Checker: where you can trade
- Polymarket Perps: perpetual futures with their own country rules