scoreriverDocumentation
Documentation/Data synchronization
SCORERIVER DEVELOPERS

Data synchronization

Load a copy of the data into your database, then keep it up to date.

1. Read the initial snapshot

Request /v1/realtime/bootstrap without watermark or afterId. The response contains data, watermark and nextId. It includes the resource types allowed by your key. When nextId is not null, request the next page with afterId=nextId and the same watermark. Continue until nextId is null.

Apply all pages before making the new local copy available to your application. Save the initial watermark as the starting cursor for updates. Cursors are decimal strings; do not convert them to JavaScript Number.

Shell / cURL
curl "$SCORERIVER_API_URL/v1/realtime/bootstrap?limit=100" \
  --header "Authorization: Bearer $SCORERIVER_API_KEY"

2. Apply updates

Call /v1/realtime/changes?after=<saved cursor>. For operation=upsert, replace the local record identified by entityId with data. For operation=archive, remove the record; data is null. Refresh cached responses whose paths appear in invalidates.

Apply the complete page and save nextCursor together with the updated state. Continue while hasMore=true. When hasMore=false, pause before polling again. Requests use the normal API allowance.

Changes for one resource

Per-resource /changes endpoints, such as /v1/players/changes, return notifications without the full record. Fetch entryId on upsert; remove it on archive. A detail request may return 404 if the record became unavailable after the notification. Do not confuse these notification pages with /v1/realtime/changes, which includes record data.

Recover synchronization

RESYNC_REQUIRED means the saved position can no longer be used: build a new bootstrap snapshot. For CURSOR_AHEAD, first verify the API base URL and stored cursor. Keep separate cursors for separate API environments and do not advance a cursor before applying its data.