Returning.AIDocs
v1

API reference / Community Logs

.md

Retrieve and export community logs

Read your community's gamification, milestone, streak, mini-game, raffle, referral, API, email or audit logs for a date range, as JSON pages or as a CSV file to download.

Last updated 21 Nov 2026API v1

Method
GET
Path
https://api.returning.ai/v1/community-logs
Permission
readCommunityLogs
Retries
Retry failed reads with backoff

When to use this

  • Pull the XP and coin activity for a period into your own reporting or data warehouse.
  • Check which API calls your integration made, which failed and why, without opening the dashboard.
  • Export milestone completions or Spin the Wheel and quiz history as CSV for a campaign review.

Authentication#

Header
Authorization: Bearer <API_KEY>
Permission
readCommunityLogsShown in the dashboard as “Get Community Logs”

Use a Community API key with the readCommunityLogs permission, and keep it on your server. The key decides the community, so never send a communityId; an unknown query key returns 400. Personal API keys are refused with 403.

Behaviour#

Records come newest first. Filters combine: a record must match every filter you send, and any one of the values within a filter. Filters that accept multiple text values take up to 100 values of up to 500 characters each. Send one value as filters[userId]=3247779, or several by repeating filters[userId][]=.

action and location filters match the values stored when the entry was recorded. For most entries these are the labels in the response, but some gamification entries show a different label, so a filter can return more or fewer records than the labels suggest.

Each log type takes the five shared filters (action, location, userId, email, customFieldIdentifier). For miniGames, you can also send gameType and miniGameId. For milestone, use milestones to filter by milestone name. An unsupported filter for a log type returns 400.

Add one of these examples to GET /v1/community-logs along with startDate and endDate.

Log typeExample query parametersWhat they select
StreakslogType=streaks&filters[location]=WelcomeStreak entries from the Welcome channel.
RaffleslogType=raffles&filters[miniGameId]=66f000000000000000000201Entries for one raffle. Raffles use miniGameId; sending gameType returns 400.
ReferrallogType=referral&filters[action]=Referred%20UserEntries for the Referred User action.
EmaillogType=email&filters[batchId]=66f000000000000000000501Recipients from one email batch.
AuditlogType=audit&filters[ip]=192.0.2.1Entries from one IP address. You can also filter by category or actor.

Request#

Query parameters#

logType#stringREQUIRED
The log to read. misconduct is accepted but returns 501 until it is available.

Rulegamification, milestone, streaks, miniGames, raffles, referral, api, email or audit

Eg"gamification"

startDate#stringREQUIRED
Start of the range, inclusive. API logs are matched on when the request arrived, quiz attempts on when they were completed, and everything else on when the entry was created.

RuleUTC timestamp ending in Z

Eg"2026-09-01T00:00:00Z"

endDate#stringREQUIRED
End of the range, inclusive. There is no maximum span.

RuleUTC timestamp ending in Z; not before startDate

Eg"2026-09-30T23:59:59Z"

format#stringOPTIONAL
json returns one page of records. csv returns a link to a CSV file with every match, and ignores page and limit.

Rulejson (default) or csv

Eg"json"

page#integerOPTIONAL
JSON only. The page to return, starting at 1. A page past the end returns an empty records list.

RuleWhole number from 1; default 1

Eg1

limit#integerOPTIONAL
JSON only. Records per page.

RuleDefault 100; max 500

Eg100

filters[action]#stringOPTIONAL
Only these actions. API logs: the record's name, such as Create New User. Gamification: the action as recorded, usually the record's action. Milestones: Stage Completed or stage_completed and the other milestone actions. Spin the Wheel: Spin Earned, Spin Claimed and the other wheel actions. Quiz: Completed, Passed or Failed. Streaks: the record's action or streakAction. Raffles: the record's action, such as Tickets Purchased or Prize Claimed. Referral: Referred User, Referral Stage Cleared or Referral Cleared, optionally followed by - and the stage or program name. Email: Sent, Failed or Queued. Audit: the record's action.

RuleString, or repeat filters[action][]= for several

Eg"Create New User"

filters[location]#stringOPTIONAL
Only these locations. API logs: the request path with an /apis prefix, such as /apis/v1/users for Create User. Gamification: the location as recorded, usually the record's action_location. Spin the Wheel: the game or channel name. Quiz: the game name. Raffles: the raffle name. Streaks: the channel name. Referral: the referral program name. Email: the sender's email. Audit: the IP address. Milestone logs have no location, so any value returns no records.

RuleString or array

Eg"/apis/v1/users"

filters[userId]#stringOPTIONAL
Only these traders, by platform user ID. Referral logs match the referrer; audit logs match the user who acted.

RuleDigits; string or array

Eg"3247779"

filters[email]#stringOPTIONAL
Exact email match, not case-sensitive. Referral logs match the referrer, email logs match the recipient, and API logs also match an email sent in the request body.

RuleString or array

Eg"trader@example.com"

filters[customFieldIdentifier]#stringOPTIONAL
Only traders with these values in your community's active identifier field, usually the broker customer ID. Text values match exactly, not case-sensitive.

RuleString or array

Eg"<brokerCustomerId>"

filters[gameType]#stringOPTIONAL
miniGames only. Sending it with another log type returns 400.

Rulespin_the_wheel (default) or quiz

Eg"quiz"

filters[miniGameId]#stringOPTIONAL
miniGames and raffles only. One game's or raffle's ID.

Rule24 hex characters

Eg"66f000000000000000000201"

filters[milestones]#stringOPTIONAL
milestone only. Only these milestones, by exact name.

RuleString or array

Eg"Welcome journey"

filters[batchId]#stringOPTIONAL
email only. Only recipients of one email batch, by the record's batchId.

Rule24 hex characters

Eg"66f000000000000000000501"

filters[category]#stringOPTIONAL
audit only. Only these categories, by exact value, not case-sensitive.

RuleString or array

filters[actor]#stringOPTIONAL
audit only. Only these actors, by the record's actor, not case-sensitive.

RuleString or array

filters[ip]#stringOPTIONAL
audit only. Only these IP addresses, by exact value.

RuleString or array

Headers#

Authorization#stringREQUIRED
Community API key with readCommunityLogs. The key decides the community.

RuleBearer <API_KEY>

curl --request GET \
  --url 'https://api.returning.ai/v1/community-logs?logType=gamification&startDate=2026-09-01T00:00:00Z&endDate=2026-09-30T23:59:59Z&page=1&limit=100' \
  --header 'Authorization: Bearer <API_KEY>'

Response#

With format=json, a 200 returns one page in data.records. To read everything, start at page=1 and ask for the next page while data.hasNextPage is true. Dates in date and time are UTC (DD/MM/YYYY and HH:MM); the dashboard shows the same entries in your local time zone. Records by logType:

  • gamification: id, userId (a number), createdAt, user (display name), email, action, action_details, action_location, roles (role names), xp, currency, date and time. identifier appears when your community has an active identifier field (null when the trader has no value), premiumCurrency when premium currency awards are on, and coinExpiry (TRUE or empty) when coin expiry is on.
  • milestone: _id, milestoneId, milestoneName, userId (a string), user, email (- when unknown), identifierValue, action (such as Stage Completed), actionDetails, createdAt, updatedAt, date and time, plus the rewards given: xps, currencies, multiplier, multiplierAwarded, roles and tags (names under add, remove and overwrite), badges and customRewards.
  • api: id, name (the operation, or the name you gave a bulk job), receivedAt, apiKeyName, duration (such as 0.70 seconds, or empty), status (Queued, In progress, Complete, Complete with errors, Error or Cancelled), progress (0 to 100 for bulk jobs, otherwise null), statusCode (null when none was recorded) and error.
  • miniGames with spin_the_wheel: id, userId (a string), createdAt, user, identifier, email, gameName, roles, date, time, action (such as Spin Earned or Spin Claimed), actionDetails and spinCount.
  • miniGames with quiz: the same first ten fields, with createdAt set to when the attempt was completed, plus attemptNumber, score (such as 3/5) and result (Passed, Failed, or Completed for quizzes without a pass mark).
  • raffles: id, userId (a string), createdAt, occurredAt (the same time as createdAt), user, identifierValue, email, action (such as Tickets Purchased, Mission Completed or Prize Claimed), actionDetails, awardSummary, raffleName, ticketCount, ticketCodes, roles, date and time.
  • streaks: id, userId (a string), streakId, createdAt, user, email, identifierValue, action, streakAction, actionDetails, streakName, streakActivity (such as Streak Broken), totalStreakActivity, roles, date and time.
  • referral: id, refId (such as #12), referrerUserId, referrerEmail, referrerIdentifierValue, refereeUserId, refereeEmail, refereeIdentifierValue, action (such as Referral Stage Cleared - <stage name>), actionCode, actionDetail, xp, coins, createdAt, date and time.
  • email: one record per recipient: id, batchId, userId (null when no trader matches the recipient), email, senderEmail, roles, tags, status (Sent, Failed or Queued), statusCode, details, createdAt, date and time.
  • audit: id, userId (the user who acted, or null), createdAt, user, email, actor, roles, category, action, ipAddress, date and time.

With format=csv, a 200 returns a link instead of records. page and limit are ignored, and the file holds every match:

JSON
{
  "meta": { "status": "success", "statusCode": 200 },
  "message": "Get community logs success.",
  "data": {
    "downloadUrl": "https://media-cdn.returning.ai/community-logs/66f000000000000000000010/<fileId>_gamification-logs.csv",
    "fileName": "gamification-logs.csv",
    "fileSizeBytes": 6429,
    "totalRecords": 55
  }
}

The file is UTF-8 with a byte-order mark, so spreadsheet apps open it correctly. Text cells that start with =, +, - or @ get a leading ', so @all reads '@all. With no matches, the file holds the header row only. Treat downloadUrl as confidential and keep it on your server.

CSV columns follow the dashboard's own log exports. Identifier columns depend on your community's identifier setup and use the name of its active identifier field. XP and coin columns use your community's unit names.

  • gamification: Ref ID (#1 is the oldest row), User, your identifier, Email, Action, Action Details, Action Location, Role, XP Activity, Coins Activity, then Premium Activity and Coin Expiry when those are on, Date, Time.
  • milestone: User, your identifier, Email, Milestone Name, Action, Action Details, Rewards, Date, Time. Rewards lists roles, tags and custom rewards by ID.
  • api: Request ID, Request received, Received at (UTC), API key name, Duration, Status, Progress (as a percentage), Status code, Error.
  • miniGames: Ref ID, User, your identifier, Email, then Action, Action Details and Spin Count for the wheel or Attempt, Score and Result for quizzes, Game Name, Roles, Date, Time.
  • raffles: User, your identifier, Email, Action, Action Details, Award Summary, Raffle Name, Ticket Count, Ticket Code, Roles, Date, Time.
  • streaks: User, your identifier, Streak Action, Action Details, Streak Name, Streak Activity, Total Streak, Role, Date, Time.
  • referral: Ref ID, Email (Referrer), the referrer's identifier, Referred User (Referee), the referee's identifier, Action, Action Details, then your XP and coin unit names, Date, Time.
  • email: No., Email, Roles, Tags, Status, Details.
  • audit: Date, Time, Email, User, Actor, Role, Category, Action, IP Address.

For gamification, milestone, api and miniGames, a CSV that exceeds the inline limits (10,000 rows, 10 MiB or the processing time limit) can be queued. A 202 with meta.code EXPORT_ACCEPTED and data.exportId confirms it was queued. Download the finished file from Settings > Logs > Export Histories. Only one large export per log type runs at a time.

For streaks, raffles, referral, email and audit, CSV is available within the inline limits. A request that exceeds those limits returns 503 EXPORT_QUEUE_UNAVAILABLE. Export a shorter date range or add filters and retry.

meta#objectALWAYS
Result details.

Eg{"status": "success", "statusCode": 200}

status#stringALWAYS
success.

Eg"success"

statusCode#integerALWAYS
200.

Eg200

message#stringALWAYS
Human-readable summary. Do not branch on it.

Eg"Get community logs success."

data#objectALWAYS
A page of records for json, or the download link for csv.

Eg{ ... }

communityId#stringJSON ONLY
Your community's ID, taken from the API key.

Eg"66f000000000000000000010"

logType#stringJSON ONLY
The logType you sent.

Rulegamification, milestone, api, miniGames, raffles

Eg"gamification"

startDate#stringJSON ONLY
The startDate you sent.

Eg"2026-09-01T00:00:00Z"

endDate#stringJSON ONLY
The endDate you sent.

Eg"2026-09-30T23:59:59Z"

filters#objectJSON ONLY
The filters you sent, or {}. For miniGames it includes gameType, even when you left it out.

Eg{}

totalRecords#integerALWAYS
Records that match, across all pages. For csv, the rows in the file.

Eg55

currentPage#integerJSON ONLY
The page returned.

Eg1

pageSize#integerJSON ONLY
The limit used.

Eg100

totalPages#integerJSON ONLY
Pages at this limit. 0 when nothing matches.

Eg1

hasNextPage#booleanJSON ONLY
true when there are more records after this page. Ask for page + 1.

Egfalse

hasPreviousPage#booleanJSON ONLY
true on any page after the first, when something matches.

Egfalse

records#object[]JSON ONLY
This page of records, newest first. The fields depend on logType; see Response below.

Eg[ ... ]

downloadUrl#stringCSV ONLY
HTTPS link to the CSV file. Download it with a plain GET; it needs no API key.
fileName#stringCSV ONLY
The file name, such as gamification-logs.csv.
fileSizeBytes#integerCSV ONLY
The file size in bytes.
{
  "meta": {
    "status": "success",
    "statusCode": 200
  },
  "message": "Get community logs success.",
  "data": {
    "communityId": "66f000000000000000000010",
    "logType": "gamification",
    "startDate": "2026-09-01T00:00:00Z",
    "endDate": "2026-09-30T23:59:59Z",
    "filters": {},
    "totalRecords": 55,
    "currentPage": 1,
    "pageSize": 100,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPreviousPage": false,
    "records": [
      {
        "id": "66f000000000000000000301",
        "userId": 3247779,
        "createdAt": "2026-09-20T12:30:00.000Z",
        "user": "Sample Trader",
        "identifier": "<brokerCustomerId>",
        "email": "trader@example.com",
        "action": "Adjusted by admin",
        "action_details": "Added 10 XP",
        "action_location": "User List",
        "roles": ["Gold Tier", "@all"],
        "xp": 10,
        "currency": 0,
        "date": "20/09/2026",
        "time": "12:30"
      }
    ]
  }
}

Errors#

A request that fails validation returns 400 with code VALIDATION_FAILED at the top level and a detail object naming each field, and no meta. Every other error carries its code in meta.code, with a readable detail.

Fix the request06

400VALIDATION_FAILEDFix the request
A query value is missing or breaks its rule, such as a date without Z, endDate before startDate, limit over 500, an unknown query key or a filter this log type doesn't take. detail names each field.
400VALIDATION_ERRORFix the request
page × limit is too large, or customFieldIdentifier isn't a number when your identifier field is numeric. Lower page, or send numeric identifiers.
400FILTER_TOO_BROADFix the request
email or customFieldIdentifier matches more than 1,000 traders, or on milestone logs userId and email together select more than 100. Send fewer or more specific values.
401AUTHENTICATION_REQUIREDFix the request
The key is missing, invalid or expired. Send Authorization: Bearer <API_KEY> with a current Community API key.
403API_KEY_PERMISSION_DENIEDFix the request
The key lacks readCommunityLogs, or it is a personal API key. Use a Community API key and add Get Community Logs in Settings > Integration > API Keys.
403COMMUNITY_ACCESS_DENIEDFix the request
A large CSV export was refused because the key lost readCommunityLogs or expired. Check the key, then request the export again.

Fix the data02

400CUSTOM_IDENTIFIER_UNAVAILABLEFix the data
Your community has no active custom identifier field. Filter by userId or email instead, or set up the identifier field.
404COMMUNITY_NOT_FOUNDFix the data
The community this key belongs to no longer exists. Contact Returning.AI support.

Retry with backoff07

429EXPORT_IN_PROGRESSRetry with backoff
Another large export of this log type is still running. Wait for it in Settings > Logs > Export Histories, then request again.
503QUERY_TIMEOUTRetry with backoff
The read took too long. Narrow the date range or add filters, then retry.
503EXPORT_UPLOAD_FAILEDRetry with backoff
The CSV file could not be stored. Retry the same request after a few seconds.
503EXPORT_STORAGE_UNAVAILABLERetry with backoff
CSV downloads are unavailable. Use format=json, or retry later and contact Returning.AI support if it persists.
503EXPORT_QUEUE_UNAVAILABLERetry with backoff
For streaks, raffles, referral, email and audit, narrow the date range or add filters so the CSV fits within the inline limits. For other supported types, check Settings > Logs > Export Histories before retrying.
500INTERNAL_ERRORRetry with backoff
The logs could not be read. Retry the same request with exponential backoff.
500AUTHENTICATION_FAILEDRetry with backoff
The key could not be checked. Retry the same request with exponential backoff.

Do not retry01

501NOT_IMPLEMENTEDDo not retry
misconduct is not available yet. Use another log type.

Retries

After a network error or 500, retry with bounded exponential backoff. For 503, follow the action for the returned code. A CSV request can create a file or queue an export. Repeating a request for an export that is still pending returns the same exportId. New entries arrive at the top, so pages can shift while you page through a busy log. Match records by ID to skip ones you've already read. Over the rate limit, requests return 429. Wait for the window to reset, then retry.

{
  "status": "fail",
  "code": "VALIDATION_FAILED",
  "message": "Invalid community log request.",
  "detail": {
    "endDate": "endDate must be on or after startDate"
  }
}

Next step#

Get User DataPOST/v1/users/infoLook up the trader behind a record's userId or email.