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.

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 Description
403 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

{
  "role_id": 5
}

Response

Returns the updated client account user object (same shape as list response items).

Error Responses

Status Description
400 Missing request body or role_id field
400 User not found in this client account
400 Role not found or invalid for client accounts
403 No access to the client account
403 Only Accountants and Client Account Owners can update user roles
403 You cannot change your own role

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 Description
400 User not found in this client account
400 Cannot remove the last Client Account Owner from the account
403 No access to the client account
403 Only Accountants and Client Account Owners can remove users
403 You cannot remove yourself from the client 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)