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.

A screenshot showing how to require metadata schema validation in the WorkOS Dashboard.

There are metadata objects located at the root of the event, and within actor and targets objects. Each can contain a unique JSON Schema. To add to a metadata object, click the "+" sign.

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.

A screenshot showing the schema editor in the WorkOS Dashboard.
Event with metadata