OpticOdds Integration Guide

Once your Copilot configurations are set up, you’re ready to begin ingesting odds data into your system. This guide outlines the available ingestion methods and provides step-by-step instructions for each.

📌 Prerequisites

Before proceeding, please complete the Getting Started to familiarize yourself with our fixtures, markets, sports, and leagues endpoints.

Continue with this guide after reaching Step 4 in that section.

🔁 Ingestion Methods

1. REST API Ingestion (Simple Polling)

This is the easiest method to implement. You can make standard API requests to our poll endpoints to retrieve current snapshots of data for specific fixture_ids.

2. SSE / Streaming Ingestion (Live Updates)

This method enables real-time data updates via HTTP streaming. Subscribe to specific streams and receive updates as they happen. Visit our streaming endpoints section for more details.

3. RabbitMQ Ingestion (Scalable Queue-Based)

A more advanced option that provides full control over message consumption. Use this method to pull messages from a queue at your preferred pace.

🔐 Get Your RabbitMQ Credentials

Contact your sales representative to obtain:

  • rabbitmq_username
  • rabbitmq_password

⚙️ Enable Your Queue

To initialize your message queue and begin receiving data:

  1. Make a POST request to: v3/copilot/queue/start
  2. This will return your queue details. Example response:
{
    "data": [
        {
            "id": 3,
            "queue_name": "AAAAAAA_2_cop_4HOEXAMPLEQUEUE",
            "enabled": true,
            "is_live": false,
            "odds_format": "AMERICAN",
            "num_consumers": null,
            "num_messages": null,
            "messages_per_second": null
        }
    ]
}

🛠️ Connect to RabbitMQ

Use the credentials and queue_name to connect via any RabbitMQ client.

ParameterValue
Hostcopilot-rmq.opticodds.com
Port5672
Virtual Hostapi
UsernameFrom your sales rep
PasswordFrom your sales rep
Queue NameFrom /queue/start response

🔍 Example: Python Consumer

import pika  # pip install pika

# Use the Full URL
# connection = pika.BlockingConnection(pika.URLParameters(f"amqp://{<USERNAME>}:{<PASSWORD>}@copilot-rmq.opticodds.com:5672/api"))
# Use the individual params
connection = pika.BlockingConnection(
    pika.ConnectionParameters(
    	host='copilot.rmq.opticodds.com',
    	port=5672,
    	virtual_host='api',
    	credentials=pika.PlainCredentials('<USERNAME>', '<PASSWORD>')
    )
)

# Callback function that contains the messages.
def callback(ch, method, properties, body):
    print("Received message: %r" % body)

print("Connected to RabbitMQ")
channel = connection.channel()
channel.basic_qos(prefetch_count=100)

# Consume messages
channel.basic_consume(queue=queue, on_message_callback=callback, auto_ack=True)
channel.start_consuming()

📦 Message Types

All messages are sent as JSON-encoded byte streams. Below are examples of supported event types.

🔄 ping

A basic heartbeat message.

{
  "event": "ping",
  "timestamp": "1743541426",
  "data": "2024-08-28T18:57:49Z"
}

🎯 copilot-odds

Live odds updates per market selection.

{
   "event":"copilot-odds",
   "timestamp": "1743541426",
   "data":[
      {
         "id":"1:-1:202504014E28ECF5:moneyline:fairleigh_dickinson",
         "fixture_id":"202504014E28ECF5",
         "game_id":"42823-30441-2025-04-01-12",
         "name":"Fairleigh Dickinson",
         "market":"Moneyline",
         "sport":"baseball",
         "league":"College Baseball",
         "timestamp":1743539407,
         "player_id":"None",
         "team_id":"859639F65BEC5E5A",
         "version_id":-1,
         "odd_id":"202504014E28ECF5:moneyline:fairleigh_dickinson",
         "market_id":"moneyline",
         "sport_id":"baseball",
         "league_id":"college_baseball",
         "grouping_key":"default",
         "is_main":true,
         "is_live":true,
         "selection":"Fairleigh Dickinson",
         "selection_line":"None",
         "points":"None",
         "price":1.465
      },
      {
         "id":"1:-1:202504014E28ECF5:moneyline:iona",
         "fixture_id":"202504014E28ECF5",
         "game_id":"42823-30441-2025-04-01-12",
         "name":"Iona",
         "market":"Moneyline",
         "sport":"baseball",
         "league":"College Baseball",
         "timestamp":1743539407,
         "player_id":"None",
         "team_id":"487B467E7A348307",
         "version_id":-1,
         "odd_id":"202504014E28ECF5:moneyline:iona",
         "market_id":"moneyline",
         "sport_id":"baseball",
         "league_id":"college_baseball",
         "grouping_key":"default",
         "is_main":true,
         "is_live":true,
         "selection":"Iona",
         "selection_line":"None",
         "points":"None",
         "price":2.8
      }
   ]
}

🔒 copilot-locked-odds

Represents selections that have been locked (i.e., not currently available for betting).

{
   "event":"copilot-locked-odds",
   "timestamp": "1743541426",
   "data":[
      {
         "id":"1:-1:england_-_league_2:DA09938EF811:moneyline:draw",
         "fixture_id":"england_-_league_2:DA09938EF811",
         "game_id":"18313-20540-2025-04-01",
         "name":"Draw",
         "market":"Moneyline",
         "sport":"soccer",
         "league":"England - League 2",
         "timestamp":1743539408,
         "player_id":"None",
         "team_id":"None",
         "version_id":-1,
         "odd_id":"england_-_league_2:DA09938EF811:moneyline:draw",
         "market_id":"moneyline",
         "sport_id":"soccer",
         "league_id":"england_-_league_2",
         "grouping_key":"default",
         "is_main":true,
         "is_live":true,
         "selection":"Draw",
         "selection_line":"None",
         "points":"None",
         "price":48.4
      }
   ]
}

✅ copilot-settled-odds

Indicates the outcome of a settled market (e.g., Win/Loss).

{
   "event":"copilot-settled-odds",
   "timestamp": "1743541426",
   "data":[
      {
         "id":"2:-1:nba:01B2729CEB9F:player_rebounds:chet_holmgren_under_8",
         "fixture_id":"nba:01B2729CEB9F",
         "game_id":"37132-19432-2025-03-31",
         "name":"Chet Holmgren Under 8",
         "market":"Player Rebounds",
         "sport":"basketball",
         "league":"NBA",
         "timestamp":1743541279,
         "player_id":"DC2FB289EB4C",
         "team_id":null,
         "version_id":-1,
         "odd_id":"nba:01B2729CEB9F:player_rebounds:chet_holmgren_under_8",
         "market_id":"player_rebounds",
         "sport_id":"basketball",
         "league_id":"nba",
         "settlement":"Won",
         "settled_at":"2025-04-01T21:01:19.793489"
      },
      {
         "id":"2:-1:nba:01B2729CEB9F:player_rebounds:chet_holmgren_under_8_5",
         "fixture_id":"nba:01B2729CEB9F",
         "game_id":"37132-19432-2025-03-31",
         "name":"Chet Holmgren Under 8.5",
         "market":"Player Rebounds",
         "sport":"basketball",
         "league":"NBA",
         "timestamp":1743541279,
         "player_id":"DC2FB289EB4C",
         "team_id":null,
         "version_id":-1,
         "odd_id":"nba:01B2729CEB9F:player_rebounds:chet_holmgren_under_8_5",
         "market_id":"player_rebounds",
         "sport_id":"basketball",
         "league_id":"nba",
         "settlement":"Won",
         "settled_at":"2025-04-01T21:01:19.793489"
      },
   ]
}

⚠️ Error Handling

If more than 10,000 unread messages accumulate in your queue:

  • The queue will be automatically cleared and deleted
  • Your org’s administrators will be notified via email (administrators are set by your sales rep)
  • You must re-initiate the /queue/start flow to resume consumption