{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/orq/json-schema/orq-query-audit-logs-request-schema.json",
  "title": "QueryAuditLogsRequest",
  "description": "Request body for querying audit logs in the authenticated workspace.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/orq-audit-logs-api-openapi.yml#/components/schemas/QueryAuditLogsRequest",
  "required": [
    "filters",
    "pagination"
  ],
  "type": "object",
  "properties": {
    "filters": {
      "$ref": "#/$defs/AuditLogFilterQuery"
    },
    "pagination": {
      "$ref": "#/$defs/AuditLogPagination"
    },
    "sorting": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AuditLogSort"
      },
      "description": "Sort expressions. Defaults to audit_log_id descending when omitted."
    }
  },
  "$defs": {
    "AuditLogFilter": {
      "required": [
        "type",
        "path",
        "operator",
        "value"
      ],
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "Filter value type, such as string, date, number, boolean, or array."
        },
        "path": {
          "type": "string",
          "description": "Audit log field path to filter on. Supported paths include created_at, entity_id, entity_type, action, actor_id, origin, and metadata.display_name."
        },
        "operator": {
          "type": "string",
          "description": "Filter operator supported by the selected field type."
        },
        "value": {
          "$ref": "#/$defs/JsonValue"
        }
      },
      "description": "A single advanced filter applied to audit logs."
    },
    "AuditLogFilterQuery": {
      "required": [
        "operator",
        "filters"
      ],
      "type": "object",
      "properties": {
        "search": {
          "type": "string",
          "description": "Optional text search applied to supported display fields."
        },
        "operator": {
          "type": "string",
          "description": "Logical operator used to combine filters."
        },
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AuditLogFilter"
          },
          "description": "Advanced filters applied to the query."
        }
      },
      "description": "Search and advanced filters for querying audit logs."
    },
    "AuditLogPagination": {
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer",
          "description": "Maximum number of audit logs to return. Defaults to 50 when omitted.",
          "format": "int32"
        },
        "starting_after": {
          "type": "string",
          "description": "Cursor for the next page. Use the last audit_log_id from the previous page."
        },
        "ending_before": {
          "type": "string",
          "description": "Cursor for the previous page. Use the first audit_log_id from the current page."
        }
      },
      "description": "Cursor pagination settings for audit log queries."
    },
    "AuditLogSort": {
      "required": [
        "key"
      ],
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Audit log field to sort by. Supported keys include _id, created_at, entity_type, entity_id, action, and actor_id."
        },
        "direction": {
          "type": "string",
          "description": "Sort direction. Defaults to desc when omitted or invalid."
        }
      },
      "description": "A sort expression for audit log queries."
    },
    "JsonValue": {
      "description": "Represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values."
    }
  }
}