Polymarket API Complete Guide 2026 — Build Your Own Tools
Polymarket's API is what makes automated trading possible on the platform. From simple market data scrapers to full trading bots, the API is the foundation. This guide covers everything you need to get started in 2026.
What the Polymarket API Offers
Polymarket provides two main ways to access data programmatically:
1. REST API (CLOB API)The main trading API — query market data, place orders, manage positions. Requires authentication for trading operations. Base URL: clob.polymarket.com
Market metadata and analytics. Covers market details, categories, resolution information, and historical data. No auth required for read operations. Base URL: gamma-api.polymarket.com
Real-time order book updates, price changes, and market events. Lower latency than polling.
Authentication Setup
Trading requires authentication via Polymarket's wallet-based auth system.
Step 1: Create your API credentialsYou need a wallet connected to Polymarket. The API uses signature-based authentication — you sign requests with your private key.
Step 2: Store your credentialsfrom py_clob_client.client import ClobClientfrom py_clob_client.clob_types import ApiCreds
Initialize client
client = ClobClient(
host="https://clob.polymarket.com",
chain_id=137, # Polygon
private_key="YOUR_PRIVATE_KEY"
)
Create API key
api_creds = client.create_api_key()
print(api_creds)
Important: Never hardcode credentials. Use environment variables.api_key = "YOUR_API_KEY"api_secret = "YOUR_API_SECRET"
api_passphrase = "YOUR_PASSPHRASE"
Getting Market Data
List all markets
from py_clob_client.client import ClobClientclient = ClobClient("https://clob.polymarket.com", chain_id=137)
Get all active markets
markets = client.get_markets()
for market in markets["data"]:
print(f"{market['question']} — Yes: {market['tokens'][0]['price']}")
Get a specific market
Get market by condition ID
market = client.get_market(condition_id="YOUR_CONDITION_ID")
print(market)
Get order book
Current bids and asks
order_book = client.get_order_book(token_id="YES_TOKEN_ID")
print(f"Best bid: {order_book.bids[0].price}")
print(f"Best ask: {order_book.asks[0].price}")
Placing Orders
Market order
from py_clob_client.clob_types import MarketOrderArgs, OrderTypeorder_args = MarketOrderArgs(
token_id="YES_TOKEN_ID",
amount=100, # USDC amount to spend
)
Sign and submit
signed_order = client.create_market_order(order_args)
response = client.post_order(signed_order, OrderType.FOK)
print(response)
Limit order
from py_clob_client.clob_types import LimitOrderArgsorder_args = LimitOrderArgs(
token_id="YES_TOKEN_ID",
price=0.65, # 65 cents per share
size=100, # 100 shares
side="BUY",
)
signed_order = client.create_limit_order(order_args)
response = client.post_order(signed_order)
Getting Your Positions
Get open positions
positions = client.get_positions()
for pos in positions:
print(f"Market: {pos['market']} — Size: {pos['size']} — Entry: {pos['avg_price']}")
Get trade history
trades = client.get_trades()
Monitoring Other Traders (Read-Only)
Polymarket trader profiles are public. You can query any trader's positions without authentication:
import requestsGet a trader's positions by their address
def get_trader_positions(address: str):
url = f"https://data-api.polymarket.com/positions?user={address}"
response = requests.get(url)
return response.json()
Track top trader
positions = get_trader_positions("0xYOUR_TARGET_ADDRESS")
for pos in positions:
print(f"{pos['market']}: {pos['size']} shares at {pos['avgPrice']}")
Building a Simple Price Monitor
import timeimport requests
def monitor_market(condition_id: str, threshold: float):
"""Alert when Yes price crosses threshold"""
url = f"https://clob.polymarket.com/markets/{condition_id}"
while True:
response = requests.get(url)
market = response.json()
yes_price = float(market["tokens"][0]["price"])
if yes_price < threshold:
print(f"ALERT: Yes price dropped to {yes_price}")
# Send notification here
time.sleep(30) # Poll every 30 seconds
monitor_market("YOUR_CONDITION_ID", 0.4)
Building a Simple Arbitrage Monitor
import requestsdef check_arb_opportunity(polymarket_id: str, kalshi_market_id: str):
# Get Polymarket price
pm_response = requests.get(
f"https://clob.polymarket.com/markets/{polymarket_id}"
)
pm_yes = float(pm_response.json()["tokens"][0]["price"])
# Get Kalshi price
kalshi_response = requests.get(
f"https://trading-api.kalshi.com/trade-api/v2/markets/{kalshi_market_id}",
headers={"accept": "application/json"}
)
kalshi_yes = kalshi_response.json()["market"]["yes_ask"] / 100
# Calculate arbitrage spread
spread = abs(pm_yes - kalshi_yes)
if spread > 0.03: # 3% threshold
print(f"ARB OPPORTUNITY: {spread:.1%} spread")
print(f" Polymarket Yes: {pm_yes:.3f}")
print(f" Kalshi Yes: {kalshi_yes:.3f}")
return spread
check_arb_opportunity("PM_CONDITION_ID", "KALSHI_MARKET_ID")
Official SDK
Polymarket maintains the py_clob_client Python package:
pip install py_clob_client
JavaScript traders can use community-maintained clients. Check LaunchPoly's tools directory for the latest SDK options.
Rate Limits
Polymarket's CLOB API has rate limits:
- Unauthenticated: 10 requests/second
- Authenticated: 100 requests/second
Design your bot around these limits. For real-time monitoring, prefer WebSocket connections over polling.
What to Build
The most common things traders build with the Polymarket API:
Alerts: Get notified when a market moves past a threshold, when a tracked trader enters a position, or when a new market is created in a category you care about. Analytics: Build your own dashboards tracking your PnL over time, win rates by category, and position history. Bots: Automated liquidity provision, arbitrage monitoring, or systematic strategies based on your own research. Portfolio trackers: Aggregate your Polymarket and Kalshi positions in one view with real-time P&L.For pre-built tools and bots, see the LaunchPoly tools directory.
FAQ
Is the Polymarket API free?Yes — API access is free. You pay standard trading fees on executed orders, but API access itself has no cost.
Can I use the Polymarket API without a wallet?Read-only operations (market data, order books) don't require a wallet. Placing trades or accessing your account requires wallet authentication.
What programming language works best for Polymarket bots?Python is the most common choice with the best library support (py_clob_client). JavaScript/TypeScript works well for web-based tools. Rust is used by some high-frequency traders for latency reasons.
How do I find market condition IDs?Via the Gamma API: GET https://gamma-api.polymarket.com/markets returns all active markets with their condition IDs. You can also extract condition IDs from Polymarket URLs.




