Use this endpoint to move an account to a different user within your company. This is useful when accounts have been grouped under the wrong user and need to be corrected programmatically — for example, when aggregated earnings are showing incorrect totals because two accounts belonging to the same worker are under different users.
Private API key requiredThis endpoint requires a private API key (
private_...). It is not accessible with a public key.
Here's an example request and response:
PATCH /v1/accounts/{account_id}/user
// No-param mode — creates a new user and moves the account there
Request body: {}
Response:
{
"success": true,
"error": null,
"data": {
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"new_user_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"old_user_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"old_user_deleted": true
}
}Let's dive into the request parameters and response fields.
Request parameters
All parameters are optional. Sending an empty body creates a new user and moves the account there.
| Parameter | Type | Description |
|---|---|---|
| smart | boolean | null | If true, find other accounts in your company with the same phone identifier and move this account to the user of the one with the most recent successful connection. Cannot be combined with user_id or external_id. |
| user_id | string | null | UUID of an existing user in your company to move the account to. Returns 404 if not found. |
| external_id | string | null | Your internal identifier for the target user. If a user with this external_id exists, the account is moved there. If not, a new user is created with this external_id. |
smartis mutually exclusiveSending
smart: truealongsideuser_idorexternal_idreturns a 400 error.
Response
| Data | Description | Type | Example |
|---|---|---|---|
| account_id | The account that was reassigned | string | a1b2c3d4-e5f6-7890-abcd-ef1234567890 |
| new_user_id | The user the account now belongs to | string | b2c3d4e5-f6a7-8901-bcde-f12345678901 |
| old_user_id | The user the account previously belonged to | string | c3d4e5f6-a7b8-9012-cdef-123456789012 |
| old_user_deleted | true if the previous user had no remaining accounts and was automatically deleted | boolean | true |
Behavior modes
| Params sent | Behavior |
|---|---|
| (none) | Creates a new empty user, moves the account there. |
smart: true | Finds accounts with the same phone identifier in your company. Moves to the user of the account with the most recent successful connection. Returns 400 if the account's identifier_type is not phone. Returns 404 if no matching accounts are found. |
external_id | Finds a user with that external_id in your company. If found, moves the account there. If not, creates a new user with that external_id and moves the account. |
user_id | Finds the user in your company and moves the account. Returns 404 if the user is not found. |
user_id + external_id | Moves the account to the specified user. If that user's external_id doesn't match the one you sent, it is updated to match. |
In all modes, if the previous user ends up with no remaining accounts, it is automatically deleted and old_user_deleted is set to true in the response.
