---
title: "POST /GetQueryState"
method: POST
path: "/GetQueryState"
---

# POST /GetQueryState

`POST /GetQueryState`

Returns the state of a query previously submitted. Clients are expected to poll <code>GetQueryState</code> to monitor the current state of the planning before retrieving the work units. A query state is only visible to the principal that made the initial call to <code>StartQueryPlanning</code>.

## Request body

- object
  - `QueryId` string, required — The ID of the plan query operation.

## Response `200`

Success

- GetQueryStateResponse — A structure for the output.
  - `Error` string — An error message when the operation fails.
  - `State` 'PENDING' | 'WORKUNITS_AVAILABLE' | 'ERROR' | 'FINISHED' | 'EXPIRED', required — <p>The state of a query previously submitted. The possible states are:</p> <ul> <li> <p>PENDING: the query is pending.</p> </li> <li> <p>WORKUNITS_AVAILABLE: some work units are ready for retrieval and execution.</p> </li> <li> <p>FINISHED: the query planning finished successfully, and all work units are ready for retrieval and execution.</p> </li> <li> <p>ERROR: an error occurred with the query, such as an invalid query ID or a backend error.</p> </li> </ul>

## Other responses

- `480` — InternalServiceException
- `481` — InvalidInputException
- `482` — AccessDeniedException

---

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