Get user's referral summary
Read one trader's referral invite link, their referral totals and each invited trader's progress through your programs.
- Method
- POST
- Path
https://api.returning.ai / v1/ referral/ summary - Permission
- getUserData
- Retries
- Read-only; exact retries are safe
When to use this
- Show a trader their invite link and how the people they invited are doing, in your own app.
- Support needs to check whether a trader's invited friend has completed a stage.
- Reconcile the referral rewards a trader has been paid.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- getUserDataShown in the dashboard as “Get User Data”
Send a Community API key with getUserData, shown in the dashboard as Get User Data. The key decides the community, so never send a community ID. The trader must be a member of that community. Keep the key on your server: the response includes emails and invite links.
Behaviour#
This read changes nothing. Identify the trader who sends invites; their invited traders come back in referees. The totals in activity and the progress in referees cover running programs only. When referrals are switched off for your community, a trader who exists still returns 200, with zero totals and no referees.
Referral progress is worked out after the invited trader acts, so a stage can take a short while to show as complete. The list of invited traders can also be up to 30 seconds old. If you are waiting for a change, read again with backoff rather than treating the first result as final.
With programId, each stage's status is only completed or not_started, and stage rewards come back as 0. Read reward amounts from Get referral programs.
Request#
Headers#
Body#
Send identifier with a type and value. id is the numeric platform user ID from Get User Data, not the internal record ID. For a broker customer ID stored in a custom user field, use custom-field with that field's key as fieldName, for example customerid.
Page through invited traders with pagination: send nextCursor back as pagination.cursor until hasNextPage is false. Keep the same identifier, programId and lang for every page.
Eg{"type": "email", "value": "trader@example.com"}
id (platform user ID), email, data-email (same as email), custom-field (a value in one of your custom user fields), or data-customer-id, which also reads a custom user field.Ruleid, email, data-email, data-customer-id or custom-field
Eg"email"
RuleNon-empty text
Eg"trader@example.com"
custom-field. With data-customer-id it defaults to customerId; send it when your field's key differs.RuleCustom field key
Eg"customerid"
Eg{"limit": 20}
RuleDefault 20; max 100
Eg20
nextCursor from the previous page. Omit it for the first page. A cursor that isn't recognised starts from the first page.RuleOpaque text
programId from Get referral programs.RuleProgram ID in your community
Eg"66f000000000000000000710"
fr. Omit it, or send en, for the text as entered.RuleLanguage code
Eg"en"
curl --request POST \
--url https://api.returning.ai/v1/referral/summary \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"identifier": {
"type": "email",
"value": "trader@example.com"
},
"pagination": {
"limit": 20
}
}'
Response#
A 200 returns the trader in data.user, their links in data.invite, totals in data.activity, and one page of invited traders in data.referees. Share invite.url, not platformUrl: when your community has a custom invite link, url is that link. Branch on the HTTP status.
Eg{"status": "success", "statusCode": 200}
Rulesuccess
Eg200
Eg"Get referral summary success."
Eg{ ... }
Eg{ ... }
Eg"<userObjectId>"
Eg"3247779"
Eg"sample_trader"
null when none is stored.Eg"trader@example.com"
Eg{ ... }
platformUrl.Eg"https://community.example.com/v2/app/invite/66f000000000000000000010:3247779"
/v2/app/invite/<code>. Starts with / when your community has no custom domain.Eg"https://community.example.com/v2/app/invite/66f000000000000000000010:3247779"
<communityId>:<platform user ID>.Eg"66f000000000000000000010:3247779"
https://community.example.com. Empty when there is none.Eg"https://community.example.com"
Eg{ ... }
Eg1
Eg1
Eg0
Eg250
Eg25
Eg[ ... ]
Eg"3247780"
Eg"Invited Trader"
null when not recorded.Eg"2026-09-20T08:30:00.000Z"
programId you sent.Eg[ ... ]
Eg"66f000000000000000000710"
Eg"Invite a trader"
Eg1
Eg2
completedStages as a percentage of totalStages, rounded.Eg50
Eg[ ... ]
Eg"66f000000000000000000711"
Eg1
Eg"Get active"
Eg"Your friend earns more than 500 XP."
Rulecondition, description or condition_and_description
Eg"condition"
in_progress means some requirements are met.Rulecompleted, in_progress or not_started
Eg"completed"
true when the invited trader has completed the stage.Egtrue
true when the stage was completed but the invited trader no longer meets its requirements. The reward isn't taken back.Egfalse
xp and coins.Eg{"xp": 250, "coins": 25}
met out of total, with operator and each condition group in mainConditions.Eg{ ... }
and when every group must be met, or when one is enough.or counts as one.and or or, for the conditions in the group.null when none is shown.true when the group is met.true when a condition in a completed stage is no longer met.Complete this condition.true when the condition is met. Every condition shows true once the stage is complete.true when the condition was met for a completed stage and no longer is.true when text is the condition's key because no text for traders is set.Eg1
Eg{"nextCursor": null, "hasNextPage": false}
true when another page follows.Egfalse
pagination.cursor to get the next page. null on the last page.RuleNullable
Egnull
{
"meta": {
"status": "success",
"statusCode": 200
},
"message": "Get referral summary success.",
"data": {
"user": {
"id": "<userObjectId>",
"userId": "3247779",
"email": "trader@example.com",
"username": "sample_trader"
},
"invite": {
"code": "66f000000000000000000010:3247779",
"origin": "https://community.example.com",
"url": "https://community.example.com/v2/app/invite/66f000000000000000000010:3247779" ,
"platformUrl": "https://community.example.com/v2/app/invite/66f000000000000000000010:3247779"
},
"activity": {
"coinsEarned": 25,
"xpEarned": 250,
"totalReferrals": 1,
"inProgress": 1,
"completed": 0
},
"referees": [
{
"userId": "3247780",
"username": "Invited Trader",
"avatar": "",
"joinedAt": "2026-09-20T08:30:00.000Z",
"progressByProgram": [
{
"programId": "66f000000000000000000710",
"programName": "Invite a trader",
"completedStages": 1,
"totalStages": 2,
"percentage": 50,
"stages": [
{
"stageId": "66f000000000000000000711",
"stageNumber": 1,
"name": "Get active",
"description": "Your friend earns more than 500 XP.",
"displaySetting": "condition",
"status": "completed",
"isCompleted": true,
"rewards": {
"xp": 250,
"coins": 25
},
"requirements": {
"operator": "and",
"met": 1,
"total": 1,
"mainConditions": [
{
"groupId": "66f000000000000000000712",
"operator": "and",
"text": null,
"isMet": true,
"revoked": false,
"nestedConditions": [
{
"conditionId": "66f000000000000000000713",
"text": "Earn more than 500 XP",
"isMet": true,
"revoked": false,
"isRaw": false
}
]
}
]
},
"revoked": false
},
{
"stageId": "66f000000000000000000714",
"stageNumber": 2,
"name": "Fund an account",
"description": "",
"displaySetting": "condition",
"status": "not_started",
"isCompleted": false,
"rewards": {
"xp": 0,
"coins": 100
},
"requirements": {
"operator": "and",
"met": 0,
"total": 1,
"mainConditions": [
{
"groupId": "66f000000000000000000715",
"operator": "and",
"text": null,
"isMet": false,
"revoked": false,
"nestedConditions": [
{
"conditionId": "66f000000000000000000716",
"text": "Make a first deposit",
"isMet": false,
"revoked": false,
"isRaw": false
}
]
}
]
},
"revoked": false
}
]
}
]
}
],
"totalCount": 1,
"pagination": {
"nextCursor": null,
"hasNextPage": false
}
}
}
Errors#
Validation 400 errors and the key errors (401, 403) carry a code in meta.code. Other errors have no code: read detail, which says what went wrong, and branch on the HTTP status. message on a validation error can vary; don't branch on it.
Fix the request05
detail says why: Custom field identifier does not exist. (no custom user field has that key; data-customer-id without fieldName looks for customerId), or Custom field identifier value is invalid. (the value doesn't fit the field's type).VALIDATION_FAILEDFix the requestidentifier, an unknown identifier.type, an empty value, custom-field without fieldName, or pagination.limit outside 1-100. detail names each field, such as identifier.fieldName.AUTH_API_KEY_REQUIREDFix the requestAuthorization: Bearer <API_KEY>.AUTH_API_KEY_INVALIDFix the requestAUTH_PERMISSION_REQUIREDFix the requestgetUserData. Add Get User Data in Settings > Integration > API Keys.Fix the data02
detail says which: User not found (nothing matches the identifier; for id, send the platform user ID, not the internal record ID), User is not exists in this community (the trader isn't a member of your community; a trader created through Create User can also get this while Get User Data finds them, in which case contact Returning.AI support), or Referral program not found (check programId with Get referral programs).Duplicate users found for this custom field identifier.). Use id or email instead, and fix the duplicate values.Retry with backoff04
id or email.STORE_DEPENDENCY_UNAVAILABLERetry with backoffINTERNAL_ERRORRetry with backoff500 with message Get referral summary error. and no code means the same. Retry with exponential backoff.AUTH_API_KEY_VALIDATION_FAILEDRetry with backoff{
"meta": {
"status": "error",
"statusCode": 400,
"code": "VALIDATION_FAILED"
},
"message": "Validation failed",
"detail": {
"identifier": "identifier should not be null or undefined"
},
"solution": "Please check the request and try again"
}