CloudQuery queries API

The queries API from CloudQuery — 11 operation(s) for queries.

Operations 14

GET /queries #
POST /queries/check-syntax #
POST /queries/columns #
POST /queries/execute #
POST /queries/save #
GET /queries/tags #
GET /queries/{query_id} #
PATCH /queries/{query_id} #
DELETE /queries/{query_id} #
POST /queries/{query_id}/execute #
GET /queries/{query_id}/filters #
POST /queries/{query_id}/filters #
GET /queries/{query_id}/filters/tags #
GET /tables/{table_name}/filters/tags #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudquery-queries-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudquery-queries-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    email: support@cloudquery.io
    name: CloudQuery Support Team
    url: https://cloudquery.io
  description: 'Welcome to the CloudQuery Platform API documentation! This API can be used to interact with the CloudQuery platform. As a user, the API allows you to search the CloudQuery asset inventory, run SQL queries against the data warehouse, save and load searches, and much more. As an administrator, it allows you to manage your teams, syncs, and other objects.

    ### Authentication

    The API is secured using bearer tokens. To get started, you can generate an API key for your Platform deployment from your platform dashboard. For a step-by-step guide, see: https://www.cloudquery.io/docs/cli/managing-cloudquery/deployments/generate-api-key.

    The base URL for the API depends on where your CloudQuery Platform is hosted. If running locally, this is usually http://localhost:3000/api. In a production deployment it should be an HTTPS URL. For purposes of illustration, we will assume the platform instance is available at https://cloudquery.mycompany.com. In this case, the base API endpoint will be https://cloudquery.mycompany.com/api.

    ### Example Request

    To test your connection to the API, we can use the `/plugins` endpoint. For example:

    `curl -v -H "Authorization: Bearer $CLOUDQUERY_API_KEY" \ https://cloudquery.mycompany.com/api/plugins`

    '
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT
  termsOfService: https://www.cloudquery.io/terms
  title: CloudQuery Platform OpenAPI Spec admin Queries API
  version: 1.0.0
servers:
- url: https://api.cloudquery.io
  description: Base URL declared by the provider in apis.yml (roadmap#122).
security:
- bearerAuth: []
- cookieAuth: []
tags:
- name: queries
paths:
  /queries:
    get:
      description: List all queries
      operationId: PlatformListAllQueries
      parameters:
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      - $ref: '#/components/parameters/platform_query_tags'
      - $ref: '#/components/parameters/platform_query_name_filter'
      - $ref: '#/components/parameters/platform_query_filter'
      - $ref: '#/components/parameters/platform_alert_configured'
      - $ref: '#/components/parameters/platform_alert_message_filter'
      - $ref: '#/components/parameters/platform_alert_enabled'
      - $ref: '#/components/parameters/platform_query_column_filter'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - items
                - metadata
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/PlatformQuery'
                    type: array
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/check-syntax:
    post:
      description: 'Validate the syntax of a ClickHouse SQL query without executing it. Returns 200 if the syntax is valid, or 400 with an error message if not.

        '
      operationId: PlatformCheckQuerySyntax
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - query
              properties:
                query:
                  type: string
                  description: The SQL query to validate
                  example: SELECT account_id, instance_id FROM aws_ec2_instance WHERE instance_type = 't2.micro'
      responses:
        '200':
          description: Query syntax is valid
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/columns:
    post:
      description: 'Return the list of output column names a SELECT query would produce, without executing it. Columns from `SELECT *` are resolved against the referenced table schemas. Returns 400 if the query cannot be parsed or is not a SELECT.

        '
      operationId: PlatformGetQueryColumns
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - query
              properties:
                query:
                  type: string
                  description: The SQL query to inspect
                  example: SELECT _cq_platform_id, account_id, instance_id FROM aws_ec2_instance WHERE instance_type = 't2.micro'
      responses:
        '200':
          description: Column names the query would produce
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformQueryColumns'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/execute:
    post:
      description: 'Run an ad-hoc SQL query against any table.

        Further filtering can optionally be applied on top of the raw SQL results using the optional parameters. Filtering can be useful in situations where a saved query needs to be further filtered, grouped or paginated, such as in dashboards or reports.

        '
      operationId: PlatformExecuteAdHocQuery
      parameters:
      - $ref: '#/components/parameters/platform_table_selects'
      - $ref: '#/components/parameters/platform_table_filter_mode'
      - $ref: '#/components/parameters/platform_table_filters'
      - $ref: '#/components/parameters/platform_table_filter_ids'
      - $ref: '#/components/parameters/platform_table_sort_bys'
      - $ref: '#/components/parameters/platform_table_sort_dirs'
      - $ref: '#/components/parameters/platform_table_group_bys'
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - query
              properties:
                query:
                  type: string
                  example: SELECT account_id, instance_id, instance_type, region, name, tags FROM aws_ec2_instance WHERE instance_type = 't2.micro'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - data
                - metadata
                properties:
                  data:
                    $ref: '#/components/schemas/PlatformTableData'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/save:
    post:
      description: Save a query to execute later
      operationId: PlatformSaveQuery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlatformQueryCreate'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformQueryDetail'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/tags:
    get:
      description: List Query Tags
      operationId: PlatformListQueryTags
      parameters:
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - items
                - metadata
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/PlatformQueryTag'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/{query_id}:
    get:
      description: Get a saved query
      operationId: PlatformGetSavedQuery
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformQueryDetail'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
    patch:
      description: Update a saved query
      operationId: PlatformUpdateQuery
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlatformQueryUpdate'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformQueryDetail'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
    delete:
      description: Delete a saved query
      operationId: PlatformDeleteSavedQuery
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      responses:
        '204':
          description: Success
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/{query_id}/execute:
    post:
      description: Execute a saved query
      operationId: PlatformExecuteSavedQuery
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      - $ref: '#/components/parameters/platform_table_selects'
      - $ref: '#/components/parameters/platform_table_filter_mode'
      - $ref: '#/components/parameters/platform_table_filters'
      - $ref: '#/components/parameters/platform_table_filter_ids'
      - $ref: '#/components/parameters/platform_table_sort_bys'
      - $ref: '#/components/parameters/platform_table_sort_dirs'
      - $ref: '#/components/parameters/platform_table_group_bys'
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - data
                - metadata
                properties:
                  data:
                    $ref: '#/components/schemas/PlatformTableData'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/{query_id}/filters:
    get:
      description: List Query Filters
      operationId: PlatformQueryListFilters
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      - $ref: '#/components/parameters/platform_filter_tags'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - items
                - metadata
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/PlatformFilter'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
    post:
      description: Save Query Filter
      operationId: PlatformQuerySaveFilter
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlatformFilterCreate'
      responses:
        '200':
          description: Filter already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformFilter'
        '201':
          description: Filter created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformFilter'
        '400':
          $ref: '#/components/responses/PlatformBadRequest'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /queries/{query_id}/filters/tags:
    get:
      description: List Filter Tags For A Saved Query
      operationId: PlatformQueryListFilterTags
      parameters:
      - $ref: '#/components/parameters/platform_query_id'
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - items
                - metadata
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/PlatformFilterTag'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
  /tables/{table_name}/filters/tags:
    get:
      description: List Filter Tags For A Table
      operationId: PlatformTableListFilterTags
      parameters:
      - $ref: '#/components/parameters/platform_table_name'
      - $ref: '#/components/parameters/platform_per_page'
      - $ref: '#/components/parameters/platform_page'
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                required:
                - items
                - metadata
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/PlatformFilterTag'
                  metadata:
                    $ref: '#/components/schemas/PlatformListMetadata'
        '401':
          $ref: '#/components/responses/PlatformRequiresAuthentication'
        '403':
          $ref: '#/components/responses/PlatformForbidden'
        '404':
          $ref: '#/components/responses/PlatformNotFound'
        '422':
          $ref: '#/components/responses/PlatformUnprocessableEntity'
        '500':
          $ref: '#/components/responses/PlatformInternalError'
      tags:
      - queries
components:
  schemas:
    PlatformFilter:
      title: Filter
      type: object
      description: Saved filter
      additionalProperties: false
      required:
      - id
      - name
      - expression
      - created_at
      properties:
        id:
          description: ID of the Filter
          type: string
          format: uuid
          example: 12345678-1234-1234-1234-1234567890ab
          x-go-name: ID
        name:
          type: string
          example: t2.micro EC2 instances
        expression:
          $ref: '#/components/schemas/PlatformFilterExpression'
        description:
          type: string
          example: Filter to find all EC2 instances of type t2.micro from the aws_ec2_instance raw table
        table:
          $ref: '#/components/schemas/PlatformTableName'
        query_id:
          $ref: '#/components/schemas/PlatformQueryID'
        user_id:
          $ref: '#/components/schemas/PlatformUserID'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformFilterTag'
          x-go-type-skip-optional-pointer: true
        created_at:
          example: '2017-07-14T16:53:42Z'
          format: date-time
          type: string
    PlatformTableSortBy:
      title: TableSortBy
      type: string
    PlatformQuery:
      title: Query
      type: object
      description: Saved query
      additionalProperties: false
      required:
      - id
      - name
      - query
      - created_at
      - alert_configured
      properties:
        id:
          $ref: '#/components/schemas/PlatformQueryID'
        name:
          type: string
          example: Find all t2.micro EC2 instances
        query:
          $ref: '#/components/schemas/PlatformQueryExpression'
        description:
          type: string
          example: Query to find all EC2 instances of type t2.micro from the aws_ec2_instance raw table
        user_id:
          $ref: '#/components/schemas/PlatformUserID'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformQueryTag'
          x-go-type-skip-optional-pointer: true
        columns:
          type: array
          items:
            type: string
          description: Columns returned by this query
          x-go-type-skip-optional-pointer: true
        created_at:
          example: '2017-07-14T16:53:42Z'
          format: date-time
          type: string
        alert_configured:
          type: boolean
          description: Indicates if the query has an alert configured
        alert:
          $ref: '#/components/schemas/PlatformAlert'
        view_name:
          $ref: '#/components/schemas/PlatformQueryViewName'
    PlatformTableGroupBy:
      title: TableGroupBy
      type: string
    PlatformFilterTag:
      description: A table column filter tag.
      type: string
    PlatformAlertState:
      type: string
      enum:
      - unknown
      - pending
      - inactive
      - triggered
    PlatformTableSortDirection:
      title: TableSortDirection
      type: string
      enum:
      - asc
      - desc
      default: asc
    PlatformQueryID:
      description: The unique ID for the query.
      type: string
      format: uuid
      x-go-name: QueryID
    PlatformTableData:
      additionalProperties: false
      properties:
        query:
          $ref: '#/components/schemas/PlatformQueryExpression'
        columns:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
            required:
            - name
            - type
        rows:
          type: array
          items:
            type: array
            items: {}
      required:
      - columns
      - rows
      title: TableData
      type: object
    PlatformListMetadata:
      required:
      - page_size
      properties:
        total_count:
          type: integer
        last_page:
          type: integer
        page_size:
          type: integer
        time_ms:
          type: integer
    PlatformTableSelect:
      title: TableSelect
      type: string
    PlatformNotificationDestinationID:
      description: The unique ID for the notification destination.
      type: string
      format: uuid
      x-go-name: NotificationDestinationID
    PlatformQueryExpression:
      title: QueryExpression
      type: string
      description: Query expression
      example: SELECT account_id, instance_id, instance_type, region, name, tags FROM aws_ec2_instance WHERE instance_type = 't2.micro'
    PlatformFilterCreate:
      title: Filter definition for creating a filter
      type: object
      description: Saved filter
      additionalProperties: false
      required:
      - name
      - expression
      properties:
        name:
          type: string
          example: t2.micro EC2 instances
        expression:
          $ref: '#/components/schemas/PlatformFilterExpression'
        public:
          type: boolean
          default: true
          x-omitempty: false
          x-go-type-skip-optional-pointer: true
          description: Whether the filter is visible to all users, or only to the user who created it
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformFilterTag'
          x-go-type-skip-optional-pointer: true
        description:
          type: string
          example: Filter to find all EC2 instances of type t2.micro from the aws_ec2_instance raw table
    PlatformAlertCreate:
      title: Alert Create
      type: object
      description: Create an alert
      additionalProperties: false
      required:
      - message
      - severity
      - enabled
      properties:
        message:
          type: string
          example: All resources need to be tagged
        severity:
          $ref: '#/components/schemas/PlatformAlertSeverity'
        enabled:
          type: boolean
          description: Indicates if the alert is enabled
        notification_destinations:
          type: array
          items:
            $ref: '#/components/schemas/PlatformNotificationDestinationID'
          description: List of notification destinations to send alerts to
          x-go-type-skip-optional-pointer: true
          allowEmptyValue: true
          explode: true
    PlatformAlertUpdate:
      title: Alert Update
      description: Alert Update Definition
      type: object
      properties:
        message:
          type: string
          example: All resources need to be tagged
        severity:
          $ref: '#/components/schemas/PlatformAlertSeverity'
        enabled:
          type: boolean
          description: Indicates if the alert is enabled
        notification_destinations:
          type: array
          items:
            $ref: '#/components/schemas/PlatformNotificationDestinationID'
          description: List of notification destinations to send alerts to
          allowEmptyValue: true
          explode: true
    PlatformQueryDetail:
      title: Query Detail
      type: object
      description: Query Detail
      additionalProperties: false
      required:
      - id
      - name
      - query
      - created_at
      - alert_configured
      properties:
        id:
          $ref: '#/components/schemas/PlatformQueryID'
        name:
          type: string
          example: Find all t2.micro EC2 instances
        query:
          $ref: '#/components/schemas/PlatformQueryExpression'
        description:
          type: string
          example: Query to find all EC2 instances of type t2.micro from the aws_ec2_instance raw table
        user_id:
          $ref: '#/components/schemas/PlatformUserID'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformQueryTag'
          x-go-type-skip-optional-pointer: true
        columns:
          type: array
          items:
            type: string
          description: Columns returned by this query
          x-go-type-skip-optional-pointer: true
        created_at:
          example: '2017-07-14T16:53:42Z'
          format: date-time
          type: string
        alert_configured:
          type: boolean
          description: Indicates if the query has an alert configured. When this is set, the alert field will be populated with the alert details.
        alert:
          $ref: '#/components/schemas/PlatformAlertDetail'
        view_name:
          $ref: '#/components/schemas/PlatformQueryViewName'
    PlatformQueryCreate:
      title: Query Create
      type: object
      description: Create a saved query
      additionalProperties: false
      required:
      - name
      - query
      properties:
        name:
          type: string
          example: Find all t2.micro EC2 instances
        query:
          type: string
          example: SELECT account_id, instance_id, instance_type, region, name, tags FROM aws_ec2_instance WHERE instance_type = 't2.micro'
        public:
          type: boolean
          default: true
          x-omitempty: false
          x-go-type-skip-optional-pointer: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformQueryTag'
          x-go-type-skip-optional-pointer: true
        description:
          type: string
          example: Query to find all EC2 instances of type t2.micro from the aws_ec2_instance raw table
        view_name:
          $ref: '#/components/schemas/PlatformQueryViewName'
        alert:
          $ref: '#/components/schemas/PlatformAlertCreate'
    PlatformUserID:
      description: ID of the User
      type: string
      format: uuid
      example: 12345678-1234-1234-1234-1234567890ab
      x-go-name: UserID
    PlatformAlert:
      title: Alert
      type: object
      description: An alert instance that can be triggered by a query
      additionalProperties: false
      required:
      - id
      - query_id
      - enabled
      - message
      - severity
      - state
      - total_violations
      - created_at
      - updated_at
      - num_destinations
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the alert
          x-go-name: ID
        query_id:
          type: string
          format: uuid
          description: Reference to the associated query
          x-go-name: QueryID
        enabled:
          type: boolean
          description: Indicates if the alert is enabled
        message:
          type: string
          description: Alert message content
        severity:
          $ref: '#/components/schemas/PlatformAlertSeverity'
        state:
          $ref: '#/components/schemas/PlatformAlertState'
        total_violations:
          type: integer
          format: int64
          description: Number of violations that triggered the alert
        last_evaluated_at:
          type: string
          format: date-time
          description: Timestamp when the alert was last evaluated
        triggered_at:
          type: string
          format: date-time
          description: Timestamp when the alert was triggered
        created_at:
          type: string
          format: date-time
          description: Timestamp when the alert was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the alert was last updated
        num_destinations:
          type: integer
          description: Number of notification destinations this alert is configured to send to
    PlatformQueryViewName:
      description: The name of the view the query is saved to in the warehouse
      type: string
      pattern: ^(saved_query_view_[a-zA-Z0-9_]+|)$
      x-pattern-message: can contain only alphanumerical characters and underscores. must start with `saved_query_view_`
    PlatformQueryUpdate:
      title: Query Update
      type: object
      description: Update a saved query
      additionalProperties: false
      properties:
        name:
          type: string
          example: Find all t2.micro EC2 instances
        query:
          type: string
          example: SELECT account_id, instance_id, instance_type, region, name, tags FROM aws_ec2_instances WHERE instance_type = 't2.micro'
        public:
          type: boolean
        tags:
          type: array
          items:
            $ref: '#/components/schemas/PlatformQueryTag'
        description:
          type: string
          example: Query to find all EC2 instances of type t2.micro from the aws_ec2_instances raw table
        view_name:
          $ref: '#/components/schemas/PlatformQueryViewName'
        alert:
          $ref: '#/components/schemas/PlatformAlertUpdate'
    PlatformQueryTag:
      description: A saved query tag.
      type: string
    PlatformFieldError:
      allOf:
      - $ref: '#/components/schemas/PlatformBasicError'
      - properties:
          errors:
            items:
              type: string
            type: array
          field_errors:
            additionalProperties:
     

# --- truncated at 32 KB (44 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/cloudquery/refs/heads/main/openapi/cloudquery-queries-api-openapi.yml