Client Account Users
The client account users API lets you manage who has access to a client account and what role they have. Each user in a client account is assigned a role that determines their permissions.
Only users with the Accountant (AA) or Client Account Owner (CA) role can manage other users. Regular users (US) can view the user list but cannot make changes.
Endpoints
| Method |
Endpoint |
Description |
| GET |
/client-accounts/{client_account_id}/users |
List users in a client account |
| PATCH |
/client-accounts/{client_account_id}/users/{user_id} |
Update a user’s role |
| DELETE |
/client-accounts/{client_account_id}/users/{user_id} |
Remove a user |
List Users
GET /api/v2/client-accounts/{client_account_id}/users
Returns all active users in the client account with their roles, newest first.
This endpoint is not paginated — it returns a plain JSON array and ignores
page and per_page.
Query Parameters
| Parameter |
Type |
Required |
Description |
| with |
string |
No |
Comma-separated relations to include: user, role |
Response
[
{
"id": 1,
"created_at": "2024-01-15T08:30:00Z",
"created_by_id": 7,
"client_account_id": 42,
"user_id": 7,
"role_id": 3,
"is_active": true
}
]
Response with Relations
When ?with=user,role is included:
[
{
"id": 1,
"created_at": "2024-01-15T08:30:00Z",
"created_by_id": 7,
"client_account_id": 42,
"user_id": 7,
"role_id": 3,
"is_active": true,
"user": {
"id": 7,
"created_at": "2024-01-10T12:00:00Z",
"first_name": "Ola",
"last_name": "Nordmann",
"profile_image_url": "https://cdn.snapbooks.no/profile-images/abc123.jpg",
"last_login": "2026-04-08T14:22:00Z"
},
"role": {
"id": 3,
"name": "CA"
}
}
]
Error Responses
| Status |
Code |
Description |
| 403 |
common.forbidden |
No access to the client account |
Update User Role
PATCH /api/v2/client-accounts/{client_account_id}/users/{user_id}
Changes a user’s role within the client account. Only Accountants (AA) and Client Account Owners (CA) can update roles. You cannot change your own role.
Path Parameters
| Parameter |
Type |
Description |
| client_account_id |
integer |
The client account ID |
| user_id |
integer |
The ID of the user whose role to update |
Request Body
| Field |
Type |
Required |
Description |
| role_id |
integer |
Yes |
The new role ID to assign |
Example Request
Response
Returns the updated client account user object (same shape as list response items).
Error Responses
| Status |
Code |
Description |
| 400 |
common.validation_error |
Missing request body or role_id field |
| 400 |
common.validation_error |
User not found in this client account |
| 400 |
common.validation_error |
Role not found, or not one of AA, CA, US |
| 403 |
common.forbidden |
No access to the client account, or the caller is not an Accountant or Client Account Owner |
| 403 |
client_account.cannot_change_own_role |
The user_id in the path is the caller’s own user ID |
Remove User
DELETE /api/v2/client-accounts/{client_account_id}/users/{user_id}
Removes a user from the client account. This is a soft delete — the user’s is_active flag is set to false rather than deleting the record. Only Accountants (AA) and Client Account Owners (CA) can remove users.
Path Parameters
| Parameter |
Type |
Description |
| client_account_id |
integer |
The client account ID |
| user_id |
integer |
The ID of the user to remove |
Response
Returns the updated client account user object with is_active set to false.
{
"id": 1,
"created_at": "2024-01-15T08:30:00Z",
"created_by_id": 7,
"client_account_id": 42,
"user_id": 12,
"role_id": 5,
"is_active": false
}
Error Responses
| Status |
Code |
Description |
| 400 |
common.validation_error |
User not found in this client account |
| 403 |
common.forbidden |
No access to the client account, or the caller is not an Accountant or Client Account Owner |
| 403 |
client_account.cannot_remove_self |
The user_id in the path is the caller’s own user ID |
| 409 |
client_account.cannot_remove_last_owner |
The user is the last active Client Account Owner on the account |
Roles
Users in a client account are assigned one of the following roles:
| Code |
Name |
Can Manage Users |
| AA |
Accountant |
Yes |
| CA |
Client Account Owner |
Yes |
| US |
User |
No |
Only users with the AA or CA role can update other users’ roles or remove users. The system prevents removing the last Client Account Owner to ensure every account retains at least one owner.
Attributes
Client Account User
| Attribute |
Type |
Description |
| id |
integer |
Unique identifier (read-only) |
| created_at |
datetime |
When the user was added to the account (read-only) |
| created_by_id |
integer |
ID of the user who added this user (read-only) |
| client_account_id |
integer |
The client account ID |
| user_id |
integer |
The user’s ID |
| role_id |
integer |
The assigned role ID |
| is_active |
boolean |
Whether the user is active in this account (read-only) |
Relations
| Relation |
Type |
Description |
| user |
User |
The user’s profile (include with ?with=user) |
| role |
Role |
The user’s role (include with ?with=role) |
Error Codes
Errors use the standard error envelope. Branch on code, not on
message. In addition to the common codes, these
endpoints return:
| Code |
HTTP status |
When |
client_account.cannot_change_own_role |
403 |
The caller tried to change their own role |
client_account.cannot_remove_self |
403 |
The caller tried to remove themselves from the client account |
client_account.cannot_remove_last_owner |
409 |
Removing the user would leave the account without an active Client Account Owner |
Example Error Response
{
"error": {
"code": "client_account.cannot_remove_last_owner",
"message": "Cannot remove the last Client Account Owner from the account.",
"request_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
}
}