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

# POST /generateQuery

`POST /generateQuery`

Generates an SQL query from a natural language query. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-generate-query.html">Generate a query for structured data</a> in the Amazon Bedrock User Guide.

## Request body

- object
  - `queryGenerationInput` object, required — Contains information about a natural language query to transform into SQL.
    - `text` string — The text of the query.
    - `type` 'TEXT' — The type of the query.
  - `transformationConfiguration` object, required — Contains configurations for transforming the natural language query into SQL.
    - `mode` 'TEXT_TO_SQL' — The mode of the transformation.
    - `textToSqlConfiguration` object — Specifies configurations for transforming text to SQL.
      - `knowledgeBaseConfiguration` object — Specifies configurations for a knowledge base to use in transformation.
        - `knowledgeBaseArn` string, required — The ARN of the knowledge base
      - `type` 'KNOWLEDGE_BASE', required — The type of resource to use in transformation.

## Response `200`

Success

- GenerateQueryResponse
  - `queries` GeneratedQuery[] — A list of objects, each of which defines a generated query that can correspond to the natural language queries.
    - `sql` string — An SQL query that corresponds to the natural language query.
    - `type` 'REDSHIFT_SQL' — The type of transformed query.

## Other responses

- `480` — ResourceNotFoundException
- `481` — ConflictException
- `482` — ValidationException
- `483` — InternalServerException
- `484` — DependencyFailedException
- `485` — BadGatewayException
- `486` — ThrottlingException
- `487` — AccessDeniedException
- `488` — ServiceQuotaExceededException

---

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