Amazon CloudWatch Cloudwatch Query Definition API

The Cloudwatch Query Definition API from Amazon CloudWatch — 3 operation(s) for cloudwatch query definition.

GitHub OpenAPI

Operations 3

POST /#DeleteQueryDefinition Delete Query Definition #
POST /#DescribeQueryDefinitions Describe Query Definitions #
POST /#PutQueryDefinition Put Query Definition #

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/amazon-cloudwatch:amazon-cloudwatch-query-definition-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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

amazon-cloudwatch-query-definition-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amazon CloudWatch Query Definition API
  version: '2010-08-01'
  description: Generated from AWS's published Smithy model for Amazon CloudWatch. 3 operation(s).
  contact:
    name: Amazon Web Services
    url: https://aws.amazon.com/contact-us/
  license:
    name: Apache 2.0
    identifier: Apache-2.0
    url: https://github.com/aws/api-models-aws/blob/main/LICENSE
servers:
- url: https://logs.{region}.amazonaws.com
  variables:
    region:
      default: us-east-1
security:
- sigv4: []
paths:
  /#DeleteQueryDefinition:
    post:
      operationId: DeleteQueryDefinition
      summary: Delete Query Definition
      description: Deletes a saved CloudWatch Logs Insights query definition. A query definition contains details about a
        saved CloudWatch Logs Insights query. Each DeleteQueryDefinition operation can delete one query definition. You must
        have the logs:DeleteQueryDefinition permission to be able to perform this operation.
      responses:
        '200':
          description: Success
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/DeleteQueryDefinitionResponse'
        '400':
          description: InvalidParameterException; ResourceNotFoundException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/InvalidParameterException'
        '500':
          description: ServiceUnavailableException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableException'
      parameters:
      - name: X-Amz-Target
        in: header
        required: true
        schema:
          type: string
          enum:
          - Logs_20140328.DeleteQueryDefinition
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/DeleteQueryDefinitionRequest'
      tags:
      - Query Definition
  /#DescribeQueryDefinitions:
    post:
      operationId: DescribeQueryDefinitions
      summary: Describe Query Definitions
      description: This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can
        retrieve query definitions from the current account or from a source account that is linked to the current account.
        You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names
        that start with a certain string.
      responses:
        '200':
          description: Success
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/DescribeQueryDefinitionsResponse'
        '400':
          description: InvalidParameterException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/InvalidParameterException'
        '500':
          description: ServiceUnavailableException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableException'
      parameters:
      - name: X-Amz-Target
        in: header
        required: true
        schema:
          type: string
          enum:
          - Logs_20140328.DescribeQueryDefinitions
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/DescribeQueryDefinitionsRequest'
      tags:
      - Query Definition
  /#PutQueryDefinition:
    post:
      operationId: PutQueryDefinition
      summary: Put Query Definition
      description: Creates or updates a query definition for CloudWatch Logs Insights. For more information, see Analyzing
        Log Data with CloudWatch Logs Insights. To update a query definition, specify its queryDefinitionId in your request.
        The values of name, queryString, and logGroupNames are changed to the values that you specify in your update operation.
        No current values are retained from the current query definition. For example, imagine updating a current query definition
        that includes log groups. If you don't specify the logGroupNames parameter in your update operation, the query definition
        changes to contain no log groups. You must have the logs:PutQueryDefinition permission to be able to perform this
        operation.
      responses:
        '200':
          description: Success
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/PutQueryDefinitionResponse'
        '400':
          description: InvalidParameterException; LimitExceededException; ResourceNotFoundException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/InvalidParameterException'
        '500':
          description: ServiceUnavailableException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableException'
      parameters:
      - name: X-Amz-Target
        in: header
        required: true
        schema:
          type: string
          enum:
          - Logs_20140328.PutQueryDefinition
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/PutQueryDefinitionRequest'
      tags:
      - Query Definition
components:
  securitySchemes:
    sigv4:
      type: apiKey
      in: header
      name: Authorization
      description: AWS Signature Version 4. The Authorization header carries an AWS4-HMAC-SHA256 signature over the canonical
        request, with X-Amz-Date (and X-Amz-Security-Token for temporary credentials). Not a bearer token.
      x-aws-sigv4:
        signingName: logs
  schemas:
    DeleteQueryDefinitionRequest:
      type: object
      properties:
        queryDefinitionId:
          type: string
          description: The ID of the query definition that you want to delete. You can use DescribeQueryDefinitions to retrieve
            the IDs of your saved query definitions.
      required:
      - queryDefinitionId
    DeleteQueryDefinitionResponse:
      type: object
      properties:
        success:
          type: boolean
          description: A value of TRUE indicates that the operation succeeded. FALSE indicates that the operation failed.
    DescribeQueryDefinitionsRequest:
      type: object
      properties:
        queryLanguage:
          type: string
          enum:
          - CWLI
          - SQL
          - PPL
          description: The query language used for this query. For more information about the query languages that CloudWatch
            Logs supports, see Supported query languages.
        queryDefinitionNamePrefix:
          type: string
          description: Use this parameter to filter your results to only the query definitions that have names that start
            with the prefix you specify.
        maxResults:
          type: integer
          description: Limits the number of returned query definitions to the specified number.
        nextToken:
          type: string
    DescribeQueryDefinitionsResponse:
      type: object
      properties:
        queryDefinitions:
          type: array
          items:
            $ref: '#/components/schemas/QueryDefinition'
          description: The list of query definitions that match your request.
        nextToken:
          type: string
    InvalidParameterException:
      type: object
      properties:
        message:
          type: string
    PutQueryDefinitionRequest:
      type: object
      properties:
        queryLanguage:
          type: string
          enum:
          - CWLI
          - SQL
          - PPL
          description: Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL,
            and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see Supported
            query languages.
        name:
          type: string
          description: A name for the query definition. If you are saving numerous query definitions, we recommend that you
            name them. This way, you can find the ones you want by using the first part of the name as a filter in the queryDefinitionNamePrefix
            parameter of DescribeQueryDefinitions.
        queryDefinitionId:
          type: string
          description: If you are updating a query definition, use this parameter to specify the ID of the query definition
            that you want to update. You can use DescribeQueryDefinitions to retrieve the IDs of your saved query definitions.
            If you are creating a query definition, do not specify this parameter. CloudWatch generates a unique ID for the
            new query definition and include it in the response to this operation.
        logGroupNames:
          type: array
          items:
            type: string
          description: Use this parameter to include specific log groups as part of your query definition. If your query uses
            the OpenSearch Service query language, you specify the log group names inside the querystring instead of here.
            If you are updating an existing query definition for the Logs Insights QL or OpenSearch Service PPL and you omit
            this parameter, then the updated definition will contain no log groups.
        queryString:
          type: string
          description: The query string to use for this definition. For more information, see CloudWatch Logs Insights Query
            Syntax.
        clientToken:
          type: string
          description: Used as an idempotency token, to avoid returning an exception if the service receives the same request
            twice because of a network error.
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/QueryParameter'
          description: Use this parameter to include specific query parameters as part of your query definition. Query parameters
            are supported only for Logs Insights QL queries. Query parameters allow you to use placeholder variables in your
            query string that are substituted with values at execution time. Use the {{parameterName}} syntax in your query
            string to reference a parameter.
      required:
      - name
      - queryString
    PutQueryDefinitionResponse:
      type: object
      properties:
        queryDefinitionId:
          type: string
          description: The ID of the query definition.
    QueryDefinition:
      type: object
      properties:
        queryLanguage:
          type: string
          enum:
          - CWLI
          - SQL
          - PPL
          description: The query language used for this query. For more information about the query languages that CloudWatch
            Logs supports, see Supported query languages.
        queryDefinitionId:
          type: string
          description: The unique ID of the query definition.
        name:
          type: string
          description: The name of the query definition.
        queryString:
          type: string
          description: The query string to use for this definition. For more information, see CloudWatch Logs Insights Query
            Syntax.
        lastModified:
          type: integer
          description: The date that the query definition was most recently modified.
        logGroupNames:
          type: array
          items:
            type: string
          description: If this query definition contains a list of log groups that it is limited to, that list appears here.
        parameters:
          type: array
          items:
            $ref: '#/components/schemas/QueryParameter'
          description: If this query definition contains a list of query parameters that define placeholder variables for
            the query string, that list appears here.
    QueryParameter:
      type: object
      properties:
        name:
          type: string
          description: The name of the query parameter. A query parameter name must start with a letter or underscore, and
            contain only letters, digits, and underscores.
        defaultValue:
          type: string
          description: The default value to use for this query parameter if no value is supplied at execution time.
        description:
          type: string
          description: A description of the query parameter that explains its purpose or expected values.
      required:
      - name
    ServiceUnavailableException:
      type: object
      properties:
        message:
          type: string
x-provenance:
  method: harvested
  publisher: Amazon Web Services
  source: https://raw.githubusercontent.com/aws/api-models-aws/3cd98287b471c106254abd89279cc87308d38bfd/models/cloudwatch-logs/service/2014-03-28/cloudwatch-logs-2014-03-28.json
  note: converted by smithy-to-openapi.py from AWS's Smithy model (roadmap#1001)