WorkOS Docs Homepage
Audit Logs

Metadata Schema

Define strict JSON Schema for validating event metadata.

Audit Log Events can contain arbitrary metadata for adding additional details to your events. Normally this data can take any shape. However, custom metadata schemas can be defined when configuring the event for additional type safety and data consistency. When an event is emitted that does not match the provided schema, an error will be returned.

When first creating an event schema, check the “Require metadata schema validation” checkbox. You will then be navigated to the schema editor where you can modify the underlying JSON Schema for all metadata objects.

There are metadata objects located at the root of the event, and within actor and targets objects. Each can contain a unique JSON Schema.

Metadata objects have a limit of 50 keys. Key names can be up to 40 characters long, and values can be up to 500 characters long.

Event with metadata