A directory user represents an active organization user.
Developers can receive Webhooks as employees are added, updated or removed, allowing for provisioning and de-provisioning Users within an application.
Get a list of the Directory Users in a Directory, optionally filtered to the members of a Directory Group.
| curl "https://api.workos.com/directories/directory_01ECAZ4NV9QMV47GW873HDCX74/users" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const users = await workos.directorySync.listDirectoryUsers({ | |
| directoryId: 'directory_01ECAZ4NV9QMV47GW873HDCX74', | |
| }); | |
| console.log(users.data); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.directory_sync.list_directory_users(directory_id: "directory_01ECAZ4NV9QMV47GW873HDCX74") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.directory_sync.list_directory_users( | |
| directory_id="directory_01ECAZ4NV9QMV47GW873HDCX74" | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.DirectorySync().ListUsers(context.Background(), "directory_01ECAZ4NV9QMV47GW873HDCX74") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->directorySync() | |
| ->listDirectoryUsers(directoryId: "directory_01ECAZ4NV9QMV47GW873HDCX74"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.directorySync.listDirectoryUsers("directory_01ECAZ4NV9QMV47GW873HDCX74"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.DirectorySync.ListUsersAsync("directory_01ECAZ4NV9QMV47GW873HDCX74"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .directory_sync() | |
| .list_directory_users("directory_01ECAZ4NV9QMV47GW873HDCX74") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "directory_user", | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "idp_id": "2836", | |
| "email": "marcelina.davis@example.com", | |
| "first_name": "Marcelina", | |
| "last_name": "Davis", | |
| "name": "Marcelina Davis", | |
| "state": "active", | |
| "custom_attributes": { | |
| "department": "Engineering", | |
| "job_title": "Software Engineer" | |
| }, | |
| "role": { | |
| "slug": "admin" | |
| }, | |
| "roles": [ | |
| { | |
| "slug": "admin" | |
| } | |
| ], | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "directory_user_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "directory_user_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/directories /:directoryId /users
Parameters
Returns object
Get the details of a Directory User in a Directory.
| curl "https://api.workos.com/directories/directory_01ECAZ4NV9QMV47GW873HDCX74/users/directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const user = await workos.directorySync.getDirectoryUser({ | |
| directoryId: 'directory_01ECAZ4NV9QMV47GW873HDCX74', | |
| userId: 'directory_user_01E1JG7J09H96KYP8HM9B0G5SJ', | |
| }); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.directory_sync.get_directory_user( | |
| directory_id: "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| user_id: "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" | |
| ) |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.directory_sync.get_directory_user( | |
| directory_id="directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| user_id="directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| ) |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.DirectorySync().GetUser(context.Background(), "directory_01ECAZ4NV9QMV47GW873HDCX74", "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->directorySync() | |
| ->getDirectoryUser( | |
| directoryId: "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| userId: "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| ); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.directorySync.getDirectoryUser( | |
| "directory_01ECAZ4NV9QMV47GW873HDCX74", "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.DirectorySync.GetUserAsync("directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .directory_sync() | |
| .get_directory_user( | |
| "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" | |
| ) | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "directory_user", | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "idp_id": "2836", | |
| "email": "marcelina.davis@example.com", | |
| "first_name": "Marcelina", | |
| "last_name": "Davis", | |
| "name": "Marcelina Davis", | |
| "state": "active", | |
| "custom_attributes": { | |
| "department": "Engineering", | |
| "job_title": "Software Engineer" | |
| }, | |
| "role": { | |
| "slug": "admin" | |
| }, | |
| "roles": [ | |
| { | |
| "slug": "admin" | |
| } | |
| ], | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
GET/directories /:directoryId /users /:userId
Parameters
Returns
Get a list of all of existing Directory Users matching the criteria specified.
This endpoint is deprecated. Use List Users for a Directory instead.
| curl "https://api.workos.com/directory_users" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const users = await workos.directorySync.listUsers({ | |
| directory: 'directory_01ECAZ4NV9QMV47GW873HDCX74', | |
| }); | |
| console.log(users.data); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.directory_sync.list_users |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.directory_sync.list_users() |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.DirectorySync().ListUsers(context.Background()) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos->directorySync()->listUsers(); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.directorySync.listUsers(); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.DirectorySync.ListUsersAsync(); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .directory_sync() | |
| .list_users() | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "directory_user", | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "idp_id": "2836", | |
| "email": "marcelina.davis@example.com", | |
| "first_name": "Marcelina", | |
| "last_name": "Davis", | |
| "name": "Marcelina Davis", | |
| "state": "active", | |
| "custom_attributes": { | |
| "department": "Engineering", | |
| "job_title": "Software Engineer" | |
| }, | |
| "role": { | |
| "slug": "admin" | |
| }, | |
| "roles": [ | |
| { | |
| "slug": "admin" | |
| } | |
| ], | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "directory_user_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "directory_user_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |
GET/directory_users
Parameters
Returns object
Get the details of an existing Directory User.
This endpoint is deprecated. Use Get a User for a Directory instead.
| curl "https://api.workos.com/directory_users/directory_user_01E1JG7J09H96KYP8HM9B0G5SJ" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const user = await workos.directorySync.getUser( | |
| 'directory_user_01E64QS50EAY48S0XJ1AA4WX4D', | |
| ); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.directory_sync.get_user(id: "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ") |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.directory_sync.get_user(id_="directory_user_01E1JG7J09H96KYP8HM9B0G5SJ") |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.DirectorySync().GetUser(context.Background(), "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ") | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos | |
| ->directorySync() | |
| ->getUser(id: "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.directorySync.getUser("directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.DirectorySync.GetUserAsync("directory_user_01E1JG7J09H96KYP8HM9B0G5SJ"); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .directory_sync() | |
| .get_user("directory_user_01E1JG7J09H96KYP8HM9B0G5SJ") | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "directory_user", | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "idp_id": "2836", | |
| "email": "marcelina.davis@example.com", | |
| "first_name": "Marcelina", | |
| "last_name": "Davis", | |
| "name": "Marcelina Davis", | |
| "state": "active", | |
| "custom_attributes": { | |
| "department": "Engineering", | |
| "job_title": "Software Engineer" | |
| }, | |
| "role": { | |
| "slug": "admin" | |
| }, | |
| "roles": [ | |
| { | |
| "slug": "admin" | |
| } | |
| ], | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z" | |
| } |
GET/directory_users /:id
Parameters
Returns
Get a list of directory users that belong to a specific directory group.
This endpoint is deprecated. Use List Users for a
Directory with
the group parameter instead.
Starting May 1, 2026, the groups field on each returned user is empty by default for newly created teams – the caller already knows which group is being filtered. To fetch a user’s complete group memberships, use the List Directory Groups endpoint with a user filter.
| curl "https://api.workos.com/directory_users?group=directory_group_01E1JG7J09H96KYP8HM9B0G5SJ" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS('sk_example_123456789'); | |
| const users = await workos.directorySync.listUsers({ | |
| group: 'directory_group_01E1JG7J09H96KYP8HM9B0G5SJ', | |
| }); | |
| console.log(users.data); |
| require "workos" | |
| WorkOS.configure do |config| | |
| config.api_key = "sk_example_123456789" | |
| end | |
| WorkOS.client.directory_sync.list_users |
| from workos import WorkOSClient | |
| client = WorkOSClient(api_key="sk_example_123456789", client_id="client_123456789") | |
| client.directory_sync.list_users() |
| package main | |
| import ( | |
| "context" | |
| "github.com/workos/workos-go/v10" | |
| ) | |
| func main() { | |
| client := workos.NewClient("sk_example_123456789") | |
| _, err := client.DirectorySync().ListUsers(context.Background()) | |
| if err != nil { | |
| panic(err) | |
| } | |
| } |
| <?php | |
| use WorkOS\WorkOS; | |
| $workos = new WorkOS( | |
| apiKey: "sk_example_123456789", | |
| clientId: "client_123456789", | |
| ); | |
| $workos->directorySync()->listUsers(); |
| import com.workos.WorkOS; | |
| WorkOS workos = new WorkOS("sk_example_123456789"); | |
| workos.directorySync.listUsers(); |
| using WorkOS; | |
| var client = new WorkOSClient(new WorkOSOptions { | |
| ApiKey = "sk_example_123456789", | |
| ClientId = "client_123456789", | |
| }); | |
| await client.DirectorySync.ListUsersAsync(); |
| use workos::Client; | |
| #[tokio::main] | |
| async fn main() -> Result<(), workos::Error> { | |
| let client = Client::builder() | |
| .api_key("sk_example_123456789") | |
| .client_id("client_123456789") | |
| .build(); | |
| let _result = client | |
| .directory_sync() | |
| .list_users() | |
| .await?; | |
| Ok(()) | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "directory_user", | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "idp_id": "2836", | |
| "email": "marcelina.davis@example.com", | |
| "first_name": "Marcelina", | |
| "last_name": "Davis", | |
| "state": "active", | |
| "custom_attributes": { | |
| "department": "Engineering", | |
| "job_title": "Software Engineer" | |
| }, | |
| "role": { | |
| "slug": "admin" | |
| }, | |
| "roles": [ | |
| { | |
| "slug": "admin" | |
| } | |
| ], | |
| "created_at": "2026-01-15T12:00:00.000Z", | |
| "updated_at": "2026-01-15T12:00:00.000Z", | |
| "groups": [] | |
| } | |
| ], | |
| "list_metadata": { | |
| "before": "directory_user_01HXYZ123456789ABCDEFGHIJ", | |
| "after": "directory_user_01HXYZ987654321KJIHGFEDCBA" | |
| } | |
| } |