A directory group represents an organizational unit of users in a directory provider.
Get the details of an existing Directory Group.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const group = await workos.directorySync.getGroup( 'directory_group_01E64QTDNS0EGJ0FMCVY9BWGZT', );
GET/directory_groups /:idParameters Returns Get a list of all of existing directory groups matching the criteria specified.
To fetch the groups a single user belongs to, pass the user query parameter
with the directory user’s ID. This is the recommended replacement for the
groups field on the Directory
User object, which is deprecated
and returns an empty array by default for teams created on or after May 1,
2026. The response is bounded by a single user’s memberships, which gives
better throughput performance than the unbounded groups array. Existing
teams still depending on the legacy groups field should migrate to this
access pattern.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); const groups = await workos.directorySync.listGroups({ directory: 'directory_01ECAZ4NV9QMV47GW873HDCX74', }); console.log(groups.data);
GET/directory_groupsParameters Returns object