{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudtruth/json-schema/cloudtruth-audit-trail-schema.json",
  "title": "AuditTrail",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudtruth-audit-api-openapi.yml#/components/schemas/AuditTrail",
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "format": "uri",
      "readOnly": true
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true,
      "description": "A unique identifier for the audit record."
    },
    "action": {
      "type": "string",
      "readOnly": true,
      "description": "The action that was taken."
    },
    "object_id": {
      "type": "string",
      "readOnly": true,
      "description": "The id of the object associated with the action."
    },
    "object_name": {
      "type": "string",
      "readOnly": true,
      "description": "The name of the object associated with the action, if applicable."
    },
    "object_type": {
      "allOf": [
        {
          "$ref": "#/$defs/ObjectTypeEnum"
        }
      ],
      "readOnly": true,
      "description": "The type of object associated with the action.\n\n* `AwsIntegration` - AwsIntegration\n* `Environment` - Environment\n* `GitHubIntegration` - GitHubIntegration\n* `Grant` - Grant\n* `Invitation` - Invitation\n* `LogDestination` - LogDestination\n* `Membership` - Membership\n* `Organization` - Organization\n* `OrganizationSettings` - OrganizationSettings\n* `Parameter` - Parameter\n* `ParameterRule` - ParameterRule\n* `ParameterType` - ParameterType\n* `ParameterTypeRule` - ParameterTypeRule\n* `Project` - Project\n* `Pull` - Pull\n* `Push` - Push\n* `ServiceAccount` - ServiceAccount\n* `Tag` - Tag\n* `Task` - Task\n* `Template` - Template\n* `Value` - Value"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "description": "The timestamp of the activity that was audited."
    },
    "user": {
      "allOf": [
        {
          "$ref": "#/$defs/User"
        }
      ],
      "readOnly": true,
      "description": "Details of the user associated with this change."
    },
    "ip_address": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "The client IP address for the request that produced this record, if available."
    },
    "user_agent": {
      "type": "string",
      "readOnly": true,
      "description": "The User-Agent header for the request that produced this record, if available."
    },
    "request_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "readOnly": true,
      "description": "A correlation id for the request that produced this record (X-Request-ID or generated)."
    },
    "changed_fields": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "readOnly": true,
      "description": "Names of model fields that changed (update only). Field values are not stored to avoid leaking secret content."
    }
  },
  "required": [
    "action",
    "changed_fields",
    "id",
    "ip_address",
    "object_id",
    "object_name",
    "object_type",
    "request_id",
    "timestamp",
    "url",
    "user",
    "user_agent"
  ],
  "$defs": {
    "ObjectTypeEnum": {
      "enum": [
        "AwsIntegration",
        "Environment",
        "GitHubIntegration",
        "Grant",
        "Invitation",
        "LogDestination",
        "Membership",
        "Organization",
        "OrganizationSettings",
        "Parameter",
        "ParameterRule",
        "ParameterType",
        "ParameterTypeRule",
        "Project",
        "Pull",
        "Push",
        "ServiceAccount",
        "Tag",
        "Task",
        "Template",
        "Value"
      ],
      "type": "string",
      "description": "* `AwsIntegration` - AwsIntegration\n* `Environment` - Environment\n* `GitHubIntegration` - GitHubIntegration\n* `Grant` - Grant\n* `Invitation` - Invitation\n* `LogDestination` - LogDestination\n* `Membership` - Membership\n* `Organization` - Organization\n* `OrganizationSettings` - OrganizationSettings\n* `Parameter` - Parameter\n* `ParameterRule` - ParameterRule\n* `ParameterType` - ParameterType\n* `ParameterTypeRule` - ParameterTypeRule\n* `Project` - Project\n* `Pull` - Pull\n* `Push` - Push\n* `ServiceAccount` - ServiceAccount\n* `Tag` - Tag\n* `Task` - Task\n* `Template` - Template\n* `Value` - Value"
    },
    "User": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "readOnly": true
        },
        "id": {
          "type": "string",
          "description": "The unique identifier of a user.",
          "maxLength": 256
        },
        "type": {
          "type": "string",
          "description": "The type of user record.",
          "maxLength": 12
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "organization_name": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "The user's organization name."
        },
        "membership_id": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Membership identifier for user."
        },
        "chatgpt_threads": {
          "type": "object",
          "additionalProperties": {},
          "readOnly": true,
          "description": "The threads this user is participating in with ChatGPT."
        },
        "role": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "The user's role in the current organization (defined by the request authorization header)."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "picture_url": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "modified_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "readOnly": true
        }
      },
      "required": [
        "chatgpt_threads",
        "created_at",
        "email",
        "id",
        "membership_id",
        "modified_at",
        "name",
        "organization_name",
        "picture_url",
        "role",
        "url"
      ]
    }
  }
}