📄 api-endpoints.md

← Vault

Polymarket API Endpoints Reference

All endpoints are public REST (GET), return JSON, and need no authentication.

Gamma API — gamma-api.polymarket.com

Search Markets

`

GET /public-search?q=QUERY

`

Response structure:

`json

{

"events": [

{

"id": "12345",

"title": "Event title",

"slug": "event-slug",

"volume": 1234567.89,

"markets": [

{

"question": "Will X happen?",

"outcomePrices": "[\"0.65\", \"0.35\"]",

"outcomes": "[\"Yes\", \"No\"]",

"clobTokenIds": "[\"TOKEN_YES\", \"TOKEN_NO\"]",

"conditionId": "0xabc...",

"volume": 500000

}

]

}

],

"pagination": {"hasMore": true, "totalResults": 100}

}

`

List Events

`

GET /events?limit=N&active=true&closed=false&order=volume&ascending=false

`

Parameters:

Response:

`json

{

"history": [

{"t": 1709000000, "p": "0.55"},

{"t": 1709100000, "p": "0.58"}

]

}

`

t is Unix timestamp, p is price (probability).

Note: Very new markets may return empty history.

CLOB Markets List

`

GET /markets?limit=N

`

Response:

`json

{

"data": [

{

"condition_id": "0xabc...",

"question": "Will X?",

"tokens": [

{"token_id": "123...", "outcome": "Yes", "price": 0.65},

{"token_id": "456...", "outcome": "No", "price": 0.35}

],

"active": true,

"closed": false

}

],

"next_cursor": "cursor_string",

"limit": 100,

"count": 1000

}

`


Data API — data-api.polymarket.com

Recent Trades

`

GET /trades?limit=N

GET /trades?market=CONDITION_ID&limit=N

`

Trade fields: side (BUY/SELL), size, price, timestamp,

title, slug, outcome, transactionHash, conditionId.

Open Interest

`

GET /oi?market=CONDITION_ID

`


Field Cross-Reference

To go from a Gamma market to CLOB data:

1. Get market from Gamma: has clobTokenIds and conditionId

2. Parse clobTokenIds (JSON string): ["YES_TOKEN", "NO_TOKEN"]

3. Use YES_TOKEN with /price, /book, /midpoint, /spread

4. Use conditionId with /prices-history and Data API endpoints