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' });

invite()

invite(users: UserInviteData[]): Promise<UserInviteResponse>

Invites users to the organization by email.

Each invited user receives an invitation email with an accept link that redirects to redirectUrl. Individual invitations can fail while the request as a whole succeeds — check success on each entry in users.

Parameters

Parameter Type Description
users UserInviteData[] Users to invite

Returns

Promise<UserInviteResponse>

Promise resolving to a UserInviteResponse with the overall outcome and per-user invitation results

Examples

const response = await users.invite([
  {
    email: 'jdoe@acme.com',
    redirectUrl: 'https://cloud.uipath.com/portal_/acceptInvite?organizationId=<organizationId>',
  },
]);
for (const user of response.users) {
  console.log(`${user.email}: ${user.success ? 'invited' : user.errorMessage}`);
}
await users.invite([
  {
    email: 'jdoe@acme.com',
    redirectUrl: 'https://cloud.uipath.com/portal_/acceptInvite?organizationId=<organizationId>',
    name: 'Jane',
    surname: 'Doe',
    groupIds: ['<groupId>'],
  },
]);

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>'],
});