Get User Data
Look up one trader in your community by email or platform user ID, and get back their profile, roles, coins, XP 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 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": "id", "value": "3247779"}
id for the platform user ID, or the key of a custom single-line text or numerical user field, usually your broker identifier such as customerid.Ruleid, 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.
Rulesuccess
RuleUSER_DATA_RETRIEVED
Eg"User data retrieved successfully"
Eg{ ... }
Eg"<userObjectId>"
RuleDecimal digits
Eg"3247779"
Eg"sample_trader"
Eg0
Eg0
Eg["@all"]
Eg"@all"
RuleOnly keys you requested
Eg{"customerid": "<brokerCustomerId>"}
{
"status": "success",
"code": "USER_DATA_RETRIEVED",
"message": "User data retrieved successfully",
"data": {
"_id": "<userObjectId>",
"userId": "3247779",
"username": "sample_trader",
"xp": 0,
"coins": 0,
"roles": ["@all"],
"highestRole": "@all",
"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 valid. Check the keys against your community's user fields.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 data02
USER_NOT_FOUNDFix the dataCUSTOM_FIELD_IDENTIFIER_DUPLICATEFix the dataRetry with backoff02
USER_DATA_RETRIEVAL_FAILEDRetry with backoffCUSTOM_FIELD_IDENTIFIER_NOT_READYRetry with backoff{
"status": "error",
"code": "CUSTOM_FIELD_IDENTIFIER_NOT_FOUND",
"message": "Custom field identifier does not exist"
}