> For the complete documentation index, see [llms.txt](https://docs.feedb2b.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.feedb2b.com/getting-started/api-documentation.md).

# API Documentation

A unified data delivery platform for sports odds, markets, settlements, and statistics.

Feedb2b provides two data access channels:

| Channel             | Usage                                                            | Type |
| ------------------- | ---------------------------------------------------------------- | ---- |
| **RabbitMQ stream** | Live data streaming (events/markets/bets/statistics/settlements) | Push |
| **REST API**        | Contextual queries, history lookups, event lists                 | Pull |

Clients typically **consume live RabbitMQ queues continuously**, while **REST API is used for on-demand requests** (markets, settlements, historical odds, event metadata, etc.).

## Architecture Overview

Feedb2b receives data from multiple sports feed providers, normalizes and processes it, then delivers it to clients via two channels:

```sql
+-------------------+
|    Providers      |
| (LSports, TXOdds) |
+---------+---------+
          |
          v
+-------------------+
|      Feedb2b      |
+---------+---------+
          |
          v
+-------------------+
| Unified Processor |
+---------+---------+
          |
          +-----------------> RabbitMQ Live Feed
          |                        (push, subscriptions)
          v
   REST API Contextual/History
   (pull, on-demand queries)
```

### RabbitMQ Integration

Each client receives **two dedicated queues**:

```php
<clientId>
<clientId>-live
```

Clients have **read-only** permissions — queues are pre-configured on the Feedb2b side.

### JavaScript Connection Example

Below is a JavaScript example showing how a client can connect and consume messages:

```jsx
const amqplib = require('amqplib');

async function main() {
  const queue = '<client_id>';

  const conn = await amqplib.connect(
    'amqps://<username>:<password>@api.feedb2b.com:5671/customer'
  );

  const channel = await conn.createChannel();

  channel.consume(queue, (msg) => {
    if (msg) console.log('Received:', msg.content.toString());
  });
}

main();
```

> Do not call assertQueue — clients do not have queue management privileges.

### Retention

If a disconnection happens:

* RabbitMQ retains the **last 100,000 messages** in the queue.
* Once the client reconnects, these messages can be consumed to catch up.

## Message Types

Clients receive four types of messages:

1. Events
2. Markets
3. Settlements
4. Statistics
5. Heartbeat

### Events Message

```jsx
{
  "id": 10101,
  "msgType": "event",
  "startDate": "2025-06-12T18:00:00.000Z",
  "lastUpdate": "2025-06-12T18:10:20.000Z",
  "status": 3,
  "league": { "id": 3012, "name": "Premier Cup" },
  "team1": { "id": 5201, "name": "Red Falcons" },
  "team2": { "id": 5202, "name": "Blue Titans" },
  "location": { "id": 101, "name": "International Arena" },
  "sport": { "id": 12, "name": "Football" },
  "providers": [{ "id": 1, "name": "SportsFeedX" }]
}
```

**Event Status**

| ID | Meaning   |
| -- | --------- |
| 1  | Open      |
| 2  | Canceled  |
| 3  | Running   |
| 4  | Finished  |
| 5  | Suspended |

Feedb2b receives events from multiple providers, listed in the `providers` array.

### Markets

Some providers have sub-providers. The `subProvider` field contains this information, using the same structure as `provider`.

**Market Status**

| ID | Meaning   |
| -- | --------- |
| 1  | Open      |
| 2  | Settled   |
| 3  | Suspended |
| 4  | Canceled  |

**Bet Status**

| ID | Meaning   |
| -- | --------- |
| 1  | Open      |
| 2  | Settled   |
| 3  | Suspended |

### Settlements

**Settlement message format:**

```jsx
{
  "id": 40012,
  "name": "Match Winner",
  "typeId": 176,
  "eventId": 10101,
  "provider": { "id": 1, "name": "SportsFeedX" },
  "bets": [
    {
        "id": "234963996",
        "line": "4.5",
        "name": "Under",
        "settlement": 3,
        "odds": 2.1739130434782608,
        "betId": "14285084477",
        "lastUpdate": "2026-02-19T10:19:56.822Z",
        "subProvider": {
          "id": 0,
          "name": "BaseOdd"
        }
      },
    {
        "id": "234963996",
        "line": "4.5",
        "name": "Under",
        "settlement": 3,
        "odds": 2.1739130434782608,
        "betId": "14285084477",
        "lastUpdate": "2026-02-19T10:19:56.822Z",
        "subProvider": {
          "id": 0,
          "name": "BaseOdd"
        }
      }
  ]
}
```

Settlement messages are similar to bet messages but include an additional `settlement` field, which indicates the outcome using the following enum:

| Value | Meaning     |
| ----- | ----------- |
| 1     | Open        |
| 2     | Canceled    |
| 3     | Win         |
| 4     | Loss        |
| 5     | Draw        |
| 6     | PartialWin  |
| 7     | PartialLoss |
| 8     | Postponed   |
| 9     | Refund      |

### Statistics

**Statistics message format:**

```jsx
{
  "id": 61,
  "msgType": "statistic",
  "lastUpdate": "2025-03-17T09:43:15.412Z",  "eventId": 10101,
  "provider": {
    "id": 2,
    "name": "delasport"
  },
  "incidents": [
    {
      "id": "8",
      "name": "points",
      "periods": [
        { "id": "106", "t1": "0", "t2": "0", "name": "5g" },
        { "id": "105", "t1": "0", "t2": "0", "name": "4g" },
        { "id": "102", "t1": "9", "t2": "11", "name": "1g" },
        { "id": "103", "t1": "11", "t2": "6", "name": "2g" },
        { "id": "952", "t1": "20", "t2": "17", "name": "first2games" },
        { "id": "104", "t1": "11", "t2": "7", "name": "3g" },
        { "id": "62", "t1": "31", "t2": "24", "name": "ft" }
      ]
    },
    {
      "id": "19",
      "name": "games",
      "periods": [
        { "id": "952", "t1": "1", "t2": "1", "name": "first2games" },
        { "id": "62", "t1": "2", "t2": "1", "name": "ft" }
      ]
    }
  ]
}
```

**Message IDs**

* Message IDs are **unique per message type**.
* Two events **cannot** share the same `id`.
* However, an event and a bet (or settlement/statistic) **may** share the same `id` because uniqueness is scoped to the type.

### Heartbeat

**Heartbeat message format:**

```jsx
{
"msgType": "heartbeat",
"serverTimeStamp": 1779856676719,
"status": [{
 "provider": "Geniussports",
 "active": true
 }]
}
```

## REST API Endpoints

### Authentication

Before calling REST endpoints, request access\_token:

**POST** `https://auth.feedb2b.com/auth/login`

**Body**

```json
{
  "email": "user@example.com",
  "password": "your_password"
}
```

**Response**

```json
{
  "access_token": "JWT_TOKEN_VALUE"
}
```

Use `Authorization: Bearer <token>` for all REST requests.

### Get Snapshot

Snapshot can be used after reconnection to get full information about events and continue relying on the received live data.

It returns snapshot information for all entities: events, bets, statistics, and settlements.

One request can include up to 20 events.

To get a snapshot for a specific event or a list of events, use the following endpoint:

**GET** `https://auth.feedb2b.com/contextual/api/events/snapshot`

Request:

```json
{
    "eventIds": [2392618, 2231305, 2197533]
}
```

Response:

```json
{
  "id": 2392618,
  "startDate": "2026-06-10T08:54:00.000Z",
  "lastUpdate": "2026-06-10T09:45:23.668Z",
  "status": 4,
  "sport": {
    "id": 65,
    "name": "Beach Volleyball"
  },
  "location": {
    "id": 250,
    "name": "Turkey"
  },
  "league": {
    "id": 39673,
    "name": "Beach Pro Tour Challenge Alanya"
  },
  "team1": {
    "id": 402071,
    "name": "Issa Batrane/Freddie Bialokoz"
  },
  "team2": {
    "id": 466379,
    "name": "Drolsum Syver Klungsoyr/Tobias Kawika Kauffman Pedersen"
  },
  "providers": [
    {
      "id": 3,
      "name": "GeniusSports"
    }
  ],
  "markets": [
    {
      "id": "1438327888",
      "name": "Match Winner",
      "specifier": "",
      "baseType": {
        "id": 7,
        "name": "1_x_2"
      },
      "typeId": 570,
      "period": {
        "id": 39528,
        "name": "Full Time"
      },
      "incidentType": {
        "id": 2,
        "name": "Yellow Card"
      },

      "status": {
        "GeniusSports": 3
      },
      "eventId": 2392618,
      "sportId": 65,
      "leagueId": 39673,
      "lastUpdate": "2026-06-10T09:44:57.159Z",
      "provider": {
        "id": 3,
        "name": "GeniusSports"
      },
      "bets": [
        {
          "id": "42683631823",
          "name": "Away",
          "line": "",
          "odds": 1.62,
          "isLive": true,
          "status": 2,
          "subProvider": {
            "id": 0,
            "name": "BaseOdd"
          },
          "lastUpdate": "2026-06-10T09:45:29.115Z"
        },
        {
          "id": "42683631824",
          "name": "Home",
          "line": "",
          "odds": 2.6,
          "isLive": true,
          "status": 2,
          "subProvider": {
            "id": 0,
            "name": "BaseOdd"
          },
          "lastUpdate": "2026-06-10T09:45:29.115Z"
        },
        {
          "id": "42683631821",
          "name": "Away",
          "line": "",
          "odds": 1,
          "isLive": true,
          "status": 2,
          "subProvider": null,
          "lastUpdate": "2026-06-10T09:45:29.115Z"
        },
        {
          "id": "42683631822",
          "name": "Home",
          "line": "",
          "odds": 1,
          "isLive": true,
          "status": 2,
          "subProvider": null,
          "lastUpdate": "2026-06-10T09:45:29.115Z"
        }
      ],
      "settlements": [
        {
          "id": "422503812",
          "name": "Away",
          "line": "",
          "odds": 1,
          "settlement": 3,
          "betId": "42683631821",
          "lastUpdate": "2026-06-10T09:44:57.159Z",
          "subProvider": null
        },
        {
          "id": "422503813",
          "name": "Home",
          "line": "",
          "odds": 1,
          "settlement": 4,
          "betId": "42683631822",
          "lastUpdate": "2026-06-10T09:44:57.159Z",
          "subProvider": null
        },
        {
          "id": "422503814",
          "name": "Away",
          "line": "",
          "odds": 1.62,
          "settlement": 3,
          "betId": "42683631823",
          "lastUpdate": "2026-06-10T09:44:57.159Z",
          "subProvider": {
            "id": 0,
            "name": "BaseOdd"
          }
        },
        {
          "id": "422503815",
          "name": "Home",
          "line": "",
          "odds": 2.6,
          "settlement": 4,
          "betId": "42683631824",
          "lastUpdate": "2026-06-10T09:44:57.159Z",
          "subProvider": {
            "id": 0,
            "name": "BaseOdd"
          }
        }
      ]
    }
  ],
  "statistics": [
    {
      "id": 156017867,
      "eventId": 2392618,
      "leagueId": 39673,
      "sportId": 65,
      "matchTime": null,
      "lastUpdate": "2026-06-10T09:45:43.235Z",
      "currentPhase": {
        "id": 39930,
        "name": "Full Time"
      },
      "provider": {
        "id": 3,
        "name": "GeniusSports"
      },
      "incidents": [
        {
          "id": 8202,
          "name": "Score",
          "periods": [
            {
              "id": 39930,
              "t1": "1",
              "t2": "2",
              "name": "Full Time"
            }
          ]
        },
        {
          "id": 8203,
          "name": "Point",
          "periods": [
            {
              "id": 39930,
              "t1": "13",
              "t2": "15",
              "name": "Full Time"
            }
          ]
        }
      ]
    }
  ]
}
```

### Get Bets

To get bets for the specific event, the following endpoint should be used:

**GET** `https://auth.feedb2b.com/contextual/api/events/:eventId/bets?limit=:number`

```json
{
  "markets": [
    {
      "id": "12345",
      "name": "Correct Score",
      "specifier": "overs=5",
      "baseType": {
                "id": 7,
                "name": "correct_scpre"
            },
      "type": "example",
      "typeId": 1001,
      "eventId": 9999,
      "sportId": 11,
      "leagueId": 200,
      "status": 3,
      "lastUpdate": "2026-01-01T10:00:00Z",
      "period": {
                "id": 2,
                "name": "Full Time"
            },
      "incidentType": {
                "id": 2,
                "name": "Yellow Card"
            },
      "provider": {
        "id": 1,
        "name": "ExampleProvider"
      },
      "bets": [
        {
        "id": "14296707980",
        "line": "24.5",
        "name": "Over",
        "status": 3,
        "odds": 1.408,
        "isLive": true,
        "lastUpdate": "2026-02-19T10:19:56.822Z",
        "subProvider": {
          "id": 101,
          "name": "Unibet"
        }
      },
       {
        "id": "14296707980",
        "line": "24.5",
        "name": "Over",
        "status": 3,
        "odds": 1.408,
        "isLive": true,
        "lastUpdate": "2026-02-19T10:19:56.822Z",
        "subProvider": {
          "id": 101,
          "name": "Unibet"
        }
      }
      ]
    }
  ],
  "totalMarketsAmount": 1
}

```

### Get Settlements

Returns settlements for the specified event.

**GET** `https://auth.feedb2b.com/contextual/api/events/:eventId/settlements?limit=:number`

**Response**

### Get Events

Returns a list of events.

**GET** `https://auth.feedb2b.com/contextual/api/events`

| Name               | Description                                                      |
| ------------------ | ---------------------------------------------------------------- |
| `sport`            | `sport_id`                                                       |
| `location`         | `location_id`                                                    |
| `provider`         | `provider_id`                                                    |
| `startDate`        | start date in `YYYY-MM-DD`                                       |
| `endtDate`         | end date in `YYYY-MM-DD`                                         |
| `status`           | event status                                                     |
| `page`             | page number                                                      |
| `pageSize`         | number of events per page                                        |
| `utcOffsetMinutes` | offset in minutes to use based on client timezone (timezone\*60) |
| `eventId`          | ID for the specific event                                        |

By default, it returns the **1000 events for the current date**.

**Example (single item from response array):**

```json
  {
  "id": 116892, 
  "startDate": "2025-05-11T17:00:00.000Z", 
  "lastUpdate": "2025-05-12T08:25:24.821Z", 
  "status": 4,
  "league": { "id": 11047, "name": "Continental Champions League" },
  "team1": { "id": 50731, "name": "Northside Warriors" },
  "team2": { "id": 67900, "name": "Coastal Legends" },
  "location": { "id": 1004, "name": "World" },
  "sport": { "id": 5, "name": "Basketball" },
  "providers": [{ "id": 3, "name": "genius-sports" }]
}
```

### Get Statistics

Returns a list of events.

**GET** `https://auth.feedb2b.com/contextual/api/events/:eventId/statistic`

### Get Event

Returns an event by Id.

**GET** `https://auth.feedb2b.com/contextual/api/events/:eventId`

**Example:**

```json
  {
  "id": 116892, 
  "startDate": "2025-05-11T17:00:00.000Z", 
  "lastUpdate": "2025-05-12T08:25:24.821Z", 
  "status": 4,
  "league": { "id": 11047, "name": "Continental Champions League" },
  "team1": { "id": 50731, "name": "Northside Warriors" },
  "team2": { "id": 67900, "name": "Coastal Legends" },
  "location": { "id": 1004, "name": "World" },
  "sport": { "id": 5, "name": "Basketball" },
  "providers": [{ "id": 3, "name": "genius-sports" }]
}
```

### Get Locations

To get the location, the following endpoint should be used:

**GET** `https://auth.feedb2b.com/contextual/api/locations`

**Example Item**

```json
{
  "id": 1,
  "name": "Afghanistan",
}
```

### Get Sports

To get the events list by day, the following endpoint should be used:

**GET** `https://auth.feedb2b.com/contextual/api/sports`

**Example Item**

```json
{
  "id": 1,
  "name": "Rugby Union",
}
```

### Get Market Types

Get the market types of the specified event:

**GET** `https://auth.feedb2b.com/contextual/api/marketTypes/:sportId`

**Example Response**

```jsx
[
    {
        "id": 1,
        "name": "Match Result",
        "type": "1_x_2",
        "order": 0,
        "participant": null,
        "period": {
            "id": 39528,
            "name": "Full Time"
        },
        "incident_type": {
            "id": null,
            "name": null
        },
        "providers": [
            1,
            2,
            3,
            4,
            5
        ]
    },
    {
        "id": 2141,
        "name": "Asian Handicap",
        "type": "2_way_handicap",
        "order": 4,
        "participant": null,
        "period": {
            "id": 39528,
            "name": "Full Time"
        },
        "incident_type": {
            "id": null,
            "name": null
        },
        "providers": [
            1,
            2,
            3,
            4,
            5
        ]
    },
```

The type field represents possible outcomes for the markets:

| Type                         | Possible bet names                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Line                                                                 |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `1_2_no_&_1_x_2`             | <p>Away and Away<br>Away and Draw<br>Away and Home<br>Home and Away<br>Home and Draw<br>Home and Home<br>No Goal</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | -                                                                    |
| `1_x_2_&_1_x_2`              | <p>Away and Away<br>Away and Draw<br>Away and Home<br>Home and Away<br>Home and Draw<br>Home and Home<br>Draw and Away<br>Draw and Draw<br>Draw and Home</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                      |
| `1_n_2`                      | <p>Home<br>Neither<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Optional: number for Race to markets                                 |
| `1_x`                        | <p>Home<br>Draw</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | -                                                                    |
| `x_2`                        | <p>Draw<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | -                                                                    |
| `1_x_2_&_yes_no`             | <p>Away and No<br>Away and Yes<br>Home and No<br>Home and Yes<br>Draw and No<br>Draw and Yes</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | -                                                                    |
| `1_x_2_&_over_under`         | <p>Home and Over<br>Draw and Over<br>Away and Under<br>Draw and Under<br>Home and Under<br>Away and Over</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Over/Under number                                                    |
| `1_x_2_yes_no`               | <p>Home Yes<br>Home No<br>Away Yes<br>Away No<br>Draw Yes<br>Draw No</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | -                                                                    |
| `2_way_handicap`             | <p>Home<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Handicap number                                                      |
| `3_way_handicap`             | <p>Home<br>Draw<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Handicap number                                                      |
| `yes_no_&_over_under`        | <p>Yes and Under<br>No and Under<br>No and Over<br>Yes and Over</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Over/Under number                                                    |
| `clean_sheet`                | <p>Away No<br>Away Yes<br>Home No<br>Home Yes</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | -                                                                    |
| `colors`                     | <p>Brown<br>Black<br>Blue<br>Green<br>Pink<br>Foul<br>Red<br>Yellow</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | -                                                                    |
| `correct_score`              | <p><code>{X}-{Y}</code><br>Draw<br>Home by any other score<br>Away by any other score<br>Any other<br>Away to X<br>Home to X</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | -                                                                    |
| `double_chance`              | <p>Draw or Away<br>Home or Draw<br>Home or Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | -                                                                    |
| `double_chance_&_yes_no`     | <p>Draw or Away and No<br>Draw or Away and Yes<br>Home or Draw and Yes<br>Home or Away and No<br>Home or Away and Yes<br>Home or Draw and No</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | -                                                                    |
| `exact_number`               | <p><code>{X}-{Y}</code><br><code>{X}</code><br><code>{X}+</code><br>No Goal</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | -                                                                    |
| `periods`                    | <p>1st Half<br>2nd Half<br>Draw<br>1st Quarter<br>2nd Quarter<br>3rd Quarter<br>4th Quarter<br>1st Period<br>2nd Period<br>1st–9th Inning</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | -                                                                    |
| `1_x_2/1_x_2`                | <p>Away/Away<br>Away/Draw<br>Away/Home<br>Draw/Away<br>Draw/Draw<br>Draw/Home<br>Home/Away<br>Home/Draw<br>Home/Home<br>Away/Away/Home/Away<br>Away/Away/Home/Home<br>Away/Away/Away/Away<br>Away/Away/Away/Home<br>Home/Away/Home/Away<br>Home/Away/Home/Home<br>Home/Away/Away/Away<br>Home/Away/Away/Home<br>Home/Home/Home/Away<br>Home/Home/Home/Home<br>Home/Home/Away/Away<br>Home/Home/Away/Home<br>Away/Home/Home/Away<br>Away/Home/Home/Home<br>Away/Home/Away/Away<br>Away/Home/Away/Home</p>                                                                                                                                                                                                                                                                                                         | -                                                                    |
| `miss_score`                 | <p>Miss<br>Score</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | -                                                                    |
| `odd_even`                   | <p>Odd<br>Even</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | -                                                                    |
| `team_odd_even`              | <p>Away Odd<br>Away Even<br>Home Even<br>Home Odd</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | -                                                                    |
| `over_under`                 | <p>Over<br>Under</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Over/Under number                                                    |
| `double_chance_&_over_under` | <p>Draw or Away and Under<br>Home or Away and Over<br>Home or Draw and Under<br>Home or Away and Under<br>Draw or Away and Over<br>Home or Draw and Over</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Over/Under number                                                    |
| `over_under_exactly`         | <p>Over<br>Under<br>Exactly</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Over/Under number                                                    |
| `player_name_over_under`     | <p><code>{Player Name}</code> - Over<br><code>{Player Name}</code> - Under</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Over/Under number                                                    |
| `player_name`                | `{Player Name}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | -                                                                    |
| `player_name_exact_number`   | <p><code>{Player Name}</code> - <code>{X}-{Y}</code><br><code>{Player Name}</code> - <code>{X}</code><br><code>{Player Name}</code> - <code>{X}+</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | <p><code>{X}-{Y}</code><br><code>{X}</code><br><code>{X}+</code></p> |
| `scoring_method`             | <p>Any Other<br>Bowled<br>Caught<br>Free Kick<br>Free Throw<br>Header<br>LBW<br>Name<br>No Goal<br>Not Caught<br>Other<br>Own Goal<br>Penalty<br>Run Out<br>Shot<br>Stumped<br>Three-Point Field Goal<br>Two-Point Field Goal<br>Goal<br>Behind</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | Optional: Point/Goal number                                          |
| `set_by_set`                 | <p>Away-Away<br>Away-Away-Away<br>Away-Away-Home-Away<br>Away-Away-Home-Home-Away<br>Away-Away-Home-Home-Home<br>Away-Home-Away<br>Away-Home-Away-Away<br>Away-Home-Away-Home-Away<br>Away-Home-Away-Home-Home<br>Away-Home-Home<br>Away-Home-Home-Away-Away<br>Away-Home-Home-Away-Home<br>Away-Home-Home-Home<br>Home-Away-Away<br>Home-Away-Away-Away<br>Home-Away-Away-Home-Away<br>Home-Away-Away-Home-Home<br>Home-Away-Home<br>Home-Away-Home-Away-Away<br>Home-Away-Home-Away-Home<br>Home-Away-Home-Home<br>Home-Home<br>Home-Home-Away-Away-Away<br>Home-Home-Away-Away-Home<br>Home-Home-Away-Home<br>Home-Home-Home</p>                                                                                                                                                                              | -                                                                    |
| `time_to_score`              | <p>No Goal<br>81-90<br>71-80<br>61-70<br>51-60<br>41-50<br>31-40<br>21-30<br>11-20<br>1-10</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                                      |
| `victory_method`             | <p>Away Extra Time<br>Away Penalties<br>Away Regular Time<br>Away Round <code>{X}</code><br>Away Rounds <code>{X}-{Y}</code><br>Away by KO/TKO or DQ<br>Away by KO, TKO, DQ or Submission<br>Away by Submission<br>Away by Decision or Technical Decision<br>Away on Penalties<br>Draw<br>Draw or Technical Draw<br>Either Round <code>{X}</code><br>Either Rounds <code>{X}-{Y}</code><br>Either To Go The Distance<br>Home Extra Time<br>Home Penalties<br>Home Regular Time<br>Home Round <code>{X}</code><br>Home Rounds <code>{X}-{Y}</code><br>Home by KO/TKO or DQ<br>Home by KO, TKO, DQ or Submission<br>Home by Submission<br>Home by Decision or Technical Decision<br>Home on Penalties<br>Overtime<br>Regular Time<br>Shootout<br>Any Extra Inning<br>Bottom Of 9th Inning<br>Top Of 9th Inning</p> | -                                                                    |
| `yes_no`                     | <p>Yes<br>No</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Optional: number                                                     |
| `yes_no/yes_no`              | <p>Yes/No<br>No/Yes<br>No/No<br>Yes/Yes</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | -                                                                    |
| `player_name_yes_no`         | `{Player Name}` - Yes/No                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | -                                                                    |
| `two_player_name_yes_no`     | `{Player Name}` - Yes/No                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                      |
| `bts`                        | <p>Only Home<br>Only Away<br>Both<br>Neither</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                      |
| `1_2`                        | <p>Home<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | -                                                                    |
| `winning_margin`             | <p>Home by X<br>Draw<br>Away by X</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | -                                                                    |
| `1_2_no`                     | <p>Home<br>Away<br>No Goal</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | -                                                                    |
| `1_x_2`                      | <p>Home<br>Draw<br>Away</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | -                                                                    |
| `1_x_2_or_over_under`        | <p>Home or Over<br>Home or Under<br>Draw or Over<br>Draw or Under<br>Away or Over<br>Away or Under</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Over/Under number                                                    |
| `1_x_2_or_yes_no`            | <p>Home or Yes<br>Home or No<br>Draw or Yes<br>Draw or No<br>Away or Yes<br>Away or No</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | -                                                                    |
| `player_name_odd_even`       | <p><code>{Player Name}</code> - Odd<br><code>{Player Name}</code> - Even</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | -                                                                    |
| `1_2_yes_no`                 | <p>Home Yes<br>Home No<br>Away Yes<br>Away No</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | -                                                                    |
| `1_2_over_under`             | <p>Home Over<br>Home Under<br>Away Over<br>Away Under</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Over/Under number                                                    |
| `drive_outcome`              | <p>Any Other Result                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                      |
| <br>Field Goal Attempt       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                      |
| <br>Offensive Touchdown      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                                                      |
| <br>Punt</p>                 | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |                                                                      |

### Get Periods

Returns periods by sports\
**GET** `https://auth.feedb2b.com/contextual/api/period/?sportId=:sportId`

**Example Response**

```json
 {
        "id": 35927,
        "name": "First Half",
        "sport": {
            "id": 8,
            "name": "Baseball"
        }
    }
```

### Get Bet History

Returns **historical odds** for all bets of a particular event.\
**GET** `https://auth.feedb2b.com/mapping/api/bet/history/:eventId`

**Example Response**

```jsx
[{
  "marketTypeId": 1,
  "leagueId": 1612,
  "sportId": 62,
  "bets": [{
    "betId": 424456,
    "marketId": 75752,
    "name": "Draw",
    "history": [{
      "createdAt": "2025-10-01T09:58:57.136Z",
      "isLive": true,
      "lastUpdate": "2025-09-30T20:50:39.213Z",
      "line": "",
      "marketStatus": 1,
      "odd": "7.87",
      "providerId": 2,
      "subProviderId": -1,
      "startDate": "2025-09-30T18:45:00.000Z"
    }]
  }, {
    "betId": 441925,
    "marketId": 75752,
    "name": "Home",
    "history": [{
      "createdAt": "2025-10-01T09:59:53.962Z",
      "isLive": true,
      "lastUpdate": "2025-09-30T20:50:39.213Z",
      "line": "",
      "marketStatus": 1,
      "odd": "1.00",
      "providerId": 2,
      "subProviderId": -1,
      "startDate": "2025-09-30T18:45:00.000Z"
    }]
  }]
}, {
  "marketTypeId": 244,
  "leagueId": 1612,
  "sportId": 62,
  "bets": [{
    "betId": 359606,
    "marketId": 66351,
    "name": "Away",
    "history": [{
      "createdAt": "2025-10-01T09:56:40.817Z",
      "isLive": true,
      "lastUpdate": "2025-09-30T20:10:33.311Z",
      "line": "",
      "marketStatus": 1,
      "odd": "1.73",
      "providerId": 2,
      "subProviderId": -1,
      "startDate": "2025-09-30T18:45:00.000Z"
    },
    {
      "createdAt": "2025-10-01T09:58:47.872Z",
      "isLive": true,
      "lastUpdate": "2025-09-30T20:50:39.794Z",
      "line": "",
      "marketStatus": 1,
      "odd": "7.18",
      "providerId": 2,
      "subProviderId": -1,
      "startDate": "2025-09-30T18:45:00.000Z",
    }
    ]
  }]
}]
```

## Booking

To receive data for specific sports/leagues/events, the client has to **book** them.

### **Get Booked Events**

Retrieves an explicit roster of active bookings matching the provided filtration query parameters.

* HTTP Method: `GET`
* Path: `/booking/api/booked-events`
* Example Request URL: `{{authUrl}}/booking/api/booked-events?utcOffsetMinutes=240&startDate=2026-06-05&sport=62&provider=3`

**Example Response**

```json
[
  {
    "eventId": 2367110,
    "sportId": 62,
    "locationId": 244,
    "status": 1,
    "startDate": "2026-06-05T07:00:00.000Z",
    "providers": [
      {
        "providerId": 3,
        "errorMessage": null
      }
    ]
  }
]
```

### **Get Booked Sports**

Retrieves an explicit list of sports that are currently booked, along with an array of their active provider IDs.

* HTTP Method: `GET`
* Path: `/booking/api/booked-sports`

**Example Response**

```json
[
  {
    "sportId": 62,
    "providers": [2, 4, 3]
  },
  {
    "sportId": 0,
    "providers": [3]
  },
  {
    "sportId": 67,
    "providers": [2, 4, 3]
  }
]
```

### **Get Booked Leagues**

Retrieves an explicit list of leagues that are currently booked, along with an array of their active provider IDs.

* HTTP Method: `GET`
* Path: `/booking/api/booked-leagues`

**Example Response**

```json
[
  {
    "leagueId": 36791,
    "providers": [3]
  }
]
```

### **Bulk Book Entities**

Creates active bookings for a collection of sports, leagues, and individual events mapped to their respective providers.

* HTTP Method: `POST`
* Path: `/booking/api`

**Request Body Schema (`BookingDto`)**

The request body is an object map where each key is a `providerId` string/number.

* `sports` *(number\[], optional)*: Array of Sport IDs to book.
* `leagues` *(number\[], optional)*: Array of League IDs to book.
* `events` *(number\[], optional)*: Array of Event IDs to book.

**Example Request**

```json
{
  "2": {
    "events": [343901]
  },
  "4": {
    "sports": [10, 11],
    "leagues": [22]
  }
}
```

### **Bulk Unbook Entities**

Removes active bookings for sports, leagues, and individual events mapped across different provider IDs in a single operation.

* HTTP Method: `PATCH`
* Path: `/booking/api/unbook`

**Request Body Schema (`BookingDto`)**

The request body uses the exact same key-value dictionary structure where each dynamic root key represents a `providerId`.

* `sports` *(number\[], optional)*: Array of Sport IDs to unbook.
* `leagues` *(number\[], optional)*: Array of League IDs to unbook.
* `events` *(number\[], optional)*: Array of Event IDs to unbook.

**Example Request**

```json
{
  "2": {
    "events": [343901]
  },
  "4": {
    "sports": [10, 11],
    "leagues": [22]
  }
}
```

## Best Practices

* **RabbitMQ**
  * Keep consumers running continuously.
  * Use message IDs and timestamps (`lastUpdate`) for deduplication logic.
* **REST API**
  * Use it to fetch context, listings, and historical data.
  * Combine with live stream: use REST for initial snapshot + RabbitMQ for updates.
* **Performance**
  * Cache static data (sports, locations, market types).
  * Avoid requesting the same context too frequently.
