Get User Data
Look up one trader in your community by email, platform user ID or broker identifier, and get back their profile, roles, balances, tier, activity counts and the custom fields you ask for.
- Method
- POST
- Path
https://api.returning.ai / v1/ users/ info - Permission
- getUserData
- Retries
- Read-only; exact retries are safe
When to use this
- Confirm a trader exists after Create User or a registration webhook, and save their
userId. - Read a trader's current coins, XP, tier and roles before support changes anything.
- Fetch a broker identifier such as
customeridbefore you write user-field values.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- getUserDataShown in the dashboard as “Get User Data”
Use a Community API key from Settings > Integration > API Keys and keep it on your server. The key limits every lookup to its own community, so a trader in another community returns 404 USER_NOT_FOUND.
Request#
Headers#
Body#
Send exactly one of idOrEmail or identifier. Sending neither or both returns 400.
RuleEmail, or decimal digits. Send exactly one of idOrEmail or identifier.
Eg"trader@example.com"
data.customFields. Ask only for the fields you need.RuleKeys configured in your community
Eg["customerid"]
idOrEmail.RuleSend exactly one of idOrEmail or identifier
Eg{"key": "customerid", "value": "<brokerCustomerId>"}
id for the platform user ID, email, or the key of a custom single-line text or numerical user field, usually your broker identifier such as customerid.Ruleid, email, or a custom text or number field key
Eg"customerid"
Eg"<brokerCustomerId>"
curl --request POST \
--url https://api.returning.ai/v1/users/info \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"idOrEmail": "trader@example.com",
"customFields": ["customerid"]
}'
Response#
A 200 returns the trader in the data object. Branch on the HTTP status and code, never on message. Save data.userId for the next call. To fit, the example leaves out language, tags and the today and lifetime activity counts; every 200 carries them, as the field list shows.
Rulesuccess
RuleUSER_DATA_RETRIEVED
Eg"User data retrieved successfully"
Eg{ ... }
Eg"<userObjectId>"
RuleDecimal digits
Eg"3247779"
Eg"sample_trader"
Rule******** when the trader has not consented to sharing it
Eg"Sample"
Rule******** when the trader has not consented to sharing it
Eg"Trader"
RuleEnglish when none is set
Eg"English"
Eg1250
Eg340
RuleCan be negative
Eg25
RuleCan be negative
Eg10
Eg["@all"]
@all, or @all when that is the only role.Eg"@all"
Rule[] when none
Eg["VIP"]
RuleAbsent when no tiers are configured
Eg"Gold"
current_tier, for level-based progression.Rulenull for value-range progression or when no tiers are configured
Eg3
RuleAbsent at the top level and for value-range progression; 0 when no tiers are configured
Eg150
Eg42
Eg17
Eg8
Eg63
RuleMinutes, up to 2 decimals
Eg312.5
Rule0 when the trader has never visited
Eg12
"null", not JSON null.RuleOnly keys you requested; {} when you ask for none
Eg{"customerid": "<brokerCustomerId>"}
{
"status": "success",
"code": "USER_DATA_RETRIEVED",
"message": "User data retrieved successfully",
"data": {
"_id": "<userObjectId>",
"userId": "3247779",
"username": "sample_trader",
"xp": 1250,
"coins": 340,
"roles": ["@all"],
"highestRole": "@all",
"firstName": "Sample",
"lastName": "Trader",
"current_tier": "Gold",
"current_level": 3,
"to_next_level": 150,
"customFields": {
"customerid": "<brokerCustomerId>"
}
}
}
Errors#
401 and 403 responses carry the code in meta.code. The 400 for sending neither or both lookups has no code; every other error carries it in code.
Fix the request07
idOrEmail and identifier. There is no code; detail.identifier says which. Send exactly one.CUSTOM_FIELD_IDENTIFIER_NOT_FOUNDFix the requestcountry aren't accepted. Correct the key, or look up by email or platform user ID.CUSTOM_FIELD_IDENTIFIER_UNSUPPORTED_TYPEFix the requestCUSTOM_FIELD_IDENTIFIER_INVALID_VALUEFix the requestINVALID_CUSTOM_FIELDSFix the requestcustomFields is not a custom field in your community. detail lists the keys. Remove or correct them.AUTHENTICATION_REQUIREDFix the requestAuthorization: Bearer <API_KEY> with a current key.API_KEY_PERMISSION_DENIEDFix the requestgetUserData. Add the permission in Settings > Integration > API Keys.Fix the data03
USER_NOT_FOUNDFix the dataCUSTOM_FIELD_IDENTIFIER_DUPLICATEFix the dataCUSTOM_FIELD_IDENTIFIER_SCAN_LIMIT_EXCEEDEDFix the dataRetry with backoff02
USER_DATA_RETRIEVAL_FAILEDRetry with backoffCUSTOM_FIELD_IDENTIFIER_NOT_READYRetry with backoffRetries
This endpoint is read-only, so retrying the exact same request is safe after a network error or a 5xx. Use bounded exponential backoff and keep the identifier unchanged between retries. Over the rate limit, requests return 429; wait for the window to reset, then retry.
{
"status": "error",
"code": "CUSTOM_FIELD_IDENTIFIER_NOT_FOUND",
"message": "Custom field identifier does not exist."
}