Skip to main content

Overview

The Events API allows you to retrieve events that have occurred in your WorkOS environment. Events represent actions and state changes across all WorkOS services.

Methods

listEvents

Retrieves a list of events based on the provided filter criteria.
options
ListEventOptions
required
Configuration options for listing events
List<Event>
object
A paginated list of events

Example

import { WorkOS } from '@workos-inc/node';

const workos = new WorkOS('sk_example_123456789');

const events = await workos.events.listEvents({
  events: ['user.created', 'user.updated'],
  rangeStart: '2024-01-01T00:00:00Z',
  rangeEnd: '2024-12-31T23:59:59Z',
  limit: 20,
  organizationId: 'org_01H8Z9Q2Z3Y4X5W6V7U8T9S0R1',
});

console.log(events.data);

Response

{
  "data": [
    {
      "id": "event_01H8Z9Q2Z3Y4X5W6V7U8T9S0R1",
      "event": "user.created",
      "data": {
        "id": "user_01H8Z9Q2Z3Y4X5W6V7U8T9S0R1",
        "email": "[email protected]"
      },
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ],
  "listMetadata": {
    "after": "event_01H8Z9Q2Z3Y4X5W6V7U8T9S0R1",
    "before": null
  }
}

Webhooks

Configure webhooks to receive events in real-time

Audit Logs

Track security and compliance events

Build docs developers (and LLMs) love