Update Player Statistics Batch
horizon_update_statisticsAtomically updates a player session's statistic counters in one batch using a persisted operation ID, enabling safe retries after uncertain timeouts without duplicate writes.
Instructions
Applies one explicit atomic session batch with a caller-persisted operation ID. Use when: reporting completed session counters, or retrying exactly the same durable ID and payload after an uncertain timeout. Not for: automatically generating another ID for a failed/unknown outcome, or one HTTP call per counter. Requires: userId and the player's session: sign in with horizon_signin_email or horizon_signin_anonymous and pass its accessToken as sessionToken. Persist the original operationId and unchanged updates before sending. ID is <13-digit Unix milliseconds>:; use the snapshot server operation time for clock alignment. Side effects: Updates all counters atomically. A retained same-ID same-payload receipt replays; changed payload conflicts. Eight receipts and a persistent eviction floor can reject delayed out-of-order unknown IDs even within 24 hours; nothing is rebooked. Returns: The current statistics snapshot with operationId and replayed. Errors: 401 SESSION_REQUIRED: sign in again; 403 SESSION_FORBIDDEN: use the matching player. 409 OPERATION_CONFLICT means the ID was already used for a different payload. 410 OPERATION_EXPIRED rejects an expired/evicted unknown ID. Never replace an uncertain ID automatically. 422 UNKNOWN_STATISTIC/UPDATE_ABOVE_LIMIT/VALUE_OVERFLOW rejects the whole batch. Needs HORIZON_API_KEY. Every failure returns an error result (isError) with the HTTP status and body: a 401 that horizon_test_connection also returns means HORIZON_API_KEY is wrong, 429 means the account's per-minute rate limit was reached (wait a minute, then retry).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | Signed-in player UUID matching the supplied session token | |
| updates | Yes | Original immutable batch of distinct statistic keys with safe integer values; server enforces the current System Config definition limit, which can exceed tier defaults | |
| operationId | Yes | Original durable <13-digit Unix milliseconds>:<UUID> operation ID; reuse unchanged on retry | |
| sessionToken | Yes | Player accessToken from horizon_signin_anonymous or horizon_signin_email; sent as Bearer |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| userId | Yes | ||
| values | Yes | ||
| replayed | No | ||
| revision | Yes | ||
| definitions | Yes | ||
| operationId | No | ||
| newlyUnlocked | Yes | ||
| operationWindow | Yes | ||
| definitionVersion | Yes |