{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/rivery/main/json-schema/rivery-audit-events-response-schema.json",
  "title": "AuditEventsResponse",
  "description": "Audit events response",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rivery-openapi.json#/components/schemas/AuditEventsResponse",
  "properties": {
    "event_id": {
      "type": "string",
      "title": "Event Id",
      "description": "The id of the audit event"
    },
    "event_initiator": {
      "type": "string",
      "title": "Event Initiator",
      "description": "Where the event was initiated"
    },
    "event_datetime": {
      "type": "string",
      "title": "Event Datetime",
      "description": "The event date time in UTC timezone"
    },
    "event_type": {
      "allOf": [
        {
          "$ref": "#/$defs/AuditEventTypeEnum"
        }
      ],
      "description": "The type of the event"
    },
    "event_result_status": {
      "type": "integer",
      "title": "Event Result Status",
      "description": "The status of the API request of the event"
    },
    "event_name": {
      "type": "string",
      "title": "Event Name",
      "description": "The name of the event in the following format-event_type:entity_type:additional_info"
    },
    "entity_type": {
      "allOf": [
        {
          "$ref": "#/$defs/AuditEntityTypeEnum"
        }
      ],
      "description": "The type of entity that was recorded"
    },
    "entity_logical_key": {
      "type": "string",
      "title": "Entity Logical Key",
      "default": "A unique logical identifier of an entity, usually the cross_id"
    },
    "account_id": {
      "type": "string",
      "title": "Account Id",
      "description": "The account id the event originated for"
    },
    "environment_id": {
      "type": "string",
      "title": "Environment Id",
      "description": "The environment id the event originated for"
    },
    "user_id": {
      "type": "string",
      "title": "User Id",
      "description": "The user id the event originated for"
    },
    "user_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "User Name",
      "description": "The name of the user that originated the event"
    },
    "entity_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Entity Name",
      "description": "The name of the event entity, this could be the name of the river, connection etc."
    },
    "entity_subtype": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Entity Subtype",
      "description": "The even subtype, this could be a river classification like logic or s2t rivers"
    },
    "additional_info": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Additional Info",
      "default": "Additional information saved for the event"
    }
  },
  "type": "object",
  "required": [
    "event_id",
    "event_initiator",
    "event_datetime",
    "event_type",
    "event_result_status",
    "event_name",
    "entity_type",
    "account_id",
    "environment_id",
    "user_id"
  ],
  "$defs": {
    "AuditEntityTypeEnum": {
      "type": "string",
      "enum": [
        "accounts",
        "connections",
        "rivers",
        "river_groups",
        "users",
        "teams"
      ],
      "title": "AuditEntityTypeEnum",
      "description": "The audit event entity types"
    },
    "AuditEventTypeEnum": {
      "type": "string",
      "enum": [
        "create",
        "recover",
        "delete",
        "update",
        "initiate_activate_river",
        "initiate_disable_river",
        "edit_cdc_configuration",
        "delete_cdc_configuration"
      ],
      "title": "AuditEventTypeEnum",
      "description": "The audit events, events type"
    }
  }
}