Skip to content

Platform Groups

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

Groups are organization-scoped containers of users. Together with users they form the basis of access management: put users in groups, then grant roles to the groups. Membership can be edited from the group side (this service) or from the user side (users.updateById() with groupIdsToAdd / groupIdsToRemove).

Methods

create()

create(name: string, organizationId: string, options?: PlatformGroupCreateOptions): Promise<PlatformGroupGetResponse>

Creates a local group.

Members can be added at creation through memberUserIds, or later — from the group side with updateById(), or from the user side with users.updateById().

Parameters

Parameter Type Description
name string Name of the new group
organizationId string Organization (account) GUID to create the group in
options? PlatformGroupCreateOptions Initial members

Returns

Promise<PlatformGroupGetResponse>

The created group, as a PlatformGroupGetResponse

Examples

const group = await groups.create('Ticket Admins', '<organizationId>');
const group = await groups.create('Ticket Admins', '<organizationId>', {
  memberUserIds: ['<userId>'],
});

deleteById()

deleteById(groupId: string, organizationId: string): Promise<void>

Deletes a local group. Built-in groups cannot be deleted.

Parameters

Parameter Type Description
groupId string GUID of the group to delete
organizationId string Organization (account) GUID the group belongs to

Returns

Promise<void>

Resolves when the group has been deleted

Example

await groups.deleteById('<groupId>', '<organizationId>');

getAll()

getAll(organizationId: string): Promise<PlatformGroupGetResponse[]>

Gets all local and built-in groups of an organization.

Returns every group with its type (built-in or custom) and timestamps. Built-in groups (Everyone, Administrators, …) cannot be modified or deleted.

Parameters

Parameter Type Description
organizationId string Organization (account) GUID to list groups from

Returns

Promise<PlatformGroupGetResponse[]>

All groups, as PlatformGroupGetResponse items

Example

import { UiPath } from '@uipath/uipath-typescript/core';
import { Groups } from '@uipath/uipath-typescript/platform';

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

const groups = new Groups(sdk);
const allGroups = await groups.getAll('<organizationId>');
const admins = allGroups.find(g => g.name === 'Administrators');

getById()

getById(groupId: string, organizationId: string): Promise<PlatformGroupGetResponse>

Gets a group by ID.

Parameters

Parameter Type Description
groupId string GUID of the group
organizationId string Organization (account) GUID the group belongs to

Returns

Promise<PlatformGroupGetResponse>

The group, as a PlatformGroupGetResponse

Example

const group = await groups.getById('<groupId>', '<organizationId>');
console.log(`${group.displayName} (${group.type})`);

getMembers()

getMembers<T>(groupId: string, organizationId: string, options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<PlatformGroupMember> : NonPaginatedResponse<PlatformGroupMember>>

Gets the local members of a group, with optional pagination.

Returns member references (id and account type). Fetch full profiles with users.getById() when needed. Note: membership of implicit groups (e.g. Everyone) is not materialized — they report no local members.

Type Parameters

Type Parameter Default type
T extends PaginationOptions PaginationOptions

Parameters

Parameter Type Description
groupId string GUID of the group
organizationId string Organization (account) GUID the group belongs to
options? T Pagination options

Returns

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

All members when no pagination options are given, one page otherwise, as PlatformGroupMember items

Examples

const members = await groups.getMembers('<groupId>', '<organizationId>');
console.log(`${members.items.length} members`);
const page1 = await groups.getMembers('<groupId>', '<organizationId>', { pageSize: 50 });
if (page1.hasNextPage) {
  const page2 = await groups.getMembers('<groupId>', '<organizationId>', { cursor: page1.nextCursor });
}

updateById()

updateById(groupId: string, organizationId: string, name: string, options?: PlatformGroupMembershipOptions): Promise<PlatformGroupGetResponse>

Updates a local group.

The group's name must be sent on every update — pass the current name when only editing membership (the bound group.update() fills it in automatically). Membership is edited incrementally through memberUserIdsToAdd / memberUserIdsToRemove. Built-in groups cannot be updated.

Parameters

Parameter Type Description
groupId string GUID of the group to update
organizationId string Organization (account) GUID the group belongs to
name string The group's name (new name to rename, or current name to keep it)
options? PlatformGroupMembershipOptions Membership changes

Returns

Promise<PlatformGroupGetResponse>

The group as stored after the update, as a PlatformGroupGetResponse

Examples

const updated = await groups.updateById('<groupId>', '<organizationId>', 'Ticket Managers');
const group = await groups.getById('<groupId>', '<organizationId>');
await groups.updateById(group.id, group.organizationId, group.name, {
  memberUserIdsToAdd: ['<userId>'],
  memberUserIdsToRemove: ['<otherUserId>'],
});