Skip to main content
The User API allows you to retrieve and update the current user’s profile information, manage tokens, view audit logs, and access billing and organization details.

Get user details

Retrieve details about the current user.
const user = await client.user.get();
console.log(user.first_name, user.last_name);
id
string
Identifier of the user
first_name
string | null
User’s first name
last_name
string | null
User’s last name
country
string | null
The country in which the user lives
zipcode
string | null
The zipcode or postal code where the user lives
telephone
string | null
User’s telephone number
two_factor_authentication_enabled
boolean
Indicates whether two-factor authentication is enabled for the user account (does not apply to API authentication)
two_factor_authentication_locked
boolean
Indicates whether two-factor authentication is required by one of the accounts the user is a member of
has_pro_zones
boolean
Indicates whether user has any pro zones
has_business_zones
boolean
Indicates whether user has any business zones
has_enterprise_zones
boolean
Indicates whether user has any enterprise zones
suspended
boolean
Indicates whether user has been suspended
betas
string[]
Lists the betas that the user is participating in
organizations
object[]
Organizations the user belongs to

Update user details

Edit part of the user’s details.
const response = await client.user.edit({
  first_name: 'Jane',
  last_name: 'Doe',
  telephone: '+1-555-1234',
  country: 'US',
  zipcode: '94107'
});
first_name
string | null
User’s first name
last_name
string | null
User’s last name
telephone
string | null
User’s telephone number
country
string | null
The country in which the user lives
zipcode
string | null
The zipcode or postal code where the user lives

Sub-resources

The User resource provides access to several sub-resources:

Audit logs

Access user-level audit logs:
for await (const log of client.user.auditLogs.list()) {
  console.log(log.action, log.when);
}

Billing

Access user billing information:
const profile = await client.user.billing.profiles.get({
  account_id: 'account-id'
});

Invites

Manage user invitations:
for await (const invite of client.user.invites.list()) {
  console.log(invite.status);
}

Organizations

Access user organizations:
for await (const org of client.user.organizations.list()) {
  console.log(org.name);
}

Tokens

Manage API tokens:
const token = await client.user.tokens.create({
  name: 'My API Token',
  policies: [{
    effect: 'allow',
    resources: { '*': '*' },
    permission_groups: [{
      id: 'token_permissions_read'
    }]
  }]
});

Subscriptions

Manage user subscriptions:
const subscription = await client.user.subscriptions.update(
  'subscription-id',
  { /* subscription params */ }
);

Build docs developers (and LLMs) love