Skip to main content

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 -s -H "Authorization: Bearer $VERTEX_TOKEN" \
"https://trading.vertex-api.com/api/v2/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.

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));

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).

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

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" } }], ... }] }
Resubscribing replaces, not adds

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​