REST, streaming or webhooks

Four ways to receive the same data. Compare tasks and channels below, with real stream frames, connection limits and recovery after a disconnect.

Task → channel

Start here. The first two options cover most use cases without keeping a connection open.

Your taskUseWhy
A match page, standings or schedule on your website GET /v1/event/{id}
GET /v1/events
Standard requests with your own cache. No persistent connection; debug with curl.
Initial history import into your database GET /v1/sync 每次按游标批量返回最多 500 场比赛(Starter+ 套餐):内嵌 incidents、statistics、lineups、hockey_units 与 player_stats;而体积较大的坐标、赔率与天气数据块(shotmap、momentum、odds、weather、commentary)由 GET /v1/event/{id} 提供。
Nightly reconciliation with our data GET /v1/sync 携带已保存游标的同一请求(Starter+)仅返回发生变更的比赛及 removed 记录(包含 reason: "merged" 及 replaced_by),一套代码即可兼顾全量导入与增量对账。
Scores update in an open browser tab GET /v1/stream Server-Sent Events (SSE). The browser reconnects automatically, and we replay missed events.
Your server receives one connection and distributes updates GET /v1/stream
WS /v1/stream/ws
One connection replaces polling by thousands of individual clients.
You need two-way communication WS /v1/stream/ws WebSocket provides a return channel and includes a cursor in every frame.
You do not want a persistent connection webhooks We send signed requests to your endpoint: how it works.
Catch up after an outage GET /v1/stream/replay Events by cursor for the previous 7 days, up to 500 per request.

Streaming and webhooks use the same event envelope, byte for byte. Switch between channels without rewriting your handler.

Server-Sent Events (SSE)

One persistent HTTP connection carries events. Pass the key in the x-api-key header or the key parameter; the latter is needed by browser EventSource, which cannot set custom headers.

Filters in the URL

sport, league, event_type accept comma-separated values. You receive only events matching your filters and access rights.

Heartbeats distinguish idle from disconnected

When there are no events, a heartbeat arrives every 15 seconds. Proxies and clients can tell that the connection is still alive.

Connections refresh automatically

After 60 minutes, the server requests a reconnection. This regular cycle prevents long-lived connections from silently expiring.

Resume after a disconnect

The client returns the last id in the Last-Event-ID header, and we replay subsequent events, up to 500 events.

GET /v1/stream?sport=football
: connected cursor=98213152
retry: 1000

id: 98213377
event: match.goal
data: {"id":"evt_11220580_17","type":"match.goal", …}

: keep-alive 1785686355 cursor=98213377

// after one hour:
: server-cycle; reconnect with Last-Event-Id
WS /v1/stream/ws?key=…&sport=football
// first frame
{"type": "connected", "cursor": 98213152}

// event: cursor + the same envelope
{"cursor": 98213377, "id": "evt_11220580_17",
 "type": "match.goal", "data": { … }}

// while idle
{"type": "heartbeat", "ts": 1785686355,
 "cursor": 98213377}

// after one hour
{"type": "reconnect", "cursor": 98213377}

WebSocket

The same stream uses JSON frames and a return channel. Every frame includes a cursor, so you do not need a separate counter. On reconnect, pass it in the cursor parameter.

Close codes explain rejected connections

4401 means the key was rejected; 4402 the channel is outside your plan; 4422 the filter is invalid; 4429 the connection limit was exceeded. Each rejection has an explicit cause.

Pass the key as a parameter

Browser WebSocket cannot set custom headers, so pass the key in key. Server clients may also use the x-api-key header.

Limits

意向套餐 capacity before your live traffic arrives.

5concurrent connections per account, shared by SSE and WebSocket
60 minmaximum connection lifetime before reconnecting
15 sheartbeat interval while no events occur
500events replayed on reconnection
7 daysreplay history window
意向套餐Requests per secondStreaming and webhooks
Free 500 次请求 / 月 no
Starter 5 no
Pro 20 included
Business 100 included

There are no daily request limits; request frequency is limited per second. For the full plan details, see the pricing page.

Webhooks

Instead of polling, receive signed POST requests at your endpoint. No persistent connection is needed. Provide a public endpoint that responds promptly.

Only 2xx responses count as success

A timeout, 500 response or disconnect triggers a retry. There are up to 6 retries, with a response timeout of 8 seconds. Return 2xx immediately, then process the event in your own queue.

Silence is a signal too

An idle push channel and a broken one can look the same. For an idle subscription, every 15 minutes we send a signed webhook.ping using the same delivery method and signature. Silence beyond that interval indicates a delivery problem.

Request missed events

If your receiver was down beyond the retry window, retrieve the missed events: GET /v1/stream/replay?since={cursor}&limit=500, history window: 7 days. This uses the same cursor as SSE and WebSocket.

Signature verification and setup

The signature uses HMAC-SHA256 over the string “timestamp, dot, raw body”. The secret is issued once when the subscription is created and is not shown again. The timestamp is part of the signed content, so a captured payload cannot be replayed with a new timestamp.

  • Check the timestamp. Reject requests if X-Scoraline-Timestamp differs from your clock by more than 5 minutes.
  • Compute over the raw body using the received bytes before parsing JSON. A string re-serialized from the object will produce a different signature.
  • Compare securely using a timing-safe comparison: hmac.compare_digest, hash_equals.
  • Rotate secrets without downtime. For 24 hours, both signatures arrive separated by a comma. Accept the request if either matches.

How to set up. Create a subscription in your account: receiver URL, required event types and optional sport and league filters. The URL must use https and be public. Internal network addresses are rejected during creation and checked again before every delivery. Redirects are not followed. The “Send test event” button sends a real signed request to verify your implementation. Each subscription has a delivery log in your account showing the event, response code, attempt count and next retry time.

Webhooks are included in Pro and Business; see pricing.

Reconnection and replay

Disconnects happen with mobile networks, restarts and regular connection cycling. Recovery follows the same process.

Save the last event cursor

In SSE, use the id: line; in WebSocket, the cursor frame field. One integer cursor is used across all channels.

Reconnect using the same cursor

For SSE, use the Last-Event-ID header (the browser sends it automatically) or the last_event_id parameter. For WebSocket, use the cursor parameter.

Missed events arrive first

Up to 500 events arrive immediately after connection, then the normal stream resumes.

If you missed more events

Request the remainder: GET /v1/stream/replay?since={cursor}&limit=500. The response contains next_cursor and has_more; paginate until you catch up.

If the outage was longer still

Beyond 7 days, events are no longer retained. Reconcile with GET /v1/sync (Starter+), which iterates over matches (embedding incidents, statistics, lineups, hockey_units, player_stats), while heavy blocks (shotmap, momentum, odds, weather, commentary) live in GET /v1/event/{id}.

Limitations

Account for these channel limitations when designing your integration.

  • Unlimited connections. There are 5 per account; the sixth is rejected. Keep one connection on your server and distribute updates to your clients instead of connecting from every tab.
  • Permanent connections. After 60 minutes, a reconnecti按需定制 arrives. A reconnection handler is required and also handles network failures.
  • Strict ordering and exactly-once delivery. Restore ordering using sequence within a match. Duplicate delivery is possible, so handlers must be idempotent.
  • A stream of every database change. The stream contains the documented match events, just like webhooks. It is not a journal of every database edit.
  • Retention beyond 7 days. Use normal match requests for older data.
  • Streaming and webhooks on entry-level plans. They are included in Pro and Business.

The values on this page were checked against production responses on 5 August 2026.

Explore other sections

Choose the right delivery channel

Start with standard requests and switch to streaming without rewriting your handler.

开发文档
支持美元 (USD) 支付 支持企业合同 (B2B) Free trial access