Returning.AIDevelopers
v1

API reference / Gamification / Streaks & Mini Games

.md

Update user spin-wheel information

Add, remove or set one trader's available spins, wheel streak or both on one spin-the-wheel game.

Last updated 26 Sep 2026API v1

Method
POST
Path
https://api.returning.ai/v1/mini-game-logs/update-wheel-info
Permission
customerSuccess
Retries
No Idempotency-Key; read state before retrying

When to use this

  • Give back a spin a trader lost to a fault on your side, once your team has approved the correction.
  • Restore a trader's wheel streak after an outage broke it.
  • Remove spins that were granted by mistake.

Authentication#

Header
Authorization: Bearer <API_KEY>
Permission
customerSuccessShown in the dashboard as “Customer Success”

Use a Community API key with customerSuccess, shown in the dashboard as Customer Success, and keep it on your server. The key decides the community, so gameId must be a wheel in that community.

Behaviour#

This changes a trader's balance of spins, so agree a correction before you send it. Read the trader's current state and history first, then send one correction and read the state again.

Spins you add never expire. When spins are removed, by subtract or an overwrite below the current count, the spins closest to expiry go first. Adding spins also raises the trader's total of spins earned. Setting the streak also raises the trader's best streak on this wheel when the new value is higher; it never lowers it.

When you send both, spins change first and the streak second. Each call adds one admin-updated entry to the trader's mini-game logs, attributed to API Admin. Two overwrite calls for the same trader at the same moment can both add spins, so send corrections one at a time.

Request#

Headers#

Authorization#stringREQUIRED
Community API key with customerSuccess.

RuleBearer <API_KEY>

Content-Type#stringREQUIRED
Request body format.

Ruleapplication/json

Body#

Send email, gameId, and at least one pair: spin_op with spin, streak_op with streak, or both pairs. The pairs are independent: you can add spins and overwrite the streak in the same call. Values of 0 are allowed, so overwrite with 0 clears spins or the streak.

The email lookup isn't limited to your community: an email that belongs to someone outside it still updates that person's state on your wheel. Confirm the trader with Get User Data first.

email#stringREQUIRED
The trader's email. Matched without regard to case.

RuleEmail format

Eg"trader@example.com"

gameId#stringREQUIRED
ID of a spin-the-wheel game in your community. It isn't returned by Get mini-game and streak state; take it from miniGameId in the trader's mini-game logs.

Rule24-character hex ID

Eg"66f000000000000000000702"

spin_op#stringOPTIONAL
How to apply spin: add gives extra spins, subtract removes spins (never below 0), overwrite sets the available spins to exactly spin. Required with spin.

Ruleadd, subtract or overwrite

Eg"add"

spin#integerOPTIONAL
Number of spins for spin_op. Send spin, streak or both.

RuleWhole number, 0 or more

Eg1

streak_op#stringOPTIONAL
How to apply streak: add, subtract (never below 0) or overwrite. Required with streak.

Ruleadd, subtract or overwrite

Eg"overwrite"

streak#integerOPTIONAL
The streak value for streak_op.

RuleWhole number, 0 or more

Eg3

curl --request POST \
  --url https://api.returning.ai/v1/mini-game-logs/update-wheel-info \
  --header 'Authorization: Bearer <API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "email": "trader@example.com",
    "gameId": "66f000000000000000000702",
    "spin_op": "add",
    "spin": 1,
    "streak_op": "overwrite",
    "streak": 3
  }'

Response#

A 200 means the changes are saved. data.spinResult and data.streakResult appear only for what you sent. This endpoint has no top-level code; branch on the HTTP status.

status#stringALWAYS
Result of the request.

Rulesuccess

message#stringALWAYS
Human-readable summary that includes the email. Do not branch on it.
data#objectALWAYS
What changed.
miniGameId#stringALWAYS
The game you changed.
gameName#stringALWAYS
The game's name.
spinResult#string
Present when you sent spin. Says what happened, such as Added 1 spin(s). 0 -> 1, Removed 2 spin(s). 3 -> 1 or No change needed. Current: 1. Wording can change; read the new state instead of parsing it.
streakResult#string
Present when you sent streak, such as Streak updated. 0 -> 3.
{
  "status": "success",
  "message": "Updated wheel info for trader@example.com",
  "data": {
    "miniGameId": "66f000000000000000000702",
    "gameName": "Daily Spin the Wheel",
    "spinResult": "Added 1 spin(s). 0 -> 1",
    "streakResult": "Streak updated. 0 -> 3"
  }
}

Errors#

Errors on this endpoint have no machine-readable code; branch on the HTTP status. A key without customerSuccess gets 401, not 403, with only a message. A body without spin or streak, or with a value but no matching _op, returns an HTML 500 page instead of a JSON 400.

Fix the request02

400Fix the request
email or gameId is missing or malformed, an _op isn't add, subtract or overwrite, or a value is negative or not a whole number. detail names each field. Nothing changed.
401Fix the request
The key is missing, invalid or expired, it's a personal key, or it lacks customerSuccess (message is then Your api key does not have permission to access this action). Send Authorization: Bearer <API_KEY> with a current Community API key, and add Customer Success in Settings > Integration > API Keys.

Fix the data01

404Fix the data
Nothing changed. message says which: User not found with the provided email, or Spin wheel game not found for the provided gameId (the ID isn't a spin-the-wheel game in your community).

Do not retry01

500Do not retry
An HTML error page, not JSON, means the body had neither spin nor streak, or sent a value without its _op. Nothing changed; fix the body. A JSON 500 means the update failed part-way, and the spin change may already be saved. Read the trader's state before you try again.
{
  "meta": {
    "status": "error",
    "statusCode": 400
  },
  "message": "Update user wheel info endpoint validation error.",
  "detail": {
    "spin_op": "Invalid enum value. Expected 'overwrite' | 'add' | 'subtract', received 'multiply'"
  },
  "solution": "Check your body in request and try again"
}

Next step#

Get mini-game and streak statePOST/v1/users/mini-game-streak-statsConfirm the trader's new spins and streak.