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.
https://api4data.com
https://socket.api4data.com
Event list
GET all events and store them in your system.
Market list
POST event id(s) to receive that event’s markets.
Market details
POST market id(s) to receive live market data.
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.
Step 3 — Market details
Call /api/client/marketPrice with marketId values from step 2
to get live market data for pricing / odds screens.
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.
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.
https://api4data.com/api/client/eventList
| Key | Value |
|---|---|
Content-Type |
application/json |
None — this is a GET request.
curl -X GET "https://api4data.com/api/client/eventList" \ -H "Content-Type: application/json"
Market list
Returns markets for the event id(s) you pass. Pass ids you stored from the Event list response.
https://api4data.com/api/client/marketList
| Key | Value |
|---|---|
Content-Type |
application/json |
| Field | Type | Description |
|---|---|---|
eventId required |
string[] | Event ids from Event list API. Example: ["33796754"] |
page required |
integer | Page number starting from 1 |
limit required |
integer | Number of records per page. Example: 10 |
{
"eventId": ["33796754"],
"page": 1,
"limit": 10
}
curl -X POST "https://api4data.com/api/client/marketList" \
-H "Content-Type: application/json" \
-d '{"eventId":["33796754"],"page":1,"limit":10}'
Market details
Returns live market data for one or more market ids. Use market ids from the Market list response.
https://api4data.com/api/client/marketPrice
| Key | Value |
|---|---|
Content-Type |
application/json |
| Field | Type | Description |
|---|---|---|
marketId required |
string[] | Market ids from Market list. Example: ["d01c481c5d5f0618b616bc160a27bb66"] |
{
"marketId": ["d01c481c5d5f0618b616bc160a27bb66"]
}
curl -X POST "https://api4data.com/api/client/marketPrice" \
-H "Content-Type: application/json" \
-d '{"marketId":["d01c481c5d5f0618b616bc160a27bb66"]}'
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.
https://socket.api4data.com
| Event name | Description |
|---|---|
marketRate listen |
Fired whenever a market rate / price updates. Payload contains the latest market update so your UI can refresh instantly. |
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).
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");
});
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.
Pagination: for large market lists, increase page while keeping the same limit.
Live updates: listen on marketRate at https://socket.api4data.com for instant market changes.
Content type: send and expect application/json on REST calls.