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

Get user's referral summary

POST
/v1/referral/summary

What this endpoint does#

Returns one community member's referral invite link, aggregate referral activity, referred members, and per-program stage progress. The API key supplies community scope; the request identifies the member whose referral dashboard you want to render.
INFO
A valid member with zero referrals returns 200 with zero activity and referees: []. 404 User not found means identity resolution failed inside the API key's community; it does not mean the referral program is missing.

Quick start#

Authentication and permission#

Use a server-side community API key with getUserData. Do not send communityId; the key fixes the tenant boundary. Missing, invalid, or expired keys return 401; a valid key without permission returns 403.

Choose the same stable identity used at registration#

identifier.typevalue meansExtra field
idReturning.AI member ObjectIdNone
emailStored member emailNone
data-emailEmail-style external identity used by the integration or widget mappingNone
data-customer-idStable broker or customer identity used by the integration or widget mappingNone
cognito-subStable Cognito subject stored for the memberNone
custom-fieldValue stored in a named custom user fieldfieldName is required
For custom-field, fieldName is required and must be the configured field's exact API name. A field label, a field from another community, or the referrer's identifier in place of the current member's identifier returns no match.

Complete examples#

The request examples show a mapped external customer ID and an exact named custom field. The structured 200 example shows a valid member with zero activity. Values use synthetic example.com identities and do not represent a live community.

Optional controls#

pagination.limit: 1–100; default 20.
pagination.cursor: opaque nextCursor from the previous response. Do not decode or manufacture it.
programId: restrict progress to one public ID returned by Get referral programs.
lang: optional response language code.

Reading the response#

user is the member whose summary was requested.
invite.url is the configured client-facing invite URL. platformUrl is the Returning.AI fallback; do not assume they have the same origin or query shape.
activity aggregates rewards and referral counts.
referees[] contains the current page of invited members.
progressByProgram[].stages[] carries completion state, configured rewards, and readable requirements.
pagination.hasNextPage tells you whether to request another page. Send nextCursor back as pagination.cursor only when it is present.

Success and readback#

Treat 200 as a snapshot for the identified member. A zero-activity snapshot proves that the member resolved; it does not prove that an immediately preceding referral write has finished processing. For a populated dashboard, page until hasNextPage is false and deduplicate referees by stable returned identity.

Eventual consistency and readback#

Referral association and milestone evaluation can complete asynchronously after user creation or a qualifying user update. Poll this read-only endpoint with bounded backoff until the expected referee or stage appears, or until your launch-test timeout is reached. Do not treat one immediate zero-activity response as proof that a preceding write failed.

Errors and recovery#

StatusMeaningRecovery
400 VALIDATION_FAILEDMissing or invalid identifier, custom-field without fieldName, or limit outside 1–100Correct the request; do not retry unchanged.
401Missing, invalid, or expired API keyReplace or fix the Bearer key.
403Key lacks getUserDataGrant permission or use the correct community key.
404 User not foundNo member matches that identifier in this key's communityVerify registration, tenant, identifier type, field name, and exact value.
500 / 502Unexpected or upstream service failureRetry with bounded backoff; escalate if persistent.
Missing-key responses use AUTH_API_KEY_REQUIRED; invalid or expired keys use AUTH_API_KEY_INVALID.

Retry safety#

The summary call is read-only and safe to retry. The user-creation or update call that precedes it may not be safe to retry blindly. Read the user back by the same stable identifier before resubmitting an ambiguous write.

Gotchas#

Identify the current referrer whose dashboard you are reading, not one of their referees.
Do not decode cursors or carry a cursor across members, programs, communities, or filters.
Do not reconstruct invite.url from platformUrl; use the configured client-facing URL when present.
A 404 is an identity or tenant mismatch, not evidence that no referral program exists.

Next steps#

Use the Referral program integration guide for capture-before-registration ordering, identity mapping, milestone wiring, negative controls, and launch acceptance. Use Get referral programs to discover current configuration.

Request

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200Success
application/json
Summary for a valid member, including zero-activity members.
Bodyapplication/json

🟠400Validation Error
🟠401Unauthorized
🟠403Forbidden
🟠404User Not Found
🔴500Internal Server Error
🔴502Bad Gateway
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.returning.ai/v1/referral/summary' \
--header 'Authorization: Bearer <COMMUNITY_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
  "identifier": {
    "type": "data-customer-id",
    "value": "broker-customer-10482"
  },
  "pagination": {
    "limit": 20
  }
}'
Response Response Example
200 - Success Example
{
  "meta": {
    "status": "success",
    "statusCode": 200
  },
  "message": "Get referral summary success.",
  "data": {
    "user": {
      "id": "64b7f3a2c8d4e6f102938481",
      "userId": "10482",
      "email": "member@example.com",
      "username": "member-10482"
    },
    "invite": {
      "code": "member-10482:10482",
      "origin": "https://community.example.com",
      "url": "https://community.example.com/join?ref=broker-customer-10482",
      "platformUrl": "https://community.returning.ai/register?ref=member-10482:10482"
    },
    "activity": {
      "coinsEarned": 0,
      "xpEarned": 0,
      "totalReferrals": 0,
      "inProgress": 0,
      "completed": 0
    },
    "referees": [],
    "totalCount": 0,
    "pagination": {
      "hasNextPage": false
    }
  }
}
Modified at 2026-08-17 15:23:46
Previous
Get referral programs
Next
Get Daily Calculation Data
Built with