Update User Data
Change one trader's profile, community roles or broker identifier, sending only the fields that change.
- Method
- POST
- Path
https://api.returning.ai / v1/ users/ update - Permission
- manageUser
- Retries
- No Idempotency-Key; read back before repeating
When to use this
- A trader changes their name, email or phone on your platform.
- You add, remove or replace a trader's community roles, such as
VIP. - You need to replace a trader's broker identifier. This is the only supported endpoint for that.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- manageUserRole changes also need bulkUpdateUser
Profile and identifier changes need manageUser. A request that includes updates.roles needs both manageUser and bulkUpdateUser. Keep the Community API key on your server.
Request#
Headers#
Body#
identifier finds the trader and updates holds the changes. Send only the properties that change. To replace the broker identifier, send custom_user_identifier as the only property in updates, in a request of its own.
Eg{"type": "platform_user_id", "value": "3247779"}
value identifies the trader.Ruleplatform_user_id, username, email, custom_user_identifier
Eg"platform_user_id"
Eg"3247779"
RuleAt least one property
Eg{ ... }
Eg"Sample"
RuleEmail format
Eg{"operator": "add", "names": ["VIP"]}
add and subtract are safe to repeat. overwrite replaces the trader's changeable roles in this community.Ruleadd, subtract, overwrite
Eg"add"
all and @all cannot be changed.RuleMin 1 item; unique
Eg["VIP"]
platform_user_id or username.RuleMust be the only property in updates
Eg"<newBrokerCustomerId>"
curl --request POST \
--url https://api.returning.ai/v1/users/update \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"identifier": {
"type": "platform_user_id",
"value": "3247779"
},
"updates": {
"firstname": "Sample",
"roles": {
"operator": "add",
"names": ["VIP"]
}
}
}'
Response#
A 200 returns the trader after the update in data. roles is present only when the request changes roles. Read the trader back with Get User Data to confirm.
Rulesuccess
RuleUSER_UPDATED
Eg"User updated successfully"
Eg{ ... }
RuleDecimal digits
Eg"3247779"
Eg"Sample"
Eg"Trader"
RuleEmail format
Eg"trader@example.com"
Eg"15551234567"
RuleNullable
Eg"<brokerCustomerId>"
Eg["@all", "VIP"]
{
"status": "success",
"code": "USER_UPDATED",
"message": "User updated successfully",
"data": {
"id": "3247779",
"firstname": "Sample",
"lastname": "Trader",
"email": "trader@example.com",
"phone": "15551234567",
"custom_user_identifier": "<brokerCustomerId>",
"roles": ["@all", "VIP"]
}
}
Errors#
Errors from the API key check carry the code in meta.code, except the 401 for a role change without bulkUpdateUser, which has only a message. Other coded errors carry it in code. A 400 writes nothing, so correct the request and send it again. A malformed request, such as a bad identifier type or role operator, returns 400 with a message and a detail list explaining what's wrong, and no top-level code.
Fix the request08
The body failed validation. There is no code; detail names the field. Common causes:
identifier.typeis not one of the four types, orroles.operatoris notadd,subtractoroverwrite.updatesis empty, orcustom_user_identifieris empty.roles.namesis empty or includesallor@all(Default roles cannot be updated).- You looked the trader up by
emailand sent a newemail, or bycustom_user_identifierand sent a newcustom_user_identifier. Look the trader up by platform user ID or username instead.
roles and the key has manageUser but not bulkUpdateUser. The body is only {"message": "Your api key does not have permission to access this action"}, with no code. Add bulkUpdateUser to the key.INVALID_USER_UPDATEFix the requestThe message names the rule:
Custom user identifier is not configured for this community: set up an active identifier field before sendingcustom_user_identifier.Custom user identifier field is not configured correctly: ask Returning.AI to check the identifier field's setup.<Field> - Identifier is required: send a non-empty identifier value.
MIXED_IDENTIFIER_UPDATE_NOT_SUPPORTEDFix the requestROLE_NOT_FOUNDFix the requestROLE_NAME_AMBIGUOUSFix the requestAUTHENTICATION_REQUIREDFix the requestAuthorization: Bearer <API_KEY> with a current key.API_KEY_PERMISSION_DENIEDFix the requestmanageUser. Add the permission in Settings > Integration > API Keys.Fix the data03
USER_NOT_FOUNDFix the dataUSER_EMAIL_CONFLICTFix the dataEmail already exists). Reconcile the two accounts first.USER_IDENTIFIER_CONFLICTFix the data<Field name> - Identifier is already used by another user, or <Field name> - Duplicate users found). Reconcile the two accounts first.Retry with backoff02
USER_UPDATE_FAILEDRetry with backoffUSER_IDENTIFIER_NOT_READYRetry with backoffDo not retry01
USER_UPDATE_RECONCILIATION_REQUIREDDo not retry{
"status": "fail",
"code": "MIXED_IDENTIFIER_UPDATE_NOT_SUPPORTED",
"message": "Custom user identifier must be updated in a separate request"
}