1. Referral
Returning.AI
  • Getting Started
  • Users
    • Get user
      GET
    • Get Users with Filters
      POST
    • Create New User
      POST
    • Get User Data
      POST
    • Manage User Account
      POST
    • List mini-game logs by user email
      POST
    • Get current mini-game and streak state
      POST
    • Get User Milestones
      POST
    • Update User Data, Identifier, And Roles
      POST
    • Update User XP and Currency
      POST
  • Messaging
    • Agent messaging workflow
    • Get Messages
      GET
    • Send Message
      POST
    • Reply Message
      POST
    • React Message
      POST
    • Upload message images
      POST
  • Gamification
    • Leaderboards
      • List leaderboards with pagination
      • Create a new leaderboard
      • Update an existing leaderboard
      • Get a single leaderboard by ID
      • Delete a leaderboard
    • Streaks & Mini Games
      • List user streak logs
      • Update user spin-wheel information
    • Referral
      • Referral Program Integration
      • Mini-game State and History
      • Get referral programs
        GET
      • Get user's referral summary
        POST
    • Rolling Data
      • Get Daily Calculation Data
      • Get Rolling Calculation Data
    • Match Predictions
    • Get tier configuration
      GET
    • Get daily user XP and coin changes
      POST
    • Search user gamification logs
      POST
    • Get user activity stats
      POST
  • Rewards & Redemptions
    • Update redemption order status or refund
    • List redemption orders by user email
    • List redemption statuses
    • Get redemption status by ID
    • List redemption orders by community
    • Create redemption order status
    • Get redemption order status history
  • Chart Analysis
    • Create Analysis
    • Get Analysis
    • Update Analysis
    • Delete Analysis
    • List Analyses
    • Append Drawings
  • Bulk Operations
    • List bulk update jobs
    • Get bulk update job status
    • Get bulk update job details
    • Bulk update users from CSV
    • Bulk update premium currency from CSV
  • Channels
    • Iframe
    • List integration channels
  • Events
    • Outgoing webhooks
      • Encryption
      • User Joins Server
      • User Visits server
      • New Message Posted Anywhere
      • New Message Posted To channel
      • Purchased Store Item
    • Incoming webhooks
      • API Keys & Encryption
      • Send message into channels
      • Update Custom User Fields
      • Update In-game currency
  • Widgets
    • Authenticated Widgets
    • Public widgets
  • Community Analytics
    • Get Loyalty Overview
    • Get Phone Verification Contacts
  • Store
    • Purchase History
      • Update redemption instructions or voucher details
    • Categories
      • List Store categories
      • Create Store category
      • Get Store category by ID
      • Update Store category
      • Delete Store category
    • Products
      • List products
      • Update products in bulk
      • Create products in bulk
      • Create product with vouchers
      • Read product
      • Update product and append vouchers
      • Delete product
    • Redemption-transaction
      • Get redemption transaction detail
    • Get Store configuration
    • Update Store configuration
  • Community
    • Appearance
      • Update community theme colors
      • Update community bot profile
      • Update community URL metadata
      • Update community name and URL
    • Community Users
      • Get community users
      • Get user
    • Create community
  • API Keys
    • Community API Keys
      • Create API key
      • Read API keys
      • Delete API key
      • Update API key
    • User API Keys
      • List user API keys
      • Create user API key
      • Update user API key
      • Delete user API key
      • Get current API key information
  • User Fields
    • User Field History
      • Get all user field histories in a community
      • Get user field histories for a specific field
      • Get user field histories for a specific user
      • Get user field histories of specific user field and user
      • Update A User Field Value
      • Deprecated Field-First History Write
      • Deprecated Field-First History Read
    • Get A User Field Definition
    • Update A User Field Definition
    • Create A User Field Definition
    • Delete A User Field Definition
    • List User Field Definitions
    • Delete user field
    • Update user field
    • Get specific user field
  • Legacy
    • Servers
      • Create server
      • List servers
      • Update server metadata
    • Bulk Operations
      • Bulk import users from CSV
    • Authentication
      • Secure Auth
      • Register user with password
      • Verify user email
      • Log in user with password
    • Badges
      • List badges
      • Create badge
      • Update badge
      • Delete badge
      • Remove badge from user
      • Award badge to user
    • Messaging
    • Roles & Permissions
      • List server roles
      • Create role
      • Update role
      • Delete role
      • List user roles
      • Add role to user
      • Remove role from user
    • Users
      • Upload user avatar
    • Channels
      • Create channel
      • Update channel
      • Delete channel
    • API Keys
      • List integration API keys
      • Create integration API key
      • Delete integration API key
      • Update integration API key
  • Schemas
    • Sample Schemas
    • Schemas
    • Outgoing webhooks
    • Analysis
    • Pet
    • Category
    • Tag
    • ValidationError
    • NotFoundError
    • InternalServerError
    • NotImplementedError
    • CreateUserFieldHistoryResponse
    • CreateUserFieldHistorySuccessResponse
    • UserFieldHistoryItem
    • GetUserFieldHistoriesResponse
    • UserFieldHistoriesValidationError
    • UserFieldHistoriesMetaWithValidation
    • UserFieldHistoriesMetaWithPagination
    • GetUserFieldHistoriesSuccessResponse
    • CreateUserFieldResponse
    • CreateUserFieldSuccessResponse
    • DeleteUserFieldResponse
    • DeleteUserFieldSuccessResponse
    • UserFieldCreator
    • GetUserFieldResponse
    • GetUserFieldSuccessResponse
    • ValidationErrorItem
    • GetUserFieldsMetaResponse
    • CreatorInfo
    • UserFieldResponse
    • GetUserFieldsSuccessResponse
    • UpdateUserFieldResponse
    • UpdateUserFieldPayload
    • UpdateUserFieldSuccessResponse
    • MetaResponse
    • GetUserResponse
    • GetUserSuccessResponse
    • Purchased store item
    • ErrorResponse
    • New message posted to channel
    • UpdateAnalysisRequest
    • User visits server
    • AppendDrawingsRequest
    • User join server
    • CreateAnalysisResponse
    • GetAnalysisResponse
    • UpdateAnalysisResponse
    • AppendDrawingsResponse
    • AnalysisMetadata
    • Expiry
    • Levels
    • LevelEntry
    • Drawing
    • HorizontalLineDrawing
    • LineDrawing
    • RectangleDrawing
    • ParallelDrawing
    • FibonacciRetracementDrawing
    • Coordinate
    • DrawingStyle
    • AnalysisDetail
    • AnalysisSummary
    • CreateAnalysisRequest
    • ListAnalysesResponse
    • StandardApiError
    • StandardSuccessEnvelope
    • PurchasedStoreItemEvent
    • ChannelMessagePostedEvent
    • UserVisitedCommunityEvent
    • UserJoinedCommunityEvent
  1. Referral

Mini-game State and History

Use these two read-only endpoints together to support spin wheels, streaks, and quiz history without confusing current availability with past events.
WARNING
Both calls are server-to-server. Use a Community API key with customerSuccess, and never expose it to a browser or mobile client.

Which endpoint should I use?#

QuestionEndpoint
How many spins are available now?Get current mini-game and streak state
Is the current wheel mission cleared?Get current mini-game and streak state
Has the user spun during the current UTC day?Get current mini-game and streak state
When was a spin earned, used, or expired?List mini-game logs by user email
Why did a streak change?Current state first, then logs for chronology
Did an admin adjustment occur?Logs, filtered locally for admin-updated

1. Read current state first#

Send the user's email to /v1/users/mini-game-streak-stats. The response includes active spin wheels and configured streaks. Match by name, because array order is not guaranteed.
Interpret the wheel fields independently:
spins is the number of currently available spins.
missionCleared describes the latest mission activity that has not expired.
spinToday means at least one spin result exists during the current UTC day.
currentStreak is the stored streak counter.
These values can differ legitimately. For example, a user may have cleared a mission but already used the resulting spin.

2. Read history when the state needs explanation#

Call /v1/mini-game-logs/by-email with a small page size. Page 1 is newest first. Follow the relevant gameName and action sequence:
spin-earned adds historical evidence that a spin became available;
spin-used shows consumption;
spin-expired shows an unused spin expired;
streak-earned and streak-broken explain streak transitions;
admin-updated marks a manual adjustment;
quiz actions record quiz lifecycle outcomes.
Fields are action-specific. Do not require reward, mission, spin, streak, or admin fields on every row.

3. Treat time consistently#

spinToday uses the UTC day. Log timestamps are UTC ISO-8601 values. Compare createdAt, expiresAt, and expiredAt in UTC before diagnosing a missing or expired spin.
Mission windows can be daily, weekly, or monthly. A previously completed mission does not keep missionCleared true after its activity expires.

4. Handle empty results correctly#

Current state can return empty arrays when no wheels or streaks are configured.
A configured wheel can return 0 and false values.
Logs can return 200 with an empty list and totalPages: 0.
An unresolved email returns 404.
An empty result is community-scoped. Do not use it to claim that the identity or activity does not exist globally.

5. Troubleshooting checklist#

1.
Confirm the API key belongs to the intended community and has customerSuccess.
2.
Confirm the email is valid; matching is case-insensitive.
3.
Read current state and record the exact wheel/streak name.
4.
Read logs page 1 and follow the matching game's events.
5.
Paginate only when the target period is older.
6.
Compare all dates in UTC.
7.
Use the business system that drives the mission to explain eligibility; do not infer it from the mini-game APIs alone.
8.
Escalate before any manual correction. These two endpoints are read-only and should remain the verification path before and after an approved change.

Acceptance checks#

A complete integration test should cover:
authenticated success with configured data;
success with empty logs;
success with empty configuration;
default and explicit pagination;
invalid email and pagination boundaries;
unresolved email;
key without customerSuccess;
correlation of one earned/used/expired sequence with the current state;
UTC day-boundary behavior for spinToday.
Modified at 2026-08-17 18:45:20
Previous
Referral Program Integration
Next
Get referral programs
Built with