{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cogram-com/json-schema/cogram-com-audit-log-list-v1-schema.json",
  "title": "AuditLogListV1",
  "description": "Paginated audit log response.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cogram-com-audit-log-api-openapi.yml#/components/schemas/AuditLogListV1",
  "properties": {
    "data": {
      "items": {
        "$ref": "#/$defs/AuditLogEntryV1"
      },
      "type": "array",
      "title": "Data"
    },
    "total": {
      "type": "integer",
      "title": "Total",
      "description": "Total matches across all pages, not just this page."
    },
    "page": {
      "type": "integer",
      "title": "Page"
    },
    "page_size": {
      "type": "integer",
      "title": "Page Size"
    }
  },
  "type": "object",
  "required": [
    "data",
    "total",
    "page",
    "page_size"
  ],
  "$defs": {
    "AuditAction": {
      "type": "string",
      "enum": [
        "DELETED",
        "CONTENT_REDACTED"
      ],
      "title": "AuditAction",
      "description": "What happened to the record."
    },
    "AuditEntityType": {
      "type": "string",
      "enum": [
        "EMAIL",
        "MEETING"
      ],
      "title": "AuditEntityType",
      "description": "The kind of record an audit row is about."
    },
    "AuditLogEntryV1": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id",
          "description": "Unique, increasing in the order the entries were written. Breaks ties between entries with the same `occurred_at`."
        },
        "organization_id": {
          "type": "string",
          "title": "Organization Id"
        },
        "entity_type": {
          "$ref": "#/$defs/AuditEntityType",
          "description": "The kind of record: `EMAIL` or `MEETING`."
        },
        "entity_id": {
          "type": "string",
          "title": "Entity Id",
          "description": "The record's Cogram id. A deleted email no longer exists; a meeting whose content was redacted still does."
        },
        "action": {
          "$ref": "#/$defs/AuditAction",
          "description": "`DELETED`: the record is gone. `CONTENT_REDACTED`: its content is gone, and the record stays as a visible shell."
        },
        "reason": {
          "$ref": "#/$defs/AuditReason",
          "description": "Why it was removed."
        },
        "project_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Project Id",
          "description": "The project the record was in when it was removed."
        },
        "actor_user_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "Actor User Id",
          "description": "The user who triggered the removal; null for a system event."
        },
        "occurred_at": {
          "type": "string",
          "format": "date-time",
          "title": "Occurred At"
        },
        "context": {
          "anyOf": [
            {
              "$ref": "#/$defs/EmailAuditContextV1"
            },
            {
              "$ref": "#/$defs/MeetingAuditContextV1"
            },
            {
              "type": "null"
            }
          ],
          "title": "Context",
          "description": "Email rows: the email's identifiers and retention facts. Meeting rows: the raw deletion reason for reason `OTHER`, otherwise null."
        }
      },
      "type": "object",
      "required": [
        "id",
        "organization_id",
        "entity_type",
        "entity_id",
        "action",
        "reason",
        "project_id",
        "actor_user_id",
        "occurred_at",
        "context"
      ],
      "title": "AuditLogEntryV1",
      "description": "One record, or its content, that Cogram removed."
    },
    "AuditReason": {
      "type": "string",
      "enum": [
        "USER_DELETE",
        "BULK_UNFILE",
        "DUPLICATE_REMOVED",
        "PROJECT_DELETED",
        "MANUAL_PURGE",
        "RETENTION_EXPIRY",
        "USER_OFFBOARDED",
        "OTHER"
      ],
      "title": "AuditReason",
      "description": "Why the record or its content was removed."
    },
    "EmailAuditContextV1": {
      "properties": {
        "internet_message_id": {
          "type": "string",
          "title": "Internet Message Id",
          "description": "The email's RFC 5322 Message-ID. Match it against your mail server or archive."
        },
        "sent_at": {
          "type": "string",
          "format": "date-time",
          "title": "Sent At"
        },
        "retention_class": {
          "anyOf": [
            {
              "$ref": "#/$defs/RetentionClass"
            },
            {
              "type": "null"
            }
          ],
          "description": "The email's retention class, or null when the organization uses no email retention ruleset."
        },
        "ruleset": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Ruleset",
          "description": "The email retention ruleset the organization used when the email was removed, or null."
        }
      },
      "type": "object",
      "required": [
        "internet_message_id",
        "sent_at",
        "retention_class",
        "ruleset"
      ],
      "title": "EmailAuditContext",
      "description": "What identifies a removed email outside Cogram. Never any content."
    },
    "MeetingAuditContextV1": {
      "properties": {
        "meeting_deletion_reason": {
          "type": "string",
          "title": "Meeting Deletion Reason",
          "description": "The meeting's raw deletion reason, e.g. `CALENDAR_CANCELLATION`."
        }
      },
      "type": "object",
      "required": [
        "meeting_deletion_reason"
      ],
      "title": "MeetingAuditContext",
      "description": "Why the system deleted a meeting. Set only for reason `OTHER`."
    },
    "RetentionClass": {
      "type": "string",
      "enum": [
        "SHORT",
        "ARCHIVE"
      ],
      "title": "RetentionClass",
      "description": "The retention class an email retention ruleset gives an email. The\nruleset maps each class to a duration; an email without a class\n(NULL) never expires."
    }
  }
}