Events represent activity that has occurred within WorkOS or within third-party identity and directory providers. They are used to keep your app in sync with WorkOS data. For more details on consuming events in your app, check out the data syncing guide.
Refer to the Events page for a full list of events that WorkOS emits.
List events for the current environment.
curl "https://api.workos.com/events" \ --header "Authorization: Bearer sk_example_123456789"
{ "object": "list", "data": [ { "object": "event", "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", "event": "dsync.user.created", "data": { "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", "state": "active", "email": "veda@foo-corp.com", "emails": [ { "primary": true, "type": "work", "value": "veda@foo-corp.com" } ], "idp_id": "2836", "object": "directory_user", "username": "veda@foo-corp.com", "last_name": "Torp", "first_name": "Veda", "raw_attributes": {}, "custom_attributes": {}, "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": {} } ], "list_metadata": { "after": "event_01EHZNVPK3SFK441A1RGBFSHRT" } }
| curl "https://api.workos.com/events" \ | |
| --header "Authorization: Bearer sk_example_123456789" |
| import { WorkOS } from '@workos-inc/node'; | |
| const workos = new WorkOS(process.env.WORKOS_API_KEY); | |
| const listOfEvents = await workos.events.listEvents({ | |
| events: [ | |
| 'dsync.activated', | |
| 'dsync.deleted', | |
| 'dsync.user.created', | |
| 'dsync.user.updated', | |
| 'dsync.user.deleted', | |
| ], | |
| }); |
| require "workos" | |
| events = WorkOS::Events.list_events( | |
| events: [ | |
| "dsync.activated", | |
| "dsync.deleted", | |
| "dsync.user.created", | |
| "dsync.user.updated", | |
| "dsync.user.deleted" | |
| ] | |
| ) |
| from workos import WorkOSClient | |
| workos_client = WorkOSClient( | |
| api_key="sk_example_123456789", client_id="client_123456789" | |
| ) | |
| events = workos_client.events.list_events( | |
| events=[ | |
| "dsync.activated", | |
| "dsync.deleted", | |
| "dsync.user.created", | |
| "dsync.user.updated", | |
| "dsync.user.deleted", | |
| ], | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "github.com/workos/workos-go/v3/pkg/events" | |
| ) | |
| func main() { | |
| events.SetAPIKey(os.Getenv("WORKOS_API_KEY")) | |
| var events = []string{ | |
| "dsync.activated", | |
| "dsync.deleted", | |
| "dsync.user.created", | |
| "dsync.user.updated", | |
| "dsync.user.deleted", | |
| } | |
| events, err := events.ListEvents(ctx.Background(), events.ListEventsOpts{ | |
| Event: events, | |
| }) | |
| if err != nil { | |
| fmt.Println(message) | |
| } | |
| } |
| { | |
| "object": "list", | |
| "data": [ | |
| { | |
| "object": "event", | |
| "id": "event_01EHZNVPK3SFK441A1RGBFSHRT", | |
| "event": "dsync.user.created", | |
| "data": { | |
| "id": "directory_user_01E1JG7J09H96KYP8HM9B0G5SJ", | |
| "directory_id": "directory_01ECAZ4NV9QMV47GW873HDCX74", | |
| "organization_id": "org_01EZTR6WYX1A0DSE2CYMGXQ24Y", | |
| "state": "active", | |
| "email": "veda@foo-corp.com", | |
| "emails": [ | |
| { | |
| "primary": true, | |
| "type": "work", | |
| "value": "veda@foo-corp.com" | |
| } | |
| ], | |
| "idp_id": "2836", | |
| "object": "directory_user", | |
| "username": "veda@foo-corp.com", | |
| "last_name": "Torp", | |
| "first_name": "Veda", | |
| "raw_attributes": {}, | |
| "custom_attributes": {}, | |
| "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": {} | |
| } | |
| ], | |
| "list_metadata": { | |
| "after": "event_01EHZNVPK3SFK441A1RGBFSHRT" | |
| } | |
| } |
GET/eventsParameters Returns object