Skip to content

Platform Users

Public surface of the platform Users service. JSDoc on this interface drives the generated API reference documentation.

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.

Methods

getAll()

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

Gets the users of an organization, 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
organizationId string Organization (account) GUID to list users from
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/platform';

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

const users = new Users(sdk);
const allUsers = await users.getAll('<organizationId>');
for (const user of allUsers.items) {
  console.log(`${user.email}: member of ${user.groupIds.length} groups`);
}
import { PlatformUserSortField, PlatformUserSortOrder } from '@uipath/uipath-typescript/platform';

const page1 = await users.getAll('<organizationId>', {
  searchTerm: 'sarah',
  sortBy: PlatformUserSortField.Email,
  sortOrder: PlatformUserSortOrder.Ascending,
  pageSize: 20,
});
if (page1.hasNextPage) {
  const page2 = await users.getAll('<organizationId>', { 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

const user = await users.getById('<userId>');
console.log(`${user.userName} last signed in at ${user.lastLoginTime}`);

updateById()

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

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").

First, get group IDs with groups.getAll() (from @uipath/uipath-typescript/platform).

Parameters

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

Returns

Promise<PlatformUserUpdateResponse>

The update result, as a PlatformUserUpdateResponse

Examples

const result = await users.updateById('<userId>', {
  groupIdsToAdd: ['<groupId>'],
});
if (!result.success) {
  console.error(result.errors);
}
await users.updateById('<userId>', {
  displayName: 'Sarah C.',
  isActive: true,
});