title: Audit Log Entry
type: object
x-tags:
  - Models
description: An immutable record of an audited action associated with a merchant.
required:
  - uuid
  - event_type
  - description
  - actor
  - origin
  - targets
  - created_at
properties:
  uuid:
    type: string
    format: uuid
    readOnly: true
    description: The audit log entry's unique identifier.
  event_type:
    $ref: ./AuditLogEventType.yaml
  description:
    type:
      - string
      - 'null'
    minLength: 1
    readOnly: true
    description: Optional human-readable context for the recorded action.
  actor:
    type:
      - object
      - 'null'
    readOnly: true
    description: The principal that performed the action, or `null` when no actor was recorded.
    required:
      - type
      - identifier
      - display_name
    properties:
      type:
        type: string
        enum:
          - user
          - kiosk
          - oauth_client
        description: The kind of principal that performed the action.
      identifier:
        type: string
        format: uuid
        description: The actor's unique identifier.
      display_name:
        type:
          - string
          - 'null'
        minLength: 1
        description: The actor's display name at the time of the action, when available.
  origin:
    type:
      - object
      - 'null'
    readOnly: true
    description: Request context associated with the action, or `null` when no origin was recorded.
    required:
      - type
      - ip_address
      - user_agent
      - request_id
    properties:
      type:
        type: string
        enum:
          - api
        description: The channel through which the action originated.
      ip_address:
        type:
          - string
          - 'null'
        minLength: 1
        description: The source IP address, when available.
      user_agent:
        type:
          - string
          - 'null'
        minLength: 1
        description: The source user agent, when available.
      request_id:
        type:
          - string
          - 'null'
        minLength: 1
        description: The request correlation identifier, when available.
  targets:
    type: array
    readOnly: true
    description: The resources affected by the recorded action.
    items:
      type: object
      required:
        - uuid
        - type
        - display_name
        - changes
      properties:
        uuid:
          type: string
          format: uuid
          description: The affected resource's unique identifier.
        type:
          type: string
          enum:
            - axs_online_integration
            - customer
            - customer_tier
            - kiosk
            - loyalty_program
            - loyalty_balance_operation
            - media
            - merchant
            - marketing_campaign
            - message_automation
            - message_template
            - oauth_client
            - outlet
            - staff_member
            - staff_member_invitation
            - whatsapp_integration
          description: |-
            The kind of resource affected by the action.

            This disambiguates the target UUID and describes how the target should be interpreted.
        display_name:
          type:
            - string
            - 'null'
          minLength: 1
          description: The affected resource's display name at the time of the action, when available.
        changes:
          type:
            - object
            - 'null'
          readOnly: true
          description: |-
            Attribute changes recorded for the target, or `null` when the event does not represent an update.

            Each property is an audited attribute containing its value before and after the action.
          additionalProperties:
            type: object
            required:
              - before
              - after
            properties:
              before: {}
              after: {}
  created_at:
    type: string
    format: date-time
    readOnly: true
    description: The UTC date-time at which the action was recorded.
