Skip to content
Dashboard
Theme
Theme

Record an audit event for one of your customers' organizations

POST /v1/audit_log_events: Record an audit event for one of your customers' organizations.

View Markdown

POST /v1/audit_log_events

Audit Logs product. The event is validated against its action’s schema (audit_log_schema_not_found when the action has none) and stored for the plan’s retention (7 days Free, 90 days Pro, 1 year Business, configurable on Enterprise). With an Idempotency-Key the event is recorded once per organization and key; a replay returns the original event, the same key with a different event answers idempotency_key_reused. Bounds 50 targets, 50 metadata keys per object (keys up to 40 characters, values up to 500), occurred_at at most 5 minutes ahead and 1 year back. Accepted events also reach the environment’s log stream destinations and the organization’s own portal destinations (action, actor, targets; never names, metadata or context).

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

  • organization_id string Required

  • event AuditLogEventInput Required

Errors share one shape; see the error code catalogue.

curl -X POST \
"https://api.ohauthcat.com/v1/audit_log_events" \
-H "Authorization: Bearer $OHAUTHCAT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"event": {
"action": "user.signed_in",
"occurred_at": "2026-01-15T09:30:00Z",
"version": 1,
"actor": {
"type": "default",
"id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"metadata": {
"plan": "enterprise"
}
},
"targets": [
{
"type": "default",
"id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"metadata": {
"plan": "enterprise"
}
}
],
"context": {
"location": "example_location",
"user_agent": "example_user_agent"
},
"metadata": {
"plan": "enterprise"
}
}
}'
Response 201
{
"object": "audit_log_event",
"id": "ale_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"organization_id": "org_01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"action": "user.signed_in",
"version": 1,
"occurred_at": "2026-01-15T09:30:00Z",
"created_at": "2026-01-15T09:30:00Z",
"actor": {
"type": "default",
"id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"metadata": {
"plan": "enterprise"
}
},
"targets": [
{
"type": "default",
"id": "01J9Z3K5V7W8X9Y0Z1A2B3C4D5",
"name": "Acme Corp",
"metadata": {
"plan": "enterprise"
}
}
],
"context": {
"location": "example_location",
"user_agent": "example_user_agent"
},
"metadata": {
"plan": "enterprise"
}
}