Modify existing event configuration with backwards compatibility.
Edit Audit Log event schemas to update targets and metadata definitions. WorkOS uses versioning to ensure backwards compatibility – when you modify an existing schema, a new version is created rather than overwriting the existing one.
Navigate to the Audit Logs configuration page in the WorkOS Dashboard. Locate the event you want to modify and click the “Edit Event” item under the context menu.

Edit both the targets associated with the event and, optionally, the metadata JSON schema. Click save to create a new version of the event schema.

Provide the version field when emitting an event so that WorkOS knows which schema version to use for validation.
import { WorkOS } from '@workos-inc/node'; const workos = new WorkOS('sk_example_123456789'); await workos.auditLogs.createEvent('org_01EHWNCE74X7JSDV0X3SZ3KJNY', { action: 'user.signed_in', version: 2, occurredAt: new Date(), actor: { type: 'user', id: 'user_01GBNJC3MX9ZZJW1FSTF4C5938', }, targets: [ { type: 'team', id: 'team_01GBNJD4MKHVKJGEWK42JNMBGS', }, { type: 'resource', id: 'resource_01GBTAX2J37BAMB2D8GYDR2CC6', }, ], context: { location: '123.123.123.123', userAgent: 'Chrome/104.0.0.0', }, });