{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.caracal.run/schemas/caracal-audit-event-2026-05-21.schema.json",
  "title": "Caracal Audit Event",
  "description": "Canonical audit event payload published to caracal.audit.events and stored in the audit ledger.",
  "type": "object",
  "required": ["id", "zone_id", "event_type", "request_id", "decision", "evaluation_status", "determining_policies_json", "diagnostics_json", "occurred_at"],
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1
    },
    "zone_id": {
      "type": "string",
      "minLength": 1
    },
    "event_type": {
      "type": "string",
      "minLength": 1
    },
    "request_id": {
      "type": "string",
      "minLength": 1
    },
    "decision": {
      "enum": ["allow", "deny"]
    },
    "policy_set_id": {
      "type": "string"
    },
    "policy_set_version_id": {
      "type": "string"
    },
    "manifest_sha": {
      "type": "string"
    },
    "evaluation_status": {
      "type": "string",
      "minLength": 1
    },
    "determining_policies_json": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "diagnostics_json": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "metadata_json": {
      "type": "object",
      "additionalProperties": true
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": true
}
