{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/timbrix-mx/json-schema/timbrix-mx-audit-log-item-dto-schema.json",
  "title": "AuditLogItemDto",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/timbrix-mx-openapi.yaml#/components/schemas/AuditLogItemDto",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "organizationId": {
      "type": "string"
    },
    "seq": {
      "type": "number",
      "description": "Consecutivo de la entrada en la organización"
    },
    "occurredAt": {
      "type": "string"
    },
    "action": {
      "type": "string",
      "enum": [
        "cfdi.stamped",
        "cfdi.stamp_failed",
        "cfdi.xml_downloaded",
        "cfdi.pdf_downloaded",
        "cfdi.cancellation_receipt_downloaded",
        "cfdi.emailed",
        "cancellation.requested",
        "cancellation.accepted",
        "cancellation.rejected",
        "cancellation.pending",
        "certificate.uploaded",
        "certificate.rotated",
        "certificate.deleted",
        "customer.created",
        "customer.updated",
        "customer.deleted",
        "product.created",
        "product.updated",
        "product.deleted",
        "product.imported",
        "organization.updated",
        "organization.legal_data_updated",
        "organization.branding_updated",
        "organization.closed",
        "organization.reopened",
        "organization.deleted",
        "organization.plan_changed",
        "member.invited",
        "member.invite_cancelled",
        "member.joined",
        "member.invite_declined",
        "member.role_changed",
        "member.removed",
        "api_key.created",
        "api_key.activated",
        "api_key.deactivated",
        "api_key.deleted",
        "webhook.created",
        "webhook.updated",
        "webhook.deleted",
        "oauth_app.created",
        "oauth_app.updated",
        "oauth_app.deleted",
        "report.exported",
        "audit_log.exported"
      ]
    },
    "result": {
      "type": "string",
      "enum": [
        "success",
        "failure"
      ]
    },
    "actorType": {
      "type": "string",
      "enum": [
        "user",
        "api_key",
        "system"
      ]
    },
    "actorUserId": {
      "type": [
        "object",
        "null"
      ]
    },
    "actorApiKeyId": {
      "type": [
        "object",
        "null"
      ]
    },
    "actorLabel": {
      "type": [
        "object",
        "null"
      ],
      "description": "Email de la persona, o nombre y preview de la llave"
    },
    "resourceType": {
      "type": "string",
      "enum": [
        "cfdi",
        "customer",
        "product",
        "certificate",
        "member",
        "api_key",
        "webhook",
        "oauth_app",
        "organization",
        "report",
        "audit_log"
      ]
    },
    "resourceId": {
      "type": [
        "object",
        "null"
      ]
    },
    "channel": {
      "type": [
        "object",
        "null"
      ]
    },
    "environment": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "production",
        "sandbox"
      ]
    },
    "ip": {
      "type": [
        "object",
        "null"
      ],
      "description": "IP observada por la API"
    },
    "clientIp": {
      "type": [
        "object",
        "null"
      ],
      "description": "IP reportada por el navegador (informativa, no verificada)"
    },
    "userAgent": {
      "type": [
        "object",
        "null"
      ]
    },
    "requestId": {
      "type": [
        "object",
        "null"
      ]
    },
    "changedFields": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "required": [
    "id",
    "organizationId",
    "seq",
    "occurredAt",
    "action",
    "result",
    "actorType",
    "resourceType",
    "metadata"
  ]
}