---
title: "POST /#X-Amz-Target=AmazonAthena.GetQueryResults"
method: POST
path: "/#X-Amz-Target=AmazonAthena.GetQueryResults"
---

# POST /#X-Amz-Target=AmazonAthena.GetQueryResults

`POST /#X-Amz-Target=AmazonAthena.GetQueryResults`

Streams the results of a single query execution specified by `QueryExecutionId` from the Athena query results location in Amazon S3. For more information, see [Working with query results, recent queries, and output files](https://docs.aws.amazon.com/athena/latest/ug/querying.html) in the _Amazon Athena User Guide_. This request does not execute the query but returns results. Use StartQueryExecution to run a query.

To stream query results successfully, the IAM principal with permission to call `GetQueryResults` also must have permissions to the Amazon S3 `GetObject` action for the Athena query results location.

IAM principals with permission to the Amazon S3 `GetObject` action for the query results location are able to retrieve query results from Amazon S3 even if permission to the `GetQueryResults` action is denied. To restrict user or role access, ensure that Amazon S3 permissions to the Athena query location are denied.

## Query parameters

- `MaxResults` string
- `NextToken` string

## Headers

- `X-Amz-Target` 'AmazonAthena.GetQueryResults', required

## Request body

- GetQueryResultsInput
  - `QueryExecutionId` string, required — The unique ID of the query execution.
  - `NextToken` string — A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the <code>NextToken</code> from the response object of the previous page call.
  - `MaxResults` integer — The maximum number of results (rows) to return in this request.

## Response `200`

Success

- GetQueryResultsOutput
  - `UpdateCount` integer — The number of rows inserted with a <code>CREATE TABLE AS SELECT</code> statement.
  - `ResultSet` object — The results of the query execution.
    - `Rows` Row[] — The rows in the table.
      - `Data` Datum[] — The data that populates a row in a query result table.
        - `VarCharValue` string — The value of the datum.
    - `ResultSetMetadata` object — The metadata that describes the column structure and data types of a table of query results.
      - `ColumnInfo` ColumnInfo[] — Information about the columns returned in a query result metadata.
        - `CatalogName` string — The catalog to which the query results belong.
        - `SchemaName` string — The schema name (database name) to which the query results belong.
        - `TableName` string — The table name for the query results.
        - `Name` string, required — The name of the column.
        - `Label` string — A column label.
        - `Type` string, required — The data type of the column.
        - `Precision` integer — For <code>DECIMAL</code> data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.
        - `Scale` integer — For <code>DECIMAL</code> data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.
        - `Nullable` 'NOT_NULL' | 'NULLABLE' | 'UNKNOWN' — Indicates the column's nullable status.
        - `CaseSensitive` boolean — Indicates whether values in the column are case-sensitive.
  - `NextToken` string — A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the <code>NextToken</code> from the response object of the previous page call.

## Other responses

- `480` — InternalServerException
- `481` — InvalidRequestException
- `482` — TooManyRequestsException

---

[API](https://skmtc.net/aws/apis/athena.md) · [All operations](https://skmtc.net/aws/apis/athena/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/athena/versions/0aec8c61283d/schema)
