Adjust Player Value
horizon_adjust_player_valueAdjusts one player's value by a signed amount within enabled project rules and per-call/daily limits, using a stable operation ID and session token.
Instructions
Adjusts one player value within explicitly enabled project rules and per-call and daily limits. Use when: the configured game permits a direct value adjustment; use horizon_get_player_values to inspect the result. Not for: trusted rewards or arbitrary grants; client adjustment is disabled by default. Purchases use horizon_purchase_player_value_offer. Requires: userId and the player's session: sign in with horizon_signin_email or horizon_signin_anonymous and pass its accessToken as sessionToken. This definition must enable adjustment. Side effects: Applies the signed amount once per operationId. The minimal guard binds the original reason/payload hash without copying the reason. Never creates an ID or retries automatically. Returns: Current state with replayed/alreadyApplied. Fresh success includes its delta; replay has empty applied/items. Errors: ADJUST_NOT_ALLOWED or ADJUST_ABOVE_LIMIT: change the game flow or project rules. 409 STATE_CONFLICT: refresh state and retry the SAME operation ID and payload. OPERATION_CONFLICT: do not reuse an ID for a different action. OPERATION_EXPIRED: reconcile state/history; never silently generate another ID. INSUFFICIENT_BALANCE, MAX_BALANCE_REACHED or DAILY_LIMIT_REACHED leaves the whole operation unapplied. 401 means the session is missing or expired: sign in again and retry with the new accessToken. 403 for a session means the token belongs to another user: pass the userId that signed in. 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 |
|---|---|---|---|
| key | Yes | Configured value or offer key, 1 to 24 lowercase letters, digits, '.', '_' or '-' | |
| amount | Yes | Nonzero signed safe integer delta; limited by the project rules | |
| reason | Yes | Nonblank audit reason, at most 200 UTF-8 bytes | |
| userId | Yes | Player UUID belonging to the selected project and player session | |
| operationId | Yes | Stable operation ID: server-aligned Unix milliseconds + ':' + UUID. Persist before sending; reuse unchanged on timeout or retry | |
| sessionToken | Yes | Player accessToken from sign-in, sent only in the Authorization Bearer header |