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

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

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

Returns information about a single query. Requires that you have access to the workgroup in which the query was saved.

## Headers

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

## Request body

- GetNamedQueryInput
  - `NamedQueryId` string, required — The unique ID of the query. Use <a>ListNamedQueries</a> to get query IDs.

## Response `200`

Success

- GetNamedQueryOutput
  - `NamedQuery` object — Information about the query.
    - `Name` string, required — The query name.
    - `Description` string — The query description.
    - `Database` string, required — The database to which the query belongs.
    - `QueryString` string, required — The SQL statements that make up the query.
    - `NamedQueryId` string — The unique identifier of the query.
    - `WorkGroup` string — The name of the workgroup that contains the named query.

## Other responses

- `480` — InternalServerException
- `481` — InvalidRequestException

---

[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)
