api4data
Client API · v1
Live market data API

api4data Docs

Fetch events, pull markets for those events, then get live market details — and listen on the socket for instant marketRate updates.

REST  https://api4data.com
Socket  https://socket.api4data.com
Live event  marketRate

Getting started

api4data gives you a clean client API to sync events and live markets. Call the endpoints in order so IDs stay linked correctly. Your server IP must be whitelisted before requests will work.

Rate limit: maximum 1 API call per second across all REST APIs (Event list, Market list, and Market details).
REST Base URL
https://api4data.com
Socket URL
https://socket.api4data.com
01

Event list

GET all events and store them in your system.

02

Market list

POST event id(s) to receive that event’s markets.

03

Market details

POST market id(s) to receive live market data.

04

Socket · marketRate

Listen for instant market updates on the socket.

Introduction

Follow these steps for a full integration.

Step 1 — Event list
Call /api/client/eventList. You receive the full event list. Save it locally so you can map users / UI to stable event ids.

Step 2 — Market list
Call /api/client/marketList with one or more eventId values from step 1. Use page and limit for pagination (limit max 200).

Step 3 — Market details
Call /api/client/marketPrice with marketId values from step 2 to get live market data for pricing / odds screens (max 200 market ids per request).

Step 4 — Socket · marketRate
Connect to https://socket.api4data.com and listen on the marketRate event. Whenever any market updates, you receive that update instantly over the socket — no need to keep polling Market details.

Tip: keep event and market ids exactly as returned by the API (string form). Do not transform or truncate them before the next request.
IP whitelist required: your server IP must be whitelisted before you can access the API and socket. Share your public IP with the api4data team so it can be added to the allowlist.

API reference

All client endpoints below are under https://api4data.com.

Event list

Returns every available event. Use this as your source of truth for event ids.

GET
https://api4data.com/api/client/eventList
Headers
KeyValue
Content-Type application/json
Body

None — this is a GET request.

Example
curl -X GET "https://api4data.com/api/client/eventList" \
  -H "Content-Type: application/json"
Sample response
{
  "message": "event list successful",
  "data": [
    {
      "_id": "69d8dec3e7cb6a418659eb4d",
      "eventId": "35303651",
      "exEventId": "b26c4f948b14bca4174b194d707ef7f9",
      "sportId": "6",
      "tournamentsId": "1576402161",
      "tournamentsName": "Boxing Matches",
      "eventName": "Floyd Mayweather Jr v Manny Pacquiao",
      "highlight": false,
      "quicklink": false,
      "popular": false,
      "IsSettle": 0,
      "IsVoid": 0,
      "IsUnsettle": 1,
      "dataSwitch": 0,
      "createdAt": "2026-04-10T11:28:03.576Z",
      "marketTime": "2026-09-20T03:30:00.000Z"
    }
  ]
}

Market list

Returns markets for the event id(s) you pass. Pass ids you stored from the Event list response.

POST
https://api4data.com/api/client/marketList
Headers
KeyValue
Content-Type application/json
Body (JSON)
FieldTypeDescription
eventId required string[] Event ids from Event list API. Example: ["35303651"]
page required integer Page number starting from 1
limit required integer Records per page. Maximum 200. Example: 10
{
  "eventId": ["35303651"],
  "page": 1,
  "limit": 10
}
Example
curl -X POST "https://api4data.com/api/client/marketList" \
  -H "Content-Type: application/json" \
  -d '{"eventId":["35303651"],"page":1,"limit":10}'
Sample response
{
  "message": "market list successful",
  "data": {
    "page": 1,
    "limit": 10,
    "totalPages": 1,
    "totalResults": 1,
    "results": [
      {
        "_id": "69d8df366435c37dc070f4f6",
        "eventName": "Floyd Mayweather Jr v Manny Pacquiao",
        "exEventId": "b26c4f948b14bca4174b194d707ef7f9",
        "exMarketId": "a26c25ae28270df1b4e9a5fcbec85839",
        "isPreBet": false,
        "marketName": "Match Odds",
        "marketTime": "2026-09-20T03:30:00.000Z",
        "sportName": "Boxing",
        "tournamentsName": "Boxing Matches",
        "type": "match_odds"
      }
    ]
  }
}

Market details

Returns live market data for one or more market ids. Use market ids from the Market list response.

POST
https://api4data.com/api/client/marketPrice
Headers
KeyValue
Content-Type application/json
Body (JSON)
FieldTypeDescription
marketId required string[] Use exMarketId values from Market list. Max 200 ids per request. Example: ["a26c25ae28270df1b4e9a5fcbec85839"]
{
  "marketId": ["a26c25ae28270df1b4e9a5fcbec85839"]
}
Example
curl -X POST "https://api4data.com/api/client/marketPrice" \
  -H "Content-Type: application/json" \
  -d '{"marketId":["a26c25ae28270df1b4e9a5fcbec85839"]}'
Sample response
{
  "message": "market list successful",
  "data": [
    {
      "_id": "69d8df366435c37dc070f4f6",
      "exMarketId": "a26c25ae28270df1b4e9a5fcbec85839",
      "marketName": "Match Odds",
      "marketTime": "2026-09-20T03:30:00.000Z",
      "runners": [
        {
          "selectionId": 3861213,
          "handicap": 0,
          "description": {
            "runnerName": "Floyd Mayweather Jr",
            "metadata": {
              "runnerId": "3861213"
            }
          },
          "state": {
            "sortPriority": 1,
            "lastPriceTraded": 1.63,
            "totalMatched": 0,
            "status": "ACTIVE"
          },
          "exchange": {
            "availableToBack": [
              {
                "price": 1.55,
                "size": 42.71
              },
              {
                "price": 1.54,
                "size": 133.45
              }
            ],
            "availableToLay": [
              {
                "price": 1.66,
                "size": 78.12
              },
              {
                "price": 1.67,
                "size": 24.78
              }
            ]
          }
        },
        {
          "selectionId": 2364143,
          "handicap": 0,
          "description": {
            "runnerName": "Manny Pacquiao",
            "metadata": {
              "runnerId": "2364143"
            }
          },
          "state": {
            "sortPriority": 2,
            "lastPriceTraded": 3,
            "totalMatched": 0,
            "status": "ACTIVE"
          },
          "exchange": {
            "availableToBack": [
              {
                "price": 3.1,
                "size": 19.2
              },
              {
                "price": 2.86,
                "size": 38.94
              }
            ],
            "availableToLay": [
              {
                "price": 3.3,
                "size": 70.61
              },
              {
                "price": 3.6,
                "size": 10.89
              }
            ]
          }
        },
        {
          "selectionId": 31162,
          "handicap": 0,
          "description": {
            "runnerName": "Draw",
            "metadata": {
              "runnerId": "31162"
            }
          },
          "state": {
            "sortPriority": 3,
            "lastPriceTraded": 17,
            "totalMatched": 0,
            "status": "ACTIVE"
          },
          "exchange": {
            "availableToBack": [
              {
                "price": 11,
                "size": 25.53
              },
              {
                "price": 9,
                "size": 15.23
              }
            ],
            "availableToLay": [
              {
                "price": 20,
                "size": 21.63
              },
              {
                "price": 22,
                "size": 14.78
              }
            ]
          }
        }
      ],
      "state": {
        "betDelay": 0,
        "bspReconciled": false,
        "complete": true,
        "inplay": false,
        "numberOfWinners": 1,
        "numberOfRunners": 3,
        "numberOfActiveRunners": 3,
        "lastMatchTime": "2026-04-09T18:39:46.195Z",
        "totalMatched": 1013.0356673161865,
        "totalAvailable": 1850.9237527197595,
        "crossMatching": true,
        "runnersVoidable": false,
        "version": 7270738430,
        "betDelayModels": [],
        "status": "SUSPENDED"
      },
      "type": "match_odds"
    }
  ]
}

Socket · marketRate

Connect to the live socket and listen for the marketRate event. Any market update is pushed to you instantly — use this after you have loaded markets via the REST APIs.

SOCKET
https://socket.api4data.com
Event
Event nameDescription
marketRate listen Fired whenever a market rate / price updates. Payload contains the latest market update so your UI can refresh instantly.
How it works

1. Connect your client to https://socket.api4data.com.

2. Subscribe / listen on the marketRate event.

3. On every market change, the socket emits marketRate with the update payload.

4. Apply that payload in your app immediately (no extra REST poll needed for live rates).

Example (Socket.IO client)
import { io } from "socket.io-client";

const socket = io("https://socket.api4data.com");

socket.on("connect", () => {
  console.log("connected", socket.id);
});

socket.on("marketRate", (data) => {
  // Instant market update — refresh rates in your UI
  console.log("marketRate update", data);
});

socket.on("disconnect", () => {
  console.log("disconnected");
});
Sample marketRate payload

Live push payload shape matches market details (rates update instantly on this event).

{
  "_id": "69d8df366435c37dc070f4f6",
  "exMarketId": "a26c25ae28270df1b4e9a5fcbec85839",
  "marketName": "Match Odds",
  "marketTime": "2026-09-20T03:30:00.000Z",
  "runners": [
    {
      "selectionId": 3861213,
      "handicap": 0,
      "description": {
        "runnerName": "Floyd Mayweather Jr",
        "metadata": {
          "runnerId": "3861213"
        }
      },
      "state": {
        "sortPriority": 1,
        "lastPriceTraded": 1.63,
        "totalMatched": 0,
        "status": "ACTIVE"
      },
      "exchange": {
        "availableToBack": [
          {
            "price": 1.55,
            "size": 42.71
          },
          {
            "price": 1.54,
            "size": 133.45
          }
        ],
        "availableToLay": [
          {
            "price": 1.66,
            "size": 78.12
          },
          {
            "price": 1.67,
            "size": 24.78
          }
        ]
      }
    },
    {
      "selectionId": 2364143,
      "handicap": 0,
      "description": {
        "runnerName": "Manny Pacquiao",
        "metadata": {
          "runnerId": "2364143"
        }
      },
      "state": {
        "sortPriority": 2,
        "lastPriceTraded": 3,
        "totalMatched": 0,
        "status": "ACTIVE"
      },
      "exchange": {
        "availableToBack": [
          {
            "price": 3.1,
            "size": 19.2
          },
          {
            "price": 2.86,
            "size": 38.94
          }
        ],
        "availableToLay": [
          {
            "price": 3.3,
            "size": 70.61
          },
          {
            "price": 3.6,
            "size": 10.89
          }
        ]
      }
    },
    {
      "selectionId": 31162,
      "handicap": 0,
      "description": {
        "runnerName": "Draw",
        "metadata": {
          "runnerId": "31162"
        }
      },
      "state": {
        "sortPriority": 3,
        "lastPriceTraded": 17,
        "totalMatched": 0,
        "status": "ACTIVE"
      },
      "exchange": {
        "availableToBack": [
          {
            "price": 11,
            "size": 25.53
          },
          {
            "price": 9,
            "size": 15.23
          }
        ],
        "availableToLay": [
          {
            "price": 20,
            "size": 21.63
          },
          {
            "price": 22,
            "size": 14.78
          }
        ]
      }
    }
  ],
  "state": {
    "betDelay": 0,
    "bspReconciled": false,
    "complete": true,
    "inplay": false,
    "numberOfWinners": 1,
    "numberOfRunners": 3,
    "numberOfActiveRunners": 3,
    "lastMatchTime": "2026-04-09T18:39:46.195Z",
    "totalMatched": 1013.0356673161865,
    "totalAvailable": 1850.9237527197595,
    "crossMatching": true,
    "runnersVoidable": false,
    "version": 7270738430,
    "betDelayModels": [],
    "status": "SUSPENDED"
  },
  "type": "match_odds"
}
Use REST (marketPrice) for the initial snapshot, then keep the socket open and apply marketRate events for live updates.

Integration notes

Recommended order: Event list → Market list → Market details → Socket marketRate.

Batching: eventId and marketId accept arrays, so you can request multiple ids in one call.

Max limit: Market list limit and Market details marketId array both support a maximum of 200 per request.

Rate limit: maximum 1 API call per second across all REST APIs.

Pagination: for large market lists, increase page while keeping the same limit (max 200).

Live updates: listen on marketRate at https://socket.api4data.com for instant market changes.

Content type: send and expect application/json on REST calls.

IP whitelist required: API and socket access is allowed only from whitelisted IPs. Contact the api4data team with your public server IP before going live.
If you were issued private credentials separately, attach them exactly as provided by the api4data team. Do not share keys in client-side public code.