Getting Started with the Betstamp Pro API
This guide walks you through the minimum steps to authenticate, respect rate limits, and make your first request to the Markets API. From there, you can layer in players, teams, fixtures, and real-time streaming.
Obtain Your API Key
Every request to the PredictionData API must be authenticated with an API key. Your PredictionData representative will provision this key as part of your onboarding.
The key is sent in the X-API-KEY HTTP header on every request.
curl -G "https://api.pro.betstamp.com/api/markets" \ -H "X-API-KEY: YOUR_API_KEY_HERE"
Understand Rate Limits
By default, clients can send up to 4 requests per second. In addition, each plan has a monthly quota on total API requests. If you exceed either limit, the API returns a JSON error indicating whether you've hit the per-second throttle or the monthly cap.
Recommended Practices
- Centralize API calls through a small client or service layer
- Add retry and backoff logic on throttling errors
- Monitor usage against your monthly quota
Make Your First Markets Request
The /markets endpoint is the core of the API. It returns a list of markets filtered by league, book IDs, bet types, periods, and optional time windows.
At minimum, you'll specify:
- league - e.g. NFL, NHL, NBA
- periods - e.g. FT, 1Q, 1H
- book_ids - e.g. comma-separated IDs
- bet_types - e.g. moneyline, spread, total, etc.
curl -G "https://api.pro.betstamp.com/api/markets" \ -d "league=NHL" \ -d "bet_types=player_prop" \ -d "book_ids=100,400,117" \ -d "periods=FT" \ -d "is_live=false" \ -H "X-API-KEY: YOUR_API_KEY_HERE"
Pull Reference Data
To interpret markets correctly, you'll typically fetch reference data and join by ID:
Player details (IDs, names, positions, teams, status)
Team information (IDs, abbreviations, full names, and leagues
Games with start times, status, and scores
Seasons and tournaments for a given league
Decide If You Need the Markets Stream (SSE)
If you need to react to price changes in real time use the Markets Stream instead of frequent polling. The stream uses Server-Sent Events (SSE). Each message contains JSON data describing a single market update.
curl "https://stream.betstamp.com/v1/markets" \ -H "Accept: text/event-stream" \ -H "X-API-KEY: YOUR_API_KEY_HERE"
Next Steps
- Persist markets and fixtures in your databases
- Join markets with players and teams for custom analytics
- Subscribe to the Markets Stream for real-time monitoring
- Coordinate with PredictionData team for coverage customizations
Best Practices
Connection Management
- Reconnect with backoff
- Handle network drops
- Use SSE keepalive
Data Handling
- Process messages asynchronously
- Validate payloads
- Cache initial data
Security
- Never export API keys
- Rotate keys regularly
- Use secure storage
Performance
- Subscribe only to needed markets
- Buffer high-frequency updates
- Reuse connections