Skip to content

Users

Service model for managing users in a UiPath organization.

Provides organization-level user administration: retrieving, updating and deleting users, creating users in bulk, and inviting users by email.

Usage

Prerequisites: Initialize the SDK first - see Getting Started

import { Users } from '@uipath/uipath-typescript/users';

const users = new Users(sdk);
const user = await users.getById('<userId>');

Methods

create()

create(users: UserCreateData[], organizationId: string, options?: UserCreateOptions): Promise<UserCreateResponse>

Creates users in bulk.

Returns the created users with entity methods attached (update, delete). A single invalid user fails the whole request — check result.errors for the reason.

Parameters

Parameter Type Description
users UserCreateData[] Users to create
organizationId string Organization GUID the users belong to
options? UserCreateOptions Optional group assignment applied to every created user

Returns

Promise<UserCreateResponse>

Promise resolving to a UserCreateResponse with the overall outcome and the created users

Examples

const response = await users.create(
  [{ userName: 'jdoe', email: 'jdoe@acme.com', name: 'Jane', surname: 'Doe' }],
  '<organizationId>'
);
if (response.result.succeeded) {
  console.log(`Created ${response.users[0].id}`);
}
const response = await users.create(
  [{ userName: 'jdoe', email: 'jdoe@acme.com' }],
  '<organizationId>',
  { groupIds: ['<groupId>'] }
);

deleteById()

deleteById(userId: string): Promise<void>

Deletes a user.

Parameters

Parameter Type Description
userId string User GUID

Returns

Promise<void>

Promise that resolves when the user is deleted

Example

await users.deleteById('<userId>');

getById()

getById(userId: string): Promise<UserGetResponse>

Gets a user by ID.

Returns the full user details including profile fields, group membership, activity flags and invitation state, with entity methods attached (update, delete).

Parameters

Parameter Type Description
userId string User GUID

Returns

Promise<UserGetResponse>

Promise resolving to a UserGetResponse with the user's profile fields, group membership, activity flags and invitation state, plus bound entity methods

Example

const user = await users.getById('<userId>');
console.log(`${user.displayName} (${user.email}) — active: ${user.isActive}`);

// Operate on the user directly via bound methods
await user.update({ displayName: 'New Name' });

updateById()

updateById(userId: string, options: UserUpdateOptions): Promise<UserUpdateResponse>

Updates a user. Only the provided fields are changed.

Parameters

Parameter Type Description
userId string User GUID
options UserUpdateOptions Fields to update

Returns

Promise<UserUpdateResponse>

Promise resolving to a UserUpdateResponse indicating whether the update succeeded and any errors

Examples

// First, get the user with users.getById() or from users.create()
const result = await users.updateById('<userId>', { displayName: 'New Name' });
if (result.succeeded) {
  console.log('User updated');
}
await users.updateById('<userId>', {
  groupIdsToAdd: ['<groupId-1>'],
  groupIdsToRemove: ['<groupId-2>'],
});