Users#
Manage user profiles, per-user settings, and user lifecycle operations.
List users#
List users in an organization with pagination and name search.
const { items, totalCount, facets } = await bw.users.list({
pageIndex: 0,
pageSize: 25,
organizationId: 'org_123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| pageIndex | integer | Required | Zero-based page index for pagination. |
| pageSize | integer | Required | Number of items per page (1-100). |
| organizationId | string (UUID) | Required | Organization identifier. |
| searchTerm | string | — | Free-text search term to filter results (max 200 characters). |
| sortBy | string | — | Column name to sort by. |
| sortDirection | 'asc' | 'desc' | — | Sort direction: ascending or descending. |
Response#
Returns { items, totalCount, facets } with paginated results.
Create user#
Create a new user record during sign-up.
const { data } = await bw.users.create({
userId: 'user_abc123',
email: 'user@example.com',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier (from auth provider). |
string | Required | User email address. | |
| name | string | null | — | User display name (max 255 characters). |
| jobRole | string | null | — | User job role (max 100 characters). |
Response#
Returns { data } with the result.
Get user#
Retrieve a single user by ID.
const { data } = await bw.users({ id: 'abc-123' });Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | User identifier. |
Response#
Returns { data } with the result.
Update user#
Update a user's profile information. Updatable fields: name (display name), email, jobRole (e.g. 'Head of Marketing'), avatarKey (storage key, null to remove). Only include the fields you want to change.
const { data } = await bw.users.update({
userId: 'user_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier to update. |
| name | string | — | Updated display name (1-255 characters). |
string | — | Updated email address. | |
| jobRole | string | null | — | Updated job role (max 100 characters). |
| avatarKey | string | null | — | Storage key for the user avatar image. Set to null to remove. |
Response#
Returns { data } with the result.
Request avatar upload#
Request a presigned URL for uploading a user avatar image. The client uploads the file directly using the returned URL, then calls PATCH /users/:id with the avatarKey.
const { data } = await bw.users.requestAvatarUpload({
userId: 'user_abc123',
contentLength: '...',
contentType: '...',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier requesting an avatar upload URL. |
| contentLength | integer | Required | Size of the file in bytes. |
| contentType | 'image/jpeg' | 'image/png' | 'image/webp' | 'image/gif' | Required | MIME type of the file. |
Response#
Returns { data } with the result.
Change email#
Request a change to the user's email address.
const { data } = await bw.users.changeEmail({
userId: 'user_abc123',
newEmail: '...',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier requesting the email change. |
| newEmail | string | Required | The new email address to change to. |
Response#
Returns { data } with the result.
Request user deletion#
Request an account deletion confirmation email after verifying ownership safeguards.
const { data } = await bw.users.requestDeletion({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | User identifier requesting account deletion. |
Response#
Returns { data } with the result.
Confirm user deletion#
Validate an account deletion token and re-check ownership safeguards before final deletion.
const { data } = await bw.users.confirmDeletion({
id: 'abc-123',
token: '...',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | User identifier confirming account deletion. |
| token | string (UUID) | Required | Deletion confirmation token from the email link. |
Response#
Returns { data } with the result.
Delete user#
Delete a user account using an optional email confirmation token, revoke access, remove memberships, and clear saved profile details.
const { data } = await bw.users.delete({
id: 'abc-123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| id | string (UUID) | Required | User identifier to delete. |
| token | string (UUID) | — | Optional deletion confirmation token from the email link. |
Response#
Returns { data } with the result.
Get user settings#
Retrieve a user's personal settings.
const { data } = await bw.users.settings({
userId: 'user_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier to fetch settings for. |
Response#
Returns { data } with the result.
Update user settings#
Create or update a user's settings, including switching the active organization and managing UI preferences.
const { data } = await bw.users.settings.update({
userId: 'user_abc123',
});Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
| userId | string (UUID) | Required | User identifier to update settings for. |
| activeOrganizationId | string (UUID) | — | Organization to set as the active workspace. |
| preferences | object | — | User UI preferences (shallow-merged into existing). |
Response#
Returns { data } with the result.