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

Session events

Events emitted when AuthKit sessions are changed.

On this page

  • Session created
  • Session revoked

Events emitted when AuthKit sessions are created.

Session created

Event name: session.created

Triggered when a session is created. Sessions started using impersonation will include an additional impersonator field with data about the impersonator.

Session created event
JSON
{
"event": "session.created",
"id": "event_04FKJ843CVE8F7BXQSPFH0M53V",
"data": {
"object": "session",
"id": "session_01HSCBECW0D7AY8CA45AYKA64G",
"user_id": "user_01HQGXWZW8BSHRG3HVK2QF7XBX",
"organization_id": "org_01HQHCBRRAVQ7N3PX81VKAYXSX",
"impersonator": {
"email": "admin@example.com",
"reason": "Helping a customer fix an issue with their account."
},
"ip_address": "192.0.2.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"created_at": "2024-03-19T21:56:25.080Z",
"updated_at": "2024-03-19T21:56:25.080Z"
},
"created_at": "2024-03-19T21:56:25.080Z",
"context": {
"client_id": "client_123456789"
}
}

Session revoked

Event name: session.revoked

Triggered when an issued session is revoked for a user.

Session revoked event
JSON
{
"event": "session.revoked",
"id": "event_04FKJ843CVE8F7BXQSPFH0M53B",
"data": {
"object": "session",
"id": "session_01HSCBECW0D7AY8CA45AYKA64G",
"user_id": "user_01HQGXWZW8BSHRG3HVK2QF7XBX",
"organization_id": "org_01HQHCBRRAVQ7N3PX81VKAYXSX",
"impersonator": {
"email": "admin@example.com",
"reason": "Helping a customer fix an issue with their account."
},
"ip_address": "192.0.2.1",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"created_at": "2024-03-19T21:56:25.080Z",
"updated_at": "2024-03-19T21:56:25.080Z"
},
"created_at": "2024-03-19T21:56:25.080Z",
"context": {
"client_id": "client_123456789"
}
}
© WorkOS, Inc.
FeaturesAuthKitSingle Sign-OnDirectory SyncAdmin PortalFine-Grained Authorization
DevelopersDocumentationChangelogAPI Status
ResourcesBlogPodcastPricingSecuritySupport
CompanyAboutCustomersCareersLegalPrivacy
© WorkOS, Inc.