Manage User Account
Remove one trader's account, or restore a removed account, by username or email.
- Method
- POST
- Path
https://api.returning.ai / v1/ users/ manage - Permission
- manageUser
- Retries
- Safe to repeat; a repeat returns 400
When to use this
- A trader closes their trading account and you want their loyalty account removed as well.
- You removed a trader by mistake and need to restore the account, with its balances and history.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- manageUserShown in the dashboard as “Delete/Restore User”
Removing and restoring need manageUser. The trader must be a member of the API key's community. Keep the key on your server.
Behaviour#
delete is a soft delete. It marks the trader's account as removed; their profile, balances and history are kept, so restore brings everything back. The mark is on the trader's account itself, not on their membership in your community, so it applies wherever that account is used.
While removed, Get User Data returns 404 USER_NOT_FOUND for the trader. They still appear in Get Users with Filters and in your community's member list, so do not use those lists to check whether a trader is removed.
Request#
Headers#
Body#
user is matched exactly against the trader's username or email. action is delete or restore.
curl --request POST \
--url https://api.returning.ai/v1/users/manage \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"user": "trader@example.com",
"action": "delete"
}'
Response#
A 200 means the change is saved. code is USER_SOFT_DELETED after delete and USER_RESTORED after restore. Branch on the HTTP status and code, never on message.
{
"status": "success",
"code": "USER_SOFT_DELETED",
"message": "User has been deleted successfully"
}
Errors#
Errors from the API key check, such as 401 and 403 API_KEY_PERMISSION_DENIED, carry the code in meta.code; other errors carry it in code. A malformed body returns 400 with a message and a detail naming the field, and no code. A 400 or 404 changes nothing.
Fix the request03
user is empty, or action is not delete or restore. remove is not accepted; send delete. detail names the field.AUTHENTICATION_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 data05
USER_NOT_FOUNDFix the dataUSER_NOT_IN_COMMUNITYFix the dataUSER_ALREADY_DELETEDFix the dataUSER_NOT_DELETEDFix the dataCOMMUNITY_NOT_FOUNDFix the dataRetry with backoff02
USER_MANAGEMENT_FAILEDRetry with backoffAUTHENTICATION_FAILEDRetry with backoff{
"status": "fail",
"code": "USER_ALREADY_DELETED",
"message": "User is already removed."
}