WorkOS Docs Homepage
Events
API referenceDashboardSign In
Event typesOverviewOverviewAuthentication eventsAuthentication eventsConnection eventsConnection eventsDirectory Sync eventsDirectory Sync eventsEmail verification eventsEmail verification eventsFeature flag eventsFeature flag eventsInvitation eventsInvitation eventsMagic Auth eventsMagic Auth eventsOrganization eventsOrganization eventsOrganization domain eventsOrganization domain eventsOrganization membership eventsOrganization membership eventsPassword reset eventsPassword reset eventsRole eventsRole eventsSession eventsSession eventsUser eventsUser eventsData syncingOverviewOverviewSyncing with events APISyncing with events APISyncing with webhooksSyncing with webhooksData reconciliationData reconciliationObservabilityStreaming to DatadogStreaming to Datadog
API Reference
API Reference
Integrations
Integrations
Migrate to WorkOS
Migrate to WorkOS
SDKs
SDKs

Directory Sync events

Events emitted when directory-related resources are changed.

On this page

  • Directory activated
  • Directory deleted
  • Directory group created
  • Directory group deleted
  • Directory group updated
  • Directory group user added
  • Directory group user removed
  • Directory user created
  • Directory user deleted
  • Directory user updated

Events emitted when directory-related resources are changed. To learn what exactly each of these events represents, see the in-depth Directory Sync events guide.

Directory activated

Event name: dsync.activated

Triggered when a directory is activated.

Payload data is based on the Directory object, but the domain property is replaced with a domains array of Organization Domain.

Directory activated event
JSON
{
"event": "dsync.activated",
"id": "event_01FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"object": "directory",
"external_key": "UWuccu6o1E0GqkYs",
"name": "Foo Corp's Directory",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"id": "directory_01EHWNC0FCBHZ3BJ7EGKYXK0E6",
"state": "active",
"type": "generic scim v2.0",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"domains": [
{
"object": "organization_domain",
"id": "org_domain_01EZTR5N6Y9RQKHK2E9F31KZX6",
"domain": "foo-corp.com"
}
]
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory deleted

Event name: dsync.deleted

Triggered when a directory is deleted. The state attribute indicates directory state before deletion.

Payload data is based on the Directory object, except the domain property is omitted.

Directory deleted event
JSON
{
"event": "dsync.deleted",
"id": "event_03FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"object": "directory",
"id": "directory_01EHWNC0FCBHZ3BJ7EGKYXK0E6",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"type": "generic scim v2.0",
"state": "deleting",
"name": "Foo Corp's Directory",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z"
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory group created

Event name: dsync.group.created

Triggered when a directory group is created.

Payload data corresponds to the Directory Group object.

Directory group created event
JSON
{
"event": "dsync.group.created",
"id": "event_44FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_group_01E1X5GPMMXF4T1DCERMVEEPVW",
"idp_id": "02grqrue4294w24",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"name": "Developers",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"raw_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory group deleted

Event name: dsync.group.deleted

Triggered when a directory group is deleted.

Payload data corresponds to the Directory Group object.

Directory group deleted event
JSON
{
"event": "dsync.group.deleted",
"id": "event_06FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_group_01E1X5GPMMXF4T1DCERMVEEPVW",
"idp_id": "02grqrue4294w24",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"name": "Developers",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"raw_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory group updated

Event name: dsync.group.updated

Triggered when a directory group is updated.

Payload data corresponds to the Directory Group object.

Directory group updated event
JSON
{
"event": "dsync.group.updated",
"id": "event_54FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_group_01E1X5GPMMXF4T1DCERMVEEPVW",
"idp_id": "02grqrue4294w24",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"name": "Developers",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"raw_attributes": {},
"previous_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory group user added

Event name: dsync.group.user_added

Triggered when a directory group user is added.

Payload data contains a user which corresponds to the Directory User object and a group which corresponds to the Directory Group object. The groups field is omitted from the user object to avoid performance issues in large directories.

Directory group user added event
JSON
{
"event": "dsync.group.user_added",
"id": "event_04FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"user": {
"id": "directory_user_01E1X56GH84T3FB41SD6PZGDBX",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"idp_id": "2936",
"emails": [
{
"primary": true,
"type": "work",
"value": "eric@example.com"
}
],
"first_name": "Eric",
"last_name": "Schneider",
"username": "eric@example.com",
"state": "active",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"custom_attributes": {
"department": "Engineering",
"job_title": "Software Engineer"
},
"role": { "slug": "member" },
"roles": [{ "slug": "member" }],
"raw_attributes": {}
},
"group": {
"id": "directory_group_01E1X5GPMMXF4T1DCERMVEEPVW",
"idp_id": "02grqrue4294w24",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"name": "Developers",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"raw_attributes": {}
}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory group user removed

Event name: dsync.group.user_removed

Triggered when a directory group user is removed.

Payload data contains a user which corresponds to the Directory User object and a group which corresponds to the Directory Group object. The groups field is omitted from the user object to avoid performance issues in large directories.

Directory group user removed event
JSON
{
"event": "dsync.group.user_removed",
"id": "event_05FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"user": {
"id": "directory_user_01E1X56GH84T3FB41SD6PZGDBX",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"idp_id": "2936",
"emails": [
{
"primary": true,
"type": "work",
"value": "eric@example.com"
}
],
"first_name": "Eric",
"last_name": "Schneider",
"username": "eric@example.com",
"state": "active",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"custom_attributes": {
"department": "Engineering",
"job_title": "Software Engineer"
},
"role": { "slug": "member" },
"roles": [{ "slug": "member" }],
"raw_attributes": {}
},
"group": {
"id": "directory_group_01E1X5GPMMXF4T1DCERMVEEPVW",
"idp_id": "02grqrue4294w24",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"name": "Developers",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"raw_attributes": {}
}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory user created

Event name: dsync.user.created

Triggered when a directory user is created.

Payload data corresponds to the Directory User object. The groups field is omitted to avoid performance issues in large directories.

Directory user created event
JSON
{
"event": "dsync.user.created",
"id": "event_07FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_user_01E1X1B89NH8Z3SDFJR4H7RGX7",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"idp_id": "8931",
"emails": [
{
"primary": true,
"type": "work",
"value": "lela.block@example.com"
}
],
"first_name": "Lela",
"last_name": "Block",
"username": "lela.block@example.com",
"state": "active",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"custom_attributes": {
"department": "Engineering",
"job_title": "Software Engineer"
},
"role": { "slug": "member" },
"roles": [{ "slug": "member" }],
"raw_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory user deleted

Event name: dsync.user.deleted

Triggered when a directory user is deleted. The state attribute indicates directory user state at time of deletion.

Payload data corresponds to the Directory User object. The groups field is omitted to avoid performance issues in large directories.

Directory user deleted event
JSON
{
"event": "dsync.user.deleted",
"id": "event_09FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_user_01E1X1B89NH8Z3SDFJR4H7RGX7",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"idp_id": "8931",
"emails": [
{
"primary": true,
"type": "work",
"value": "lela.block@example.com"
}
],
"first_name": "Lela",
"last_name": "Block",
"job_title": "Software Engineer",
"username": "lela.block@example.com",
"state": "inactive",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"custom_attributes": {
"department": "Engineering"
},
"role": { "slug": "member" },
"roles": [{ "slug": "member" }],
"raw_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}

Directory user updated

Event name: dsync.user.updated

Triggered when a directory user is updated.

Payload data corresponds to the Directory User object. The groups field is omitted to avoid performance issues in large directories.

Directory user updated event
JSON
{
"event": "dsync.user.updated",
"id": "event_08FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"id": "directory_user_01E1X1B89NH8Z3SDFJR4H7RGX7",
"directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74",
"organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y",
"idp_id": "8931",
"emails": [
{
"primary": true,
"type": "work",
"value": "lela.block@example.com"
}
],
"first_name": "Lela",
"last_name": "Block",
"username": "lela.block@example.com",
"state": "active",
"created_at": "2021-06-25T19:07:33.155Z",
"updated_at": "2021-06-25T19:07:33.155Z",
"custom_attributes": {
"department": "Engineering",
"job_title": "Software Engineer"
},
"role": { "slug": "member" },
"roles": [{ "slug": "member" }],
"raw_attributes": {},
"previous_attributes": {}
},
"created_at": "2021-06-25T19:07:33.155Z",
"context": {}
}
© WorkOS, Inc.
FeaturesAuthKitSingle Sign-OnDirectory SyncAdmin PortalFine-Grained Authorization
DevelopersDocumentationChangelogAPI Status
ResourcesBlogPodcastPricingSecuritySupport
CompanyAboutCustomersCareersLegalPrivacy
© WorkOS, Inc.