Get loyalty overview
Page through one loyalty summary row per trader in your community, with balances, roles, visits and join date.
- Method
- GET
- Path
https://api.returning.ai / v1/ community-analytics/ loyalty-overview - Permission
- customerSuccess
- Retries
- Read-only; exact retries are safe
When to use this
- Load every trader's XP and coin balances into your data warehouse on a daily schedule.
- Pull the traders who joined your community in a date range, with their loyalty totals.
- Give your CRM a trader's roles, visit count and lifetime coins spent in the store.
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 you only ever see your own traders. A key without the permission gets 401, not 403. Personal API keys are rejected with 401.
Behaviour#
Each row is a trader who has an XP record in your community, so traders who have never earned XP may be missing. Rows are sorted by platform user ID. Read every page up to totalPages: a page can come back with fewer rows than limit before the last page, so a short page doesn't mean you have reached the end.
from and to filter on the join date in first_loyalty_login, and both are inclusive. When either is set, traders with no recorded join date are left out, so the filtered total can be lower than the unfiltered one even for a range that covers all time.
Balances are the values at the moment you read them. XP and coin balances are cut, not rounded, to two decimal places.
Request#
Query parameters#
RuleWhole number, 1 or more; default 1
Eg1
RuleDefault 100; max 500
Eg100
from or to is set.RuleISO 8601 date-time in UTC, ending in Z
Eg2026-09-01T00:00:00Z
RuleISO 8601 date-time in UTC, ending in Z
Eg2026-09-30T23:59:59Z
Headers#
customerSuccess.RuleBearer <API_KEY>
curl --request GET \
--url 'https://api.returning.ai/v1/community-analytics/loyalty-overview?page=1&limit=100&from=2026-09-01T00:00:00Z' \
--header 'Authorization: Bearer <API_KEY>'
Response#
A 200 returns the page in data.data and the totals in data.pagination. A page past the last one returns an empty data.data with the same total. The response holds trader emails, so store it as personal data.
Rulesuccess
Eg"Loyalty overview fetched successfully"
Eg{ ... }
Eg[ ... ]
Eg"3247779"
null when the account has none. Treat it as personal data.RuleEmail format; nullable
Eg"trader@example.com"
Eg1250
Eg480.5
Eg25
Eg["Member"]
RuleMin 0
Eg14
null when no join date is recorded. This is the date from and to filter on.RuleDate-time; nullable
Eg"2026-09-01T08:30:00.000Z"
null when none is recorded.RuleDate-time; nullable
Eg"2026-09-26T09:15:00.000Z"
Eg{"total": 1, "page": 1, "limit": 100, "totalPages": 1}
RuleMin 0
Eg1
RuleMin 1
Eg1
Rule1-500
Eg100
limit. 0 when nothing matches.RuleMin 0
Eg1
{
"status": "success",
"message": "Loyalty overview fetched successfully",
"data": {
"data": [
{
"client_id": "3247779",
"email": "trader@example.com",
"current_xp_balance": 1250,
"current_coin_balance": 480.5,
"lifetime_coins_redeemed": 25,
"roles": ["Member"],
"login_count": 14,
"first_loyalty_login": "2026-09-01T08:30:00.000Z",
"last_loyalty_login": "2026-09-26T09:15:00.000Z"
}
],
"pagination": {
"total": 1,
"page": 1,
"limit": 100,
"totalPages": 1
}
}
}
Errors#
Errors on this endpoint have no machine-readable code; branch on the HTTP status. A validation 400 names the parameter in detail. A 401 carries only message, or status and message.
Fix the request02
page below 1, limit outside 1-500, or from or to not an ISO 8601 date-time ending in Z (an offset such as +08:00 is rejected). detail names the parameter.Invalid token), unknown (Invalid API key) or expired, it's a personal key, or it lacks customerSuccess (Your api key does not have permission to access this action). Send Authorization: Bearer <API_KEY> with a Community API key, and add Customer Success in Settings > Integration > API Keys.Retry with backoff02
RateLimit header, then retry.Authentication failed). Retry the same request with exponential backoff.{
"meta": {
"status": "error",
"statusCode": 400
},
"message": "Get loyalty overview endpoint validation error.",
"detail": {
"limit": "Number must be less than or equal to 500"
},
"solution": "Check your query in request and try again"
}