Market Data API
Market data endpoints provide real-time pricing and order book information. These endpoints are public and do not require authentication.
Order Book
Retrieve the current order book for a specific outcome.
GET /api/v1/markets/{marketId}/orderbook/{outcomeId}
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
depth | number | 10 | Number of price levels to return per side |
Example:
curl "https://polymarket.sandbox.playbatman.com/api/v1/markets/{marketId}/orderbook/{outcomeId}?depth=5"
Response:
{
"success": true,
"data": {
"marketId": "market-uuid",
"outcomeId": "outcome-uuid",
"bids": [
{ "price": 0.65, "shares": 150, "orderCount": 3 },
{ "price": 0.63, "shares": 200, "orderCount": 5 },
{ "price": 0.60, "shares": 100, "orderCount": 2 }
],
"asks": [
{ "price": 0.68, "shares": 75, "orderCount": 2 },
{ "price": 0.70, "shares": 300, "orderCount": 4 },
{ "price": 0.75, "shares": 50, "orderCount": 1 }
],
"bestBid": 0.65,
"bestAsk": 0.68,
"spread": 0.03,
"timestamp": 1708293600000
}
}
Order Book Fields
| Field | Type | Description |
|---|---|---|
bids | array | Buy orders sorted by price (highest first) |
asks | array | Sell orders sorted by price (lowest first) |
bestBid | number | null | Highest buy price |
bestAsk | number | null | Lowest sell price |
spread | number | null | Difference between best ask and best bid |
timestamp | number | Unix timestamp in milliseconds |
Price Level Fields
| Field | Type | Description |
|---|---|---|
price | number | Price level |
shares | number | Total shares at this price |
orderCount | number | Number of orders at this price |
Market Prices
Get pricing data for all outcomes in a market.
GET /api/v1/markets/{marketId}/prices
Example:
curl "https://polymarket.sandbox.playbatman.com/api/v1/markets/{marketId}/prices"
Response:
{
"success": true,
"data": [
{
"marketId": "market-uuid",
"outcomeId": "outcome-uuid-1",
"outcomeName": "Yes",
"bestBid": 0.65,
"bestAsk": 0.68,
"lastPrice": 0.66,
"midPrice": 0.665,
"spread": 0.03,
"volume24h": 5000
},
{
"marketId": "market-uuid",
"outcomeId": "outcome-uuid-2",
"outcomeName": "No",
"bestBid": 0.32,
"bestAsk": 0.35,
"lastPrice": 0.34,
"midPrice": 0.335,
"spread": 0.03,
"volume24h": 4800
}
]
}
Single Outcome Price
Get pricing data for a specific outcome.
GET /api/v1/markets/{marketId}/prices/{outcomeId}
Response:
{
"success": true,
"data": {
"marketId": "market-uuid",
"outcomeId": "outcome-uuid",
"outcomeName": "Yes",
"bestBid": 0.65,
"bestAsk": 0.68,
"lastPrice": 0.66,
"midPrice": 0.665,
"spread": 0.03,
"volume24h": 5000
}
}
Price Fields
| Field | Type | Description |
|---|---|---|
bestBid | number | Highest buy price in the order book |
bestAsk | number | Lowest sell price in the order book |
lastPrice | number | Price of the most recent trade |
midPrice | number | Midpoint between best bid and best ask |
spread | number | Difference between best ask and best bid |
volume24h | number | Total shares traded in the last 24 hours |
Operator Statistics
Get a high-level overview of your markets.
GET /api/v1/stats/overview
Authentication: X-Api-Key header required.
Response:
{
"success": true,
"data": {
"openMarkets": 12,
"pendingResolution": 3,
"resolved": 45
}
}