Skip to content

Users

Public surface of the Users service.

Users are organization-scoped accounts. Together with groups they form the basis of access management: put users in groups, then grant roles to the groups.

Usage

Prerequisites: Initialize the SDK first - see Getting Started

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

const users = new Users(sdk);
const allUsers = await users.getAll();

Methods

getAll()

getAll<T>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<PlatformUserGetResponse> : NonPaginatedResponse<PlatformUserGetResponse>>

Gets the users of the organization the SDK is configured for, with optional search, sorting, and pagination.

Returns each user's profile plus the groups they belong to (groupIds), so a membership check against a known group needs no extra call.

Type Parameters

Type Parameter Default type
T extends PlatformUserGetAllOptions PlatformUserGetAllOptions

Parameters

Parameter Type Description
options? T Search, sorting, and pagination options

Returns

Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<PlatformUserGetResponse> : NonPaginatedResponse<PlatformUserGetResponse>>

All users when no pagination options are given, one page otherwise, as PlatformUserGetResponse items

Examples

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

const sdk = new UiPath(config);
await sdk.initialize();

const users = new Users(sdk);
const allUsers = await users.getAll();
import { PlatformUserSortField, PlatformUserSortOrder } from '@uipath/uipath-typescript/users';

const page1 = await users.getAll({
  searchTerm: 'sarah',
  sortBy: PlatformUserSortField.Email,
  sortOrder: PlatformUserSortOrder.Ascending,
  pageSize: 20,
});
if (page1.hasNextPage) {
  const page2 = await users.getAll({ cursor: page1.nextCursor });
}

getById()

getById(userId: string): Promise<PlatformUserGetResponse>

Gets a user by ID.

Returns the user's profile, activity timestamps, and group memberships (groupIds).

Parameters

Parameter Type Description
userId string GUID of the user

Returns

Promise<PlatformUserGetResponse>

The user, as a PlatformUserGetResponse

Example

// Get a user id from the listing first
const { items } = await users.getAll();

const user = await users.getById(items[0].id);

updateById()

updateById(userId: string, update: PlatformUserUpdateOptions): Promise<void>

Updates a user.

Only the fields present in update are changed — omitted fields keep their current values. Group membership is edited incrementally through groupIdsToAdd / groupIdsToRemove, which makes this the call for granting or revoking a user's access ("add user to the Administrators group").

Group IDs can be read from any user's groupIds (e.g. via users.getById()).

Resolves once the change is applied. Input Identity rejects (for example an email that is already taken) surfaces as a ValidationError carrying the reason.

Parameters

Parameter Type Description
userId string GUID of the user to update
update PlatformUserUpdateOptions The fields to change

Returns

Promise<void>

Promise that resolves when the update has been applied

Examples

// Get a user id from the listing first
const { items } = await users.getAll();

await users.updateById(items[0].id, {
  groupIdsToAdd: ['<groupId>'],
});
await users.updateById('<userId>', {
  displayName: 'Sarah C.',
  isActive: true,
});