Skip to main content

Real Time Odds Feed

FairPlay Technologies offers a powerful real-time betting pricing API that provides live odds from over 100 bookmakers worldwide. This API uses Server-Sent Events (SSE) over HTTP, allowing clients to receive continuous updates without the need for frequent polling. Whether you’re building a sports betting platform, a live odds comparison tool, or enhancing your sports analytics application, our real-time odds API delivers timely and accurate pricing data directly to your application.

Real-Time Betting Pricing API Overview

The Real-Time Betting Pricing API streams live odds for various sports and markets in real time. By subscribing to the appropriate market using the API, you can receive continuous updates on betting prices from multiple bookmakers as they happen. This provides a seamless and efficient way to keep your application up to date with the latest odds.

Key Features:

  • Real-time streaming of betting odds from over 100 bookmakers worldwide.
  • Supports various sports and markets, allowing for flexible integration.
  • Delivered via Server-Sent Events (SSE) over HTTP/2 for efficient data streaming.

Example cURL Request

To start receiving real-time odds updates, you can use the following cURL command. This example demonstrates how to connect to the API and stream data for a specific market type.

curl -N --http2 \
"https://api.fairplaybettech.com/catalogue/v1/odds/stream" \
-H "Accept:text/event-stream" \
-H 'API-KEY: <YOUR-API-KEY>' \
-H 'CLIENT-ID: myapp'
  • API-KEY: Your unique API key for authenticating the request.
  • CLIENT-ID: A custom identifier for your application.

Replace <YOUR-API-KEY> with your actual API key.

Available Filters

Filter OptionDescription
marketTypeIdIf you only want prices for a specific market type (e.g., win market)
betIdIf you only want prices for a specific bet
marketIdIf you only want prices for a specific market
subeventIdIf you only want prices for a specific subevent
eventIdIf you only want prices for a specific event
categoryIdIf you only want prices for a specific category

Example Javascript Integration

Below is an example of how you can integrate the Real-Time Betting Pricing API into a JavaScript client using the native EventSource API, which is built into modern browsers for handling Server-Sent Events.

// Replace with your actual API key and client ID
const apiKey = '<YOUR-API-KEY>';
const clientId = 'myapp';

// Create an EventSource instance for the real-time odds stream
const eventSource = new EventSource("https://api.fairplaybettech.com/catalogue/v1/odds/stream?marketTypeId=1", {
headers: {
'API-KEY': apiKey,
'CLIENT-ID': clientId
}
});

// Handle incoming messages (real-time odds updates)
eventSource.onmessage = function(event) {
const data = JSON.parse(event.data);
console.log('Received new odds:', data);
};

// Handle connection errors
eventSource.onerror = function(error) {
console.error('Error with the SSE connection:', error);
};

// Optionally, handle the opening of the connection
eventSource.onopen = function() {
console.log('Connection to real-time odds stream opened.');
};

Integration Tips

  1. Market Type ID: The marketTypeId parameter in the URL specifies the type of market for which you want to receive odds. Make sure to adjust this parameter based on the market you are interested in.

  2. Handling Updates: The API streams continuous updates as events. Each event contains the latest odds data, which you can process in real time. Make sure your application is set up to handle rapid data updates and manage state efficiently.

  3. Error Handling: While SSE connections are generally stable, network issues or server disruptions can cause errors. Implement proper error handling to reconnect or retry the connection if needed.

  4. API Documentation: For more details on the available parameters and market types, please refer to the individual API specifications, which provide comprehensive documentation on each available endpoint.