Update user spin-wheel information
Add, remove or set one trader's available spins, wheel streak or both on one spin-the-wheel game.
- 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#
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.
RuleEmail format
Eg"trader@example.com"
miniGameId in the trader's mini-game logs.Rule24-character hex ID
Eg"66f000000000000000000702"
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_op. Send spin, streak or both.RuleWhole number, 0 or more
Eg1
streak: add, subtract (never below 0) or overwrite. Required with streak.Ruleadd, subtract or overwrite
Eg"overwrite"
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.
Rulesuccess
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.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
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.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
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
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"
}