---
title: "Nl Query Entity"
method: POST
path: "/api/v1/ontology/entities/{entity_id}/nl_query"
tags: ["ontology-query"]
---

# Nl Query Entity

`POST /api/v1/ontology/entities/{entity_id}/nl_query`

Translate a question into DuckDB SQL over this entity + its 2-hop closure.

## Path parameters

- `entity_id` string, uuid, required

## Request body

- QueryRequest
  - `question` string, required

## Response `200`

Successful Response

- EntityNLQueryResponse — Same, plus the generated SQL so the panel's editor can show it back.
  - `columns` ColumnSpec[], required
    - `name` string, required
    - `type` string, required
  - `rows` object[], required
  - `total_rows` integer, required
  - `truncated` boolean, required
  - `row_key_column` string, nullable
  - `row_key_injected` boolean
  - `title` string, required
  - `sql` string, required

## Other responses

- `422` — Validation Error

## Changes

> 17 revisions in range; 1 not diffed.

- **2026-08-28** `eed6fb164abd` — 2 info
  - added the optional property `row_key_column` to the response with the `200` status
  - added the optional property `row_key_injected` to the response with the `200` status

[Change history](https://skmtc.dev/netter/apis/dmi-backend/changes/api/v1/ontology/entities/:entity_id/nl_query/post.md)

---

[API](https://skmtc.dev/netter/apis/dmi-backend.md) · [All operations](https://skmtc.dev/netter/apis/dmi-backend/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/netter/dmi-backend/revisions/80a1c4d5e318/schema)
