Quickstart
Confirm your Vertex credentials work in two checks: one REST call and one WebSocket connection.
Prerequisites
- A bearer token issued during onboarding. If you don't have one, contact your integration manager.
curl(for the shell example) or Node.js 18+ / Python 3.9+ (for the language examples).
Set the token in your environment so it never lands in your shell history:
export VERTEX_TOKEN="<your-token>"
All examples below reference $VERTEX_TOKEN. Never paste the literal value into source code.
1. Test the REST API
A single authenticated GET /sports proves your token is valid and the API is reachable.
- curl
- JavaScript
- Python
curl -s -H "Authorization: Bearer $VERTEX_TOKEN" \
"https://trading.vertex-api.com/api/v2/sports"
const res = await fetch('https://trading.vertex-api.com/api/v2/sports', {
headers: { Authorization: `Bearer ${process.env.VERTEX_TOKEN}` },
});
console.log(res.status, (await res.json()).data.length, 'sports');
import os, requests
res = requests.get(
"https://trading.vertex-api.com/api/v2/sports",
headers={"Authorization": f"Bearer {os.environ['VERTEX_TOKEN']}"},
)
print(res.status_code, len(res.json()["data"]), "sports")
Expected response: HTTP 200 with a wrapped array of sports.
{
"data": [
{ "id": 1, "name": "Soccer", "code": "soc" },
{ "id": 6, "name": "Ice Hockey", "code": "ih" }
]
}
If you get 401, your token is missing or invalid. Re-check the VERTEX_TOKEN env var.
2. Test the WebSocket
The same $VERTEX_TOKEN from step 1 is used to authenticate against the WebSocket feed. Pass it as a token query parameter on the connection upgrade.
wss://trading-ws.vertex-api.com/ws?token=<your-token>
2.1 Connect
Open the socket and confirm the handshake succeeds.
- JavaScript
- Python
import WebSocket from 'ws'; // npm install ws
const ws = new WebSocket(
`wss://trading-ws.vertex-api.com/ws?token=${process.env.VERTEX_TOKEN}`
);
ws.on('open', () => console.log('Connected'));
ws.on('error', (e) => console.error('Connection error:', e.message));
# pip install websocket-client
import os, websocket
URL = f"wss://trading-ws.vertex-api.com/ws?token={os.environ['VERTEX_TOKEN']}"
def on_open(ws): print("Connected")
def on_error(ws, err): print(f"Connection error: {err}")
ws = websocket.WebSocketApp(URL, on_open=on_open, on_error=on_error)
ws.run_forever()
A successful handshake fires the open event. If you see 401, the token is missing or invalid. Re-check $VERTEX_TOKEN.
2.2 Subscribe to price updates
A connection alone receives nothing. You must subscribe. Send a subscribe frame to register interest in a channel. The market channel emits market_updates (markets and their selections, with current prices), which is the most useful single stream to verify against.
Omit event_ids to receive every update on the channel. Pass an array of event IDs to filter (see below).
- JavaScript
- Python
ws.on('open', () => {
ws.send(JSON.stringify({ type: 'subscribe', channel: 'market' }));
// To filter:
// ws.send(JSON.stringify({ type: 'subscribe', channel: 'market', event_ids: [12345] }));
});
ws.on('message', (raw) => {
const msg = JSON.parse(raw.toString());
if (msg.type === 'subscribe') {
console.log('Subscribed:', msg);
} else if (msg.type === 'market_updates') {
console.log('Market update:', msg.markets);
}
});
import json
def on_open(ws):
ws.send(json.dumps({"type": "subscribe", "channel": "market"}))
# To filter:
# ws.send(json.dumps({"type": "subscribe", "channel": "market", "event_ids": [12345]}))
def on_message(ws, raw):
msg = json.loads(raw)
if msg.get("type") == "subscribe":
print("Subscribed:", msg)
elif msg.get("type") == "market_updates":
print("Market update:", msg["markets"])
ws = websocket.WebSocketApp(URL, on_open=on_open, on_message=on_message, on_error=on_error)
ws.run_forever()
Expected output: a subscribe ack with status: "ok", followed by a stream of market_updates payloads as prices move.
{ "type": "subscribe", "status": "ok", "channel": "market", "effective": { "event_ids": [] } }
{ "type": "market_updates", "published_at": "2026-05-30T14:00:05.123Z", "markets": [{ "id": 8842, "event_id": 12345, "selections": [{ "id": 35928, "price": { "price": 2.6747, "status": "active" } }], ... }] }
Sending a second subscribe on the same channel replaces the previous filter, so always pass the full desired filter set. Use unsubscribe to stop a single channel or unsubscribe_all to clear everything.
Next steps
- Place a Bet walkthrough: full bet-placement flow, end to end.
- REST API reference: every endpoint with request/response schemas and try-it-now.
- WebSocket Feed: message envelopes, subscriptions, heartbeats, and reconnect.
- Concepts: pricing, reference prices, stages.