Directory events
Explore webhook events related to directory operations in Scalekit, including user and group creation, updates, and deletions.
This page documents the webhook events Scalekit sends when an organization’s directory, its users or its groups change.
Table of contents
Event envelope
Every directory event has the same top-level fields. The event-specific fields are in data. Keys can arrive in any order, so parse the body as JSON rather than matching it as text.
| Field | Type | Description |
|---|---|---|
spec_version | string | Webhook payload version. Currently "1" |
id | string | Unique event ID, prefixed with evt_. Use it to ignore duplicate deliveries |
type | string | Event type, such as organization.directory.user_created |
occurred_at | string | When the event occurred, in RFC 3339 format |
environment_id | string | Environment the event belongs to |
organization_id | string | Organization the directory belongs to |
object | string | Directory, DirectoryUser or DirectoryGroup |
data | object | The directory, user or group. See each event below |
Directory connection events
organization.directory_created
Sent when a directory is created for an organization. A SCIM or LDAP directory is enabled on creation, so organization.directory_enabled follows. A POLL directory is created disabled and sends only this event. data has four fields only.
{ "spec_version": "1", "id": "evt_55136848686612000", "type": "organization.directory_created", "occurred_at": "2025-01-15T08:55:22.702860294Z", "environment_id": "env_27758032200925221", "organization_id": "org_55135410258444802", "object": "Directory", "data": { "directory_type": "SCIM", "id": "dir_55135622825771522", "organization_id": "org_55135410258444802", "provider": "OKTA" }}| Field | Type | Description |
|---|---|---|
id | string | Directory ID, prefixed with dir_ |
organization_id | string | Organization that owns the directory |
directory_type | string | How the directory syncs, such as SCIM |
provider | string | Directory provider, such as OKTA |
organization.directory_enabled
Sent when directory sync is enabled for an organization.
{ "spec_version": "1", "id": "evt_55136848686613000", "type": "organization.directory_enabled", "occurred_at": "2025-01-15T08:55:22.802860294Z", "environment_id": "env_27758032200925221", "organization_id": "org_55135410258444802", "object": "Directory", "data": { "directory_type": "SCIM", "enabled": true, "id": "dir_55135622825771522", "organization_id": "org_55135410258444802", "provider": "OKTA", "updated_at": "2025-01-15T08:55:22.792993454Z" }}| Field | Type | Description |
|---|---|---|
id | string | Directory ID, prefixed with dir_ |
organization_id | string | Organization that owns the directory |
directory_type | string | How the directory syncs, such as SCIM |
provider | string | Directory provider, such as OKTA |
enabled | boolean | Always true on this event |
updated_at | string | When the directory was last updated |
organization.directory_disabled
Sent when directory sync is disabled for an organization. data has four fields only.
{ "spec_version": "1", "id": "evt_53891640779079756", "type": "organization.directory_disabled", "occurred_at": "2025-01-06T18:45:21.057814Z", "environment_id": "env_53814739859406915", "organization_id": "org_53879494091473415", "object": "Directory", "data": { "directory_type": "SCIM", "id": "dir_53879621145330183", "organization_id": "org_53879494091473415", "provider": "OKTA" }}| Field | Type | Description |
|---|---|---|
id | string | Directory ID, prefixed with dir_ |
organization_id | string | Organization that owns the directory |
directory_type | string | How the directory syncs, such as SCIM |
provider | string | Directory provider, such as OKTA |
organization.directory_deleted
Sent when a directory is deleted. Deleting a directory through the API or dashboard requires disabling it first. Deleting an organization also deletes its directories, enabled or not, and sends this event for each. data has four fields only.
{ "spec_version": "1", "id": "evt_53891640779079900", "type": "organization.directory_deleted", "occurred_at": "2025-01-06T18:50:02.118243Z", "environment_id": "env_53814739859406915", "organization_id": "org_53879494091473415", "object": "Directory", "data": { "directory_type": "SCIM", "id": "dir_53879621145330183", "organization_id": "org_53879494091473415", "provider": "OKTA" }}| Field | Type | Description |
|---|---|---|
id | string | Directory ID, prefixed with dir_ |
organization_id | string | Organization that owns the directory |
directory_type | string | How the directory syncs, such as SCIM |
provider | string | Directory provider, such as OKTA |
Directory user events
All three user events send the same user object in data.
organization.directory.user_createdis sent when the directory provider creates an active user, or reactivates a deactivated user.organization.directory.user_updatedis sent when an active user’s attributes change, or when the user is added to or removed from a group.organization.directory.user_deletedis sent when an active user is deactivated or deleted in the directory provider.datacarries the last known user record.activeisfalsewhen the user was deactivated.
Changes to a user who is already inactive send no event.
Directory user fields
The first seven fields are always sent. roles is computed by Scalekit and is sent on every user event when your environment has roles. The rest are sent only when the directory provider supplies them.
| Field | Type | Description |
|---|---|---|
id | string | Directory user ID, prefixed with diruser_ |
organization_id | string | Organization the user belongs to |
active | boolean | Whether the user is active in the directory provider |
preferred_username | string | The user’s userName from the provider. Empty string if not set |
dp_id | string | The user’s externalId from the provider. Empty string if not set |
email | string or null | Primary email address. null if the provider marks no email as primary |
groups | array or null | Groups the user belongs to, each with id and name. null if the user is in no groups |
name | string | Display name |
given_name | string | Given (first) name |
family_name | string | Family (last) name |
nickname | string | Nickname |
picture | string | Profile picture URL |
phone_number | string | Work phone number |
address | object | The user’s SCIM address of type work: street_address, locality, state (from SCIM region), postal_code, country and formatted |
profile | string | Profile URL |
locale | string | Locale |
zoneinfo | string | Time zone |
language | string | Preferred language |
title | string | Job title |
user_type | string | User type |
employee_id | string | Employee number from the SCIM enterprise extension |
cost_center | string | Cost center from the enterprise extension |
organization | string | Organization from the enterprise extension |
division | string | Division from the enterprise extension |
department | string | Department from the enterprise extension |
manager | object | The user’s manager, with id, email and user_name, when the manager is also in the directory |
roles | array | Scalekit roles assigned through group-based role assignment, each with role_name. An empty array when no role applies |
dp_roles | array or null | Roles as sent by the provider, each with display, primary, type and value. null if the provider sends an empty list |
entitlements | array or null | Entitlements as sent by the provider, each with display, primary, type and value. null if the provider sends an empty list |
custom_attributes | object | Custom attributes you mapped for this directory, plus home_phone_number and mobile_phone_number when the provider sends them |
raw_attributes | object | The SCIM user resource as received from the provider |
organization.directory.user_created
{ "spec_version": "1", "id": "evt_53891546994442316", "type": "organization.directory.user_created", "occurred_at": "2025-01-06T18:44:25.153954Z", "environment_id": "env_53814739859406915", "organization_id": "org_53879494091473415", "object": "DirectoryUser", "data": { "active": true, "custom_attributes": { "mobile_phone_number": "+1-555-0101" }, "department": "Engineering", "dp_id": "00u1a2b3c4d5e6f7g8h9", "email": "john.doe@acmecorp.com", "employee_id": "E1234", "family_name": "Doe", "given_name": "John", "groups": [ { "id": "dirgroup_53891546960887900", "name": "Engineering" } ], "id": "diruser_53891546960887884", "locale": "en-US", "name": "John Doe", "organization_id": "org_53879494091473415", "phone_number": "+1-555-0100", "preferred_username": "john.doe@acmecorp.com", "raw_attributes": { "active": true, "externalId": "00u1a2b3c4d5e6f7g8h9", "userName": "john.doe@acmecorp.com" }, "roles": [ { "role_name": "billing_admin" } ], "title": "Software Engineer", "zoneinfo": "America/New_York" }}organization.directory.user_updated
{ "spec_version": "1", "id": "evt_53891546994442317", "type": "organization.directory.user_updated", "occurred_at": "2025-01-06T18:44:25.153954Z", "environment_id": "env_53814739859406915", "organization_id": "org_53879494091473415", "object": "DirectoryUser", "data": { "active": true, "custom_attributes": { "mobile_phone_number": "+1-555-0101" }, "department": "Engineering", "dp_id": "00u1a2b3c4d5e6f7g8h9", "email": "john.doe@acmecorp.com", "employee_id": "E1234", "family_name": "Doe", "given_name": "John", "groups": [ { "id": "dirgroup_53891546960887900", "name": "Engineering" } ], "id": "diruser_53891546960887884", "locale": "en-US", "name": "John Doe", "organization_id": "org_53879494091473415", "phone_number": "+1-555-0100", "preferred_username": "john.doe@acmecorp.com", "raw_attributes": { "active": true, "externalId": "00u1a2b3c4d5e6f7g8h9", "userName": "john.doe@acmecorp.com" }, "roles": [ { "role_name": "billing_admin" } ], "title": "Senior Software Engineer", "zoneinfo": "America/New_York" }}organization.directory.user_deleted
This example is a deactivated user, so active is false.
{ "spec_version": "1", "id": "evt_53891546994442318", "type": "organization.directory.user_deleted", "occurred_at": "2025-01-06T18:44:25.153954Z", "environment_id": "env_53814739859406915", "organization_id": "org_53879494091473415", "object": "DirectoryUser", "data": { "active": false, "custom_attributes": { "mobile_phone_number": "+1-555-0101" }, "department": "Engineering", "dp_id": "00u1a2b3c4d5e6f7g8h9", "email": "john.doe@acmecorp.com", "employee_id": "E1234", "family_name": "Doe", "given_name": "John", "groups": [ { "id": "dirgroup_53891546960887900", "name": "Engineering" } ], "id": "diruser_53891546960887884", "locale": "en-US", "name": "John Doe", "organization_id": "org_53879494091473415", "phone_number": "+1-555-0100", "preferred_username": "john.doe@acmecorp.com", "raw_attributes": { "active": false, "externalId": "00u1a2b3c4d5e6f7g8h9", "userName": "john.doe@acmecorp.com" }, "roles": [ { "role_name": "billing_admin" } ], "title": "Software Engineer", "zoneinfo": "America/New_York" }}Directory group events
All three group events send the same group object in data. Every key is sent, even when its value is null.
| Field | Type | Description |
|---|---|---|
id | string | Directory group ID, prefixed with dirgroup_ |
organization_id | string | Organization the group belongs to |
directory_id | string | Directory the group belongs to |
display_name | string | Group display name |
dp_id | string or null | The group’s externalId from the provider. null if the provider doesn’t send one |
raw_attributes | object or null | The SCIM group resource as received from the provider |
organization.directory.group_created
{ "spec_version": "1", "id": "evt_38862741515010639", "type": "organization.directory.group_created", "occurred_at": "2024-09-25T02:26:39.036398577Z", "environment_id": "env_32080745237316098", "organization_id": "org_38609339635728478", "object": "DirectoryGroup", "data": { "directory_id": "dir_38610496391217780", "display_name": "Engineering", "dp_id": "00g1a2b3c4d5e6f7g8h9", "id": "dirgroup_38862741498233423", "organization_id": "org_38609339635728478", "raw_attributes": { "displayName": "Engineering", "externalId": "00g1a2b3c4d5e6f7g8h9" } }}organization.directory.group_updated
{ "spec_version": "1", "id": "evt_38864948910162368", "type": "organization.directory.group_updated", "occurred_at": "2024-09-25T02:48:34.745030921Z", "environment_id": "env_32080745237316098", "organization_id": "org_38609339635728478", "object": "DirectoryGroup", "data": { "directory_id": "dir_38610496391217780", "display_name": "Platform Engineering", "dp_id": "00g1a2b3c4d5e6f7g8h9", "id": "dirgroup_38862741498233423", "organization_id": "org_38609339635728478", "raw_attributes": { "displayName": "Platform Engineering", "externalId": "00g1a2b3c4d5e6f7g8h9" } }}organization.directory.group_deleted
{ "spec_version": "1", "id": "evt_40650399597723966", "type": "organization.directory.group_deleted", "occurred_at": "2024-10-07T10:25:26.289331747Z", "environment_id": "env_12205603854221623", "organization_id": "org_39802449573184223", "object": "DirectoryGroup", "data": { "directory_id": "dir_39802485862301855", "display_name": "Admins", "dp_id": "7c66a173-79c6-4270-ac78-8f35a8121e0a", "id": "dirgroup_40072007005503806", "organization_id": "org_39802449573184223", "raw_attributes": {} }}