---
title: "Get Sql Generation"
method: GET
path: "/api/sql-generations/{id}"
tags: ["Generation"]
---

# Get Sql Generation

`GET /api/sql-generations/{id}`

## Request

- The document declares no server URL.
- Auth: API key in header `X-API-Key`

## Path parameters

- `id` string, required

## Response `200`

Successful Response

- SQLGenerationResponse
  - `id` string
  - `prompt_id` string
  - `finetuning_id` string
  - `sql` string
  - `status` 'VALID' | 'INVALID': An enumeration.
  - `tokens_used` integer
  - `confidence_score` number
  - `error` string
  - `completed_at` string, date-time
  - `created_at` string, date-time
  - `metadata` SQLGenerationMetadata
    - `dh_internal` DHSQLGenerationMetadata
      - `organization_id` string

## Other responses

- `404`: Not found
- `422`: Validation Error

---

[API](https://skmtc.dev/dataherald/apis/dataherald-api.md) - [All operations](https://skmtc.dev/dataherald/apis/dataherald-api/llms.txt) - [OpenAPI document](https://skmtc.dev/dataherald/apis/dataherald-api/revisions/e168e98625a8?raw)
