Polymarket API: A Developer's Guide
Polymarket provides API access that allows developers to programmatically fetch market data, prices, and trading information. Whether you are building a trading bot, a data dashboard, or integrating prediction market odds into your application, this guide covers what you need to know.
What the Polymarket API Offers
The Polymarket API ecosystem provides access to:
- Market metadata — Questions, descriptions, resolution criteria, categories
- Pricing data — Current YES/NO prices, bid/ask spreads, order book depth
- Historical data — Price history, volume over time, resolved market outcomes
- Trading activity — Recent trades, volume statistics, liquidity metrics
- Event grouping — Related markets grouped by event or category
API Architecture
Polymarket's data is accessible through multiple channels:
REST API
The primary HTTP-based API for fetching market data. Supports standard GET requests with JSON responses. Key endpoints include:
- Markets listing and search
- Individual market details and pricing
- Order book data
- Trade history
WebSocket Feeds
Real-time data streaming for:
- Live price updates
- Trade execution notifications
- Order book changes
WebSockets are essential for applications that need immediate price data without polling.
Subgraph (GraphQL)
Polymarket's on-chain data is indexed and available through GraphQL subgraphs. This is useful for querying historical blockchain data, resolved market outcomes, and on-chain trading activity.
Getting Started
Authentication
Public market data (prices, markets, volumes) is generally accessible without authentication. For trading-related endpoints, you will need API credentials linked to your Polymarket account.
Basic Market Data Request
To fetch current markets and their prices, make a GET request to the markets endpoint. The response includes:
- Market ID and slug
- Question text and description
- Current YES and NO prices
- Trading volume
- Resolution date and criteria
- Market status (active, resolved, etc.)
Rate Limits
The API implements rate limiting to prevent abuse. Standard limits allow sufficient requests for most use cases, but high-frequency applications may need to implement caching and efficient polling strategies.
Common Use Cases
Building a Price Tracker
Fetch market prices periodically and display them in a dashboard or application. PredMarket.io is built on this approach, aggregating odds across multiple prediction market platforms.
Algorithmic Trading
Use the API to:
- Monitor market prices in real-time via WebSockets
- Compare prices against your model's probability estimates
- Execute trades programmatically when edges are detected
- Manage positions and risk automatically
Algorithmic trading on Polymarket is legal and common. Many of the platform's market makers use automated systems to provide liquidity.
Data Analysis and Research
Academics and researchers use the API to:
- Study prediction market accuracy across thousands of resolved markets
- Analyze how quickly markets incorporate new information
- Compare prediction market odds with poll-based forecasts
- Build forecasting models that combine market data with other signals
Media and Journalism
News organizations fetch Polymarket data to display real-time odds in their reporting. The API enables automated embedding of current probabilities in articles, dashboards, and broadcasts.
Integration with Other Platforms
Developers build integrations that:
- Display Polymarket odds in Telegram or Discord bots
- Send alerts when specific markets cross price thresholds
- Combine Polymarket data with other data sources (polls, economic indicators)
- Create visualization tools for market analysis
Technical Considerations
Data Freshness
REST API data may have slight delays (seconds to minutes depending on the endpoint). For real-time requirements, use WebSocket feeds.
Handling Market Resolution
Markets transition through states: active, closed (trading halted), and resolved. Your application should handle all states gracefully and update accordingly when markets resolve.
On-Chain vs Off-Chain Data
Polymarket's order book operates off-chain for performance (using a hybrid model), while settlements happen on-chain. Depending on your use case, you may need data from both sources.
Error Handling
Implement robust error handling for:
- Rate limit responses (back off and retry)
- Network timeouts
- Invalid market IDs or slugs
- API version changes
Best Practices
- Cache aggressively. Market metadata changes infrequently. Cache market lists and descriptions, refreshing only prices and volumes frequently
- Use WebSockets for real-time data. Polling REST endpoints for live prices is inefficient and may hit rate limits
- Respect rate limits. Implement exponential backoff when receiving rate limit responses
- Handle edge cases. Markets can be created, paused, resumed, and resolved. Build your application to handle all lifecycle states
- Stay updated. Polymarket's API may evolve. Monitor their developer documentation and changelog for breaking changes
Resources
- Polymarket documentation — Check Polymarket's official docs and GitHub for the latest API specifications
- Developer community — Join Polymarket's Discord for developer-specific channels and support
- PredMarket.io — See a live example of Polymarket data integration at PredMarket.io/markets
For non-developer guides, see our Polymarket beginner's guide or learn about Polymarket fees.