Skip to content

Users

Defined in: src/team/client.gen.ts:443

new Users(_core): Users

Defined in: src/team/client.gen.ts:444

BrexCore

Users

create(body, options?): Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>

Defined in: src/team/client.gen.ts:455

Invite user

This endpoint invites a new user as an employee. To update user’s role, check out this article.

POST /v2/users — requires OAuth scope: users Supports an optional Idempotency-Key via options.idempotencyKey.

string | null

string

Format: email

string

string

string | null

string | null

{[key: string]: string; } | null

Description

The metadata or customized attributes of the user. Maximum number of entries: 100

string | null

RequestOptions

Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>


get(id, options?): Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>

Defined in: src/team/client.gen.ts:471

Get user

This endpoint gets a user by ID.

GET /v2/users/{id} — requires OAuth scope: users, users.readonly

string

RequestOptions

Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>


getLimit(id, options?): Promise<{ monthly_available?: { amount: number; currency: string | null; } | null; monthly_limit?: { amount: number; currency: string | null; } | null; }>

Defined in: src/team/client.gen.ts:487

Get limit for the user

This endpoint gets the monthly limit for the user including the monthly available limit.

GET /v2/users/{id}/limit — requires OAuth scope: users, users.readonly

string

RequestOptions

Promise<{ monthly_available?: { amount: number; currency: string | null; } | null; monthly_limit?: { amount: number; currency: string | null; } | null; }>


getMe(options?): Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>

Defined in: src/team/client.gen.ts:505

Get current user

This endpoint returns the user associated with the OAuth2 access token.

GET /v2/users/me — requires OAuth scope: users, users.readonly

RequestOptions

Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>


list(query?, options?): PagePromise<{ items: object[]; next_cursor?: string | null; }>

Defined in: src/team/client.gen.ts:521

List users

This endpoint lists all users. To find a user id by email, you can filter using the email query parameter.

GET /v2/users — requires OAuth scope: users, users.readonly Await for a single page, or for await to iterate items across all pages.

string | null

string | null

string[] | null

number | null

string | null

RequestOptions

PagePromise<{ items: object[]; next_cursor?: string | null; }>


setLimit(id, body, options?): Promise<{ monthly_available?: { amount: number; currency: string | null; } | null; monthly_limit?: { amount: number; currency: string | null; } | null; }>

Defined in: src/team/client.gen.ts:540

Set limit for the user

This endpoint sets the monthly limit for a user. The limit amount must be non-negative. To unset the monthly limit of the user, just set monthly_limit to null.

POST /v2/users/{id}/limit — requires OAuth scope: users Supports an optional Idempotency-Key via options.idempotencyKey.

string

{ amount: number; currency: string | null; } | null

RequestOptions

Promise<{ monthly_available?: { amount: number; currency: string | null; } | null; monthly_limit?: { amount: number; currency: string | null; } | null; }>


update(id, body, options?): Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>

Defined in: src/team/client.gen.ts:566

Update user

This endpoint updates a user. Any parameters not provided will be left unchanged.

PUT /v2/users/{id} — requires OAuth scope: users Supports an optional Idempotency-Key via options.idempotencyKey.

string

string | null

string | null

string | null

Description

The user id of the manager of this user

{[key: string]: string; } | null

Description

The metadata or customized attributes of the user. Maximum number of entries: 100

"ACTIVE" | "DISABLED" | null

string | null

RequestOptions

Promise<{ department_id?: string | null; email: string; first_name: string; id: string; last_name: string; location_id?: string | null; manager_id?: string | null; metadata?: {[key: string]: string; } | null; remote_display_id?: string | null; status?: "ACTIVE" | "DISABLED" | "ARCHIVED" | "DELETED" | "INACTIVE" | "INVITED" | "PENDING_ACTIVATION" | "CLOSED" | null; title_id?: string | null; }>