Skip to main content

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:

ParameterTypeDefaultDescription
depthnumber10Number 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

FieldTypeDescription
bidsarrayBuy orders sorted by price (highest first)
asksarraySell orders sorted by price (lowest first)
bestBidnumber | nullHighest buy price
bestAsknumber | nullLowest sell price
spreadnumber | nullDifference between best ask and best bid
timestampnumberUnix timestamp in milliseconds

Price Level Fields

FieldTypeDescription
pricenumberPrice level
sharesnumberTotal shares at this price
orderCountnumberNumber 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

FieldTypeDescription
bestBidnumberHighest buy price in the order book
bestAsknumberLowest sell price in the order book
lastPricenumberPrice of the most recent trade
midPricenumberMidpoint between best bid and best ask
spreadnumberDifference between best ask and best bid
volume24hnumberTotal 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
}
}