|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Loading prices...
API Reference

Market Data API

Access real-time and historical market data including prices, orderbooks, and market information.

Available Endpoints

GET/api/polymarket/market-search
Search markets
GET/api/polymarket/prices
Get token prices
GET/api/polymarket/orderbook
Get orderbook
GET/api/polymarket/price-history
Price history
GET/api/polymarket/spreads
Bid-ask spreads
GET/api/polymarket/market-details
Market info

Get Market Prices

Retrieve current prices for one or more tokens:

# Single token
curl "http://localhost:3000/api/polymarket/prices?tokenId=TOKEN_ID"

# Multiple tokens
curl "http://localhost:3000/api/polymarket/prices?tokenIds=TOKEN1,TOKEN2"

Response

{
  "price": 0.65,
  "timestamp": "2024-01-15T10:30:00Z",
  "tokenId": "TOKEN_ID"
}

Get Orderbook

Retrieve the current orderbook for a market:

curl "http://localhost:3000/api/polymarket/orderbook?tokenId=TOKEN_ID"

Response

{
  "bids": [
    { "price": 0.64, "size": 1000 },
    { "price": 0.63, "size": 500 }
  ],
  "asks": [
    { "price": 0.66, "size": 800 },
    { "price": 0.67, "size": 1200 }
  ],
  "spread": 0.02
}
The orderbook returns up to 20 levels by default. Use ?depth=50 for more levels.

Price History

Retrieve historical price data for charting:

curl "http://localhost:3000/api/polymarket/price-history?tokenId=TOKEN_ID&startDate=2024-01-01&endDate=2024-01-15"

Response

{
  "history": [
    {
      "timestamp": "2024-01-15T10:00:00Z",
      "price": 0.65,
      "volume": 5000
    },
    {
      "timestamp": "2024-01-15T09:00:00Z",
      "price": 0.63,
      "volume": 3200
    }
  ]
}