{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-cloudtrail/json-schema/amazon-cloudtrail-describe-query-response-schema.json",
  "title": "DescribeQueryResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-cloudtrail-query-api-openapi.yml#/components/schemas/DescribeQueryResponse",
  "type": "object",
  "properties": {
    "QueryId": {
      "type": "string",
      "description": "The ID of the query."
    },
    "QueryString": {
      "type": "string",
      "description": "The SQL code of a query."
    },
    "QueryStatus": {
      "type": "string",
      "enum": [
        "QUEUED",
        "RUNNING",
        "FINISHED",
        "FAILED",
        "CANCELLED",
        "TIMED_OUT"
      ],
      "description": "The status of a query. Values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED"
    },
    "QueryStatistics": {
      "$ref": "#/$defs/QueryStatisticsForDescribeQuery"
    },
    "ErrorMessage": {
      "type": "string",
      "description": "The error message returned if a query failed."
    },
    "DeliveryS3Uri": {
      "type": "string",
      "description": "The URI for the S3 bucket where CloudTrail delivered query results, if applicable."
    },
    "DeliveryStatus": {
      "type": "string",
      "enum": [
        "SUCCESS",
        "FAILED",
        "FAILED_SIGNING_FILE",
        "PENDING",
        "RESOURCE_NOT_FOUND",
        "ACCESS_DENIED",
        "ACCESS_DENIED_SIGNING_FILE",
        "CANCELLED",
        "UNKNOWN"
      ],
      "description": "The delivery status."
    },
    "Prompt": {
      "type": "string",
      "description": "The prompt used for a generated query. For information about generated queries, see Create CloudTrail Lake queries from natural language prompts in the CloudTrail user guide."
    },
    "EventDataStoreOwnerAccountId": {
      "type": "string",
      "description": "The account ID of the event data store owner."
    }
  },
  "$defs": {
    "QueryStatisticsForDescribeQuery": {
      "type": "object",
      "properties": {
        "EventsMatched": {
          "type": "integer",
          "description": "The number of events that matched a query."
        },
        "EventsScanned": {
          "type": "integer",
          "description": "The number of events that the query scanned in the event data store."
        },
        "BytesScanned": {
          "type": "integer",
          "description": "The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running."
        },
        "ExecutionTimeInMillis": {
          "type": "integer",
          "description": "The query's run time, in milliseconds."
        },
        "CreationTime": {
          "type": "string",
          "format": "date-time",
          "description": "The creation time of the query."
        }
      }
    }
  }
}