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.

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.

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.

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"

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: ["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
}
Example
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.

POST
https://api4data.com/api/client/marketPrice
Headers
KeyValue
Content-Type application/json
Body (JSON)
FieldTypeDescription
marketId required string[] Market ids from Market list. Example: ["d01c481c5d5f0618b616bc160a27bb66"]
{
  "marketId": ["d01c481c5d5f0618b616bc160a27bb66"]
}
Example
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.

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");
});
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.

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.

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.