Skip to content
Dashboard
Theme
Theme

Register a new version of an action's audit event schema

POST /v1/audit_log_schemas: Register a new version of an action's audit event schema.

View Markdown

POST /v1/audit_log_schemas

Audit Logs product. Every event of an action is validated against a schema registered for that action (the version the event names, or the latest). A schema lists the target types an event may name and JSON Schemas (a bounded subset of draft 2020-12; other keywords answer parameter_invalid) for the actor’s, each target type’s and the event’s metadata. Registering again creates the next version; versions are never edited. At most 500 actions per environment.

Scope
audit_log_events:write
Auth
Secret key (sk_…)
Since
1.1
  • OhAuthCat-Version string

    Minor version; defaults to the environment’s pin.

  • Idempotency-Key string

    Honoured for 24 h; a replay returns the original response.

    min length 1 · max length 255

  • action string Required

    Lowercase dotted words, e.g. user.signed_in.

    max length 128

  • actor AuditLogSchemaActor

  • targets array of AuditLogSchemaTarget Required

    min items 1 · max items 50

  • metadata AuditLogJSONSchema

    A JSON Schema of the supported subset (type, properties, required, additionalProperties as a boolean, enum, const, minLength, maxLength, pattern, minimum, maximum, items, minItems, maxItems, $schema, title, description).

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/audit_log_schemas" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "user.signed_in",
"targets": [
{
"type": "default",
"metadata": {
"plan": "enterprise"
}
}
]
}'
Response 201
{
"object": "audit_log_schema",
"action": "user.signed_in",
"version": 1,
"actor": {
"metadata": {
"plan": "enterprise"
}
},
"targets": [
{
"type": "default",
"metadata": {
"plan": "enterprise"
}
}
],
"metadata": {
"plan": "enterprise"
},
"created_at": "2026-01-15T09:30:00Z"
}