API · Reference
The Gamma API at gamma-api.polymarket.com is the "catalog" — it's how you
discover markets and events and get the token IDs the CLOB needs. It's public,
no auth, so you can explore it from a browser or curl right now.
- Base URL:
https://gamma-api.polymarket.com· no authentication. - Rate limit: ~4,000 requests / 10s (
/events500,/markets300). - Step 1 of almost every bot: turn a market into its token IDs, then trade on the CLOB.
The main endpoints
| Endpoint | Returns |
|---|---|
GET /markets | Markets with metadata, prices, token IDs. Filter by slug=, tag_slug=, active=, closed=. |
GET /events | Events (a group of related markets), with their child markets. |
GET /public-search?q= | Full-text search over markets and events. |
The #1 gotcha: JSON-encoded string fields
Gamma returns clobTokenIds, outcomes and outcomePrices as
JSON-encoded strings inside the JSON — you must decode them again. And don't hardcode which
token is "Yes": read the parsed outcomes array and map by name.
import requests, json
m = requests.get("https://gamma-api.polymarket.com/markets",
params={"slug": SLUG}).json()[0]
outcomes = json.loads(m["outcomes"]) # e.g. ["Yes", "No"]
token_ids = json.loads(m["clobTokenIds"]) # aligned with outcomes
yes_token = token_ids[outcomes.index("Yes")]
print(yes_token)
curl -s "https://gamma-api.polymarket.com/markets?slug=$SLUG" | jq '.[0].clobTokenIds'
Scan for tradeable markets
A typical bot's discovery query — active, open, busiest first:
GET https://gamma-api.polymarket.com/markets
?active=true&closed=false&order=volume24hr&ascending=false&limit=20&tag_slug=politics
conditionId and its clobTokenIds (one per outcome). The CLOB trades on
token_id, not conditionId — mixing them up is the most common first-bot bug.Next: CLOB API (trade on a token_id) · Data API (history) · Fix an error.




