Amazon Redshift Statement Execution API

Execute SQL statements against Amazon Redshift clusters or serverless workgroups

GitHub OpenAPI

Operations 2

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /#BatchExecuteStatement Run several SQL statements at once · Batch Execute Statement #
Ask an LLM
“How do I run a batch of SQL statements in a single transaction?”
“Can I pass parameters to every statement in a batch?”
Tell an agent
Run these SQL statements in one batch: {sql}.
Run {sql} in a batch on cluster {cluster} as user {user}.
POST /#ExecuteStatement Run one SQL statement · Execute Statement #
Ask an LLM
“How do I run a single SQL statement against a Redshift cluster?”
“Can I wait for a statement to finish before getting results back?”
Tell an agent
Run this SQL statement: {sql}.
Execute {sql} on cluster {cluster} and wait {wait} seconds.

Documentation

Specifications

Schemas & Data

Other Resources

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-redshift:amazon-redshift-statement-execution-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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

amazon-redshift-statement-execution-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amazon Redshift Statement Execution API
  version: '2012-12-01'
  description: Generated from AWS's published Smithy model for Amazon Redshift. 2 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://redshift-data.{region}.amazonaws.com
  variables:
    region:
      default: us-east-1
security:
- sigv4: []
paths:
  /#BatchExecuteStatement:
    post:
      operationId: BatchExecuteStatement
      summary: Batch Execute Statement
      description: 'Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language
        (DDL). Depending on the authorization method, use one of the following combinations of request parameters: Secrets
        Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username
        and password. The specified secret contains credentials to connect to the database you specify. When you are connecting
        to a cluster, you also supply the database name, If you provide a cluster identifier (dbClusterIdentifier), it must
        match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply
        the database name. Temporary credentials - when connecting to your data warehouse, choose one of the following options:
        When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is
        derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also,
        permission to call the redshift-serverless:GetCredentials operation is required. When connecting to a cluster as an
        IAM identity, specify the cluster id'
      responses:
        '200':
          description: Success
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/BatchExecuteStatementOutput'
        '400':
          description: ActiveSessionsExceededException; ActiveStatementsExceededException; ValidationException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ActiveSessionsExceededException'
        '500':
          description: BatchExecuteStatementException; InternalServerException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/BatchExecuteStatementException'
        '404':
          description: ResourceNotFoundException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ResourceNotFoundException'
      parameters:
      - name: X-Amz-Target
        in: header
        required: true
        schema:
          type: string
          enum:
          - RedshiftData.BatchExecuteStatement
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/BatchExecuteStatementInput'
      tags:
      - Statement Execution
  /#ExecuteStatement:
    post:
      operationId: ExecuteStatement
      summary: Execute Statement
      description: 'Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL).
        This statement must be a single SQL statement. Depending on the authorization method, use one of the following combinations
        of request parameters: Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in
        Secrets Manager which has username and password. The specified secret contains credentials to connect to the database
        you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier
        (dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless
        workgroup, you also supply the database name. Temporary credentials - when connecting to your data warehouse, choose
        one of the following options: When connecting to a serverless workgroup, specify the workgroup name and database name.
        The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database
        user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required. When connecting
        to a cluster as an'
      responses:
        '200':
          description: Success
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ExecuteStatementOutput'
        '400':
          description: ActiveSessionsExceededException; ActiveStatementsExceededException; ValidationException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ActiveSessionsExceededException'
        '500':
          description: ExecuteStatementException; InternalServerException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ExecuteStatementException'
        '404':
          description: ResourceNotFoundException
          content:
            application/x-amz-json-1.1:
              schema:
                $ref: '#/components/schemas/ResourceNotFoundException'
      parameters:
      - name: X-Amz-Target
        in: header
        required: true
        schema:
          type: string
          enum:
          - RedshiftData.ExecuteStatement
      requestBody:
        required: true
        content:
          application/x-amz-json-1.1:
            schema:
              $ref: '#/components/schemas/ExecuteStatementInput'
      tags:
      - Statement Execution
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: redshift-data
  schemas:
    ActiveSessionsExceededException:
      type: object
      properties:
        Message:
          type: string
    BatchExecuteStatementException:
      type: object
      properties:
        Message:
          type: string
        StatementId:
          type: string
          description: Statement identifier of the exception.
      required:
      - Message
      - StatementId
    BatchExecuteStatementInput:
      type: object
      properties:
        Sqls:
          type: array
          items:
            type: string
          description: One or more SQL statements to run. The SQL statements run serially in the order of the array. Subsequent
            SQL statements don't start until the previous statement in the array completes. By default, the SQL statements
            are run as a single transaction. If any SQL statement fails, all work is rolled back. To change this behavior,
            see the ExecutionMode parameter.
        ClusterIdentifier:
          type: string
          description: The cluster identifier. This parameter is required when connecting to a cluster and authenticating
            using either Secrets Manager or temporary credentials.
        SecretArn:
          type: string
          description: The name or ARN of the secret that enables access to the database. This parameter is required when
            authenticating using Secrets Manager.
        DbUser:
          type: string
          description: The database user name. This parameter is required when connecting to a cluster as a database user
            and authenticating using temporary credentials.
        Database:
          type: string
          description: The name of the database. This parameter is required when authenticating using either Secrets Manager
            or temporary credentials.
        WithEvent:
          type: boolean
          description: A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements
            run.
        StatementName:
          type: string
          description: The name of the SQL statements. You can name the SQL statements when you create them to identify the
            query.
        Parameters:
          type: array
          items:
            $ref: '#/components/schemas/SqlParameter'
          description: The parameters for the SQL statements. The parameters are available to all SQL statements in the batch.
            Each statement can reference any subset of the provided parameters. Each provided parameter must be referenced
            by at least one SQL statement in the batch.
        WorkgroupName:
          type: string
          description: The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting
            to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        ClientToken:
          type: string
          description: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
        ResultFormat:
          type: string
          description: The data format of the result of the SQL statement. If no format is specified, the default is JSON.
        SessionKeepAliveSeconds:
          type: integer
          description: The number of seconds to keep the session alive after the query finishes. The maximum time a session
            can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
        SessionId:
          type: string
          description: The session identifier of the query.
        ExecutionMode:
          type: string
          description: Determines how the SQL statements in the batch are run. If set to TRANSACTION (the default), all SQL
            statements are run as a single transaction and they are committed or rolled back together. If set to AUTO_COMMIT,
            each SQL statement is committed individually, and a failure of one statement does not affect the others.
        WaitTimeSeconds:
          type: integer
          description: The number of seconds to wait for all SQL statements in the batch to complete execution before returning
            the response. If the SQL statements do not complete within the specified time, the response returns the current
            status. The maximum value is 30 seconds.
      required:
      - Sqls
    BatchExecuteStatementOutput:
      type: object
      properties:
        Id:
          type: string
          description: The identifier of the SQL statement whose results are to be fetched. This value is a universally unique
            identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by BatchExecuteStatment.
        CreatedAt:
          type: string
          description: The date and time (UTC) the statement was created.
        ClusterIdentifier:
          type: string
          description: The cluster identifier. This element is not returned when connecting to a serverless workgroup.
        DbUser:
          type: string
          description: The database user name.
        DbGroups:
          type: array
          items:
            type: string
          description: A list of colon (:) separated names of database groups.
        Database:
          type: string
          description: The name of the database.
        SecretArn:
          type: string
          description: The name or ARN of the secret that enables access to the database.
        WorkgroupName:
          type: string
          description: The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting
            to a provisioned cluster.
        SessionId:
          type: string
          description: The session identifier of the query.
        Status:
          type: string
          description: 'The status of the SQL statement. Status values are defined as follows: ABORTED - The query run was
            stopped by the user. FAILED - The query run failed. FINISHED - The query has finished running. PICKED - The query
            has been chosen to be run. STARTED - The query run has started. SUBMITTED - The query was submitted, but not yet
            processed.'
        RedshiftPid:
          type: integer
          description: The process identifier from Amazon Redshift.
        HasResultSet:
          type: boolean
          description: A value that indicates whether the statement has a result set. The result set can be empty. The value
            is true for an empty result set. The value is true if any substatement returns a result set.
    ExecuteStatementException:
      type: object
      properties:
        Message:
          type: string
          description: The exception message.
        StatementId:
          type: string
          description: Statement identifier of the exception.
      required:
      - Message
      - StatementId
    ExecuteStatementInput:
      type: object
      properties:
        Sql:
          type: string
          description: The SQL statement text to run.
        ClusterIdentifier:
          type: string
          description: The cluster identifier. This parameter is required when connecting to a cluster and authenticating
            using either Secrets Manager or temporary credentials.
        SecretArn:
          type: string
          description: The name or ARN of the secret that enables access to the database. This parameter is required when
            authenticating using Secrets Manager.
        DbUser:
          type: string
          description: The database user name. This parameter is required when connecting to a cluster as a database user
            and authenticating using temporary credentials.
        Database:
          type: string
          description: The name of the database. This parameter is required when authenticating using either Secrets Manager
            or temporary credentials.
        WithEvent:
          type: boolean
          description: A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement
            runs.
        StatementName:
          type: string
          description: The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
        Parameters:
          type: array
          items:
            $ref: '#/components/schemas/SqlParameter'
          description: The parameters for the SQL statement.
        WorkgroupName:
          type: string
          description: The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting
            to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
        ClientToken:
          type: string
          description: A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
        ResultFormat:
          type: string
          description: The data format of the result of the SQL statement. If no format is specified, the default is JSON.
        SessionKeepAliveSeconds:
          type: integer
          description: The number of seconds to keep the session alive after the query finishes. The maximum time a session
            can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
        SessionId:
          type: string
          description: The session identifier of the query.
        WaitTimeSeconds:
          type: integer
          description: The number of seconds to wait for the SQL statement to complete execution before returning the response.
            If the SQL statement does not complete within the specified time, the response returns the current status. The
            maximum value is 30 seconds.
      required:
      - Sql
    ExecuteStatementOutput:
      type: object
      properties:
        Id:
          type: string
          description: The identifier of the SQL statement whose results are to be fetched. This value is a universally unique
            identifier (UUID) generated by Amazon Redshift Data API.
        CreatedAt:
          type: string
          description: The date and time (UTC) the statement was created.
        ClusterIdentifier:
          type: string
          description: The cluster identifier. This element is not returned when connecting to a serverless workgroup.
        DbUser:
          type: string
          description: The database user name.
        DbGroups:
          type: array
          items:
            type: string
          description: A list of colon (:) separated names of database groups.
        Database:
          type: string
          description: The name of the database.
        SecretArn:
          type: string
          description: The name or ARN of the secret that enables access to the database.
        WorkgroupName:
          type: string
          description: The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting
            to a provisioned cluster.
        SessionId:
          type: string
          description: The session identifier of the query.
        Status:
          type: string
          description: 'The status of the SQL statement. Status values are defined as follows: ABORTED - The query run was
            stopped by the user. FAILED - The query run failed. FINISHED - The query has finished running. PICKED - The query
            has been chosen to be run. STARTED - The query run has started. SUBMITTED - The query was submitted, but not yet
            processed.'
        RedshiftPid:
          type: integer
          description: The process identifier from Amazon Redshift.
        HasResultSet:
          type: boolean
          description: A value that indicates whether the statement has a result set. The result set can be empty. The value
            is true for an empty result set.
    ResourceNotFoundException:
      type: object
      properties:
        Message:
          type: string
          description: The exception message.
        ResourceId:
          type: string
          description: Resource identifier associated with the exception.
      required:
      - Message
      - ResourceId
    SqlParameter:
      type: object
      properties:
        name:
          type: string
          description: The name of the parameter.
        value:
          type: string
          description: The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information,
            see Data types in the Amazon Redshift Database Developer Guide.
      required:
      - name
      - value
x-provenance:
  method: harvested
  publisher: Amazon Web Services
  source: https://raw.githubusercontent.com/aws/api-models-aws/3cd98287b471c106254abd89279cc87308d38bfd/models/redshift-data/service/2019-12-20/redshift-data-2019-12-20.json
  note: converted by smithy-to-openapi.py from AWS's Smithy model (roadmap#1001)