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.
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
Headers
Section titled “Headers”
Minor version; defaults to the environment’s pin.OhAuthCat-Versionstring
Honoured for 24 h; a replay returns the original response.Idempotency-Keystringmin length 1 · max length 255
Request body
Section titled “Request body”
Lowercase dotted words, e.g.actionstring Requireduser.signed_in.max length 128
actorAuditLogSchemaActortargetsarray of AuditLogSchemaTarget Requiredmin items 1 · max items 50
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).metadataAuditLogJSONSchema
Responses
Section titled “Responses”- 201 The new schema version. AuditLogSchema
- 400 Invalid request. Codes: parameter_invalid, parameter_missing, version_unsupported and resource-specific codes from the catalogue. Error
- 401 Codes: authentication_required, api_key_invalid. Error
- 403 Codes: api_key_scope_missing, ip_not_allowed, plan_limit_reached. Error
- 429 Code: rate_limited. Retry-After is set. Error
- 503 Code: service_unavailable. Retry-After is set; writes are paused. Error
- default Any other error, including internal_error. Every code is in the error catalogue. Error
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" } } ]}'const response = await fetch("https://api.ohauthcat.com/v1/audit_log_schemas", { method: "POST", headers: { Authorization: `Bearer ${process.env.OHAUTHCAT_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ "action": "user.signed_in", "targets": [ { "type": "default", "metadata": { "plan": "enterprise" } } ] }),});const data = await response.json();import osimport requests
response = requests.post( "https://api.ohauthcat.com/v1/audit_log_schemas", headers={"Authorization": f"Bearer {os.environ['OHAUTHCAT_API_KEY']}"}, json={ "action": "user.signed_in", "targets": [ { "type": "default", "metadata": { "plan": "enterprise", }, }, ], },)data = response.json(){ "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"}