---
title: "Ask a QA turn"
method: POST
path: "/v1/workspaces/{id}/qa"
tags: ["Workspaces"]
---

# Ask a QA turn

`POST /v1/workspaces/{id}/qa`

## Request

- Base URL: `https://console.nace.ai`
- URL: `https://console.nace.ai/v1/workspaces/{id}/qa`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/nace/apis/drex-api/docs/v1/workspaces/:id/qa/post.ts> (a function with typed inputs; its response is checked against the schema)

One turn of a conversation with an agent over the workspace's ingested files. Follow up with the last turn's `answer.session_id`. Pricing to be announced.

## Path parameters

- `id` string, required

## Query parameters

- `wait_seconds` integer

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `query` string, required
  - `context` string: Background the answer takes as given. Leave it out for the workspace's `global_context`; `""` uses none.
  - `path_prefix` string: Search only the files under this folder.
  - `paths` string[]: Search exactly these files too, by path.
  - `output_schema` object: A JSON Schema the answer must follow; the result's `structured_answer` holds it.
  - `session_id` string: Continue a conversation.
  - `allow_clarification` boolean
  - `clarification_answers` object[]: Answers to the last turn's clarifying questions. Needs `session_id`.
    - `question` string, required
    - `answer` string, nullable

## Response `200`

The job, finished within `wait_seconds`.

- WorkspaceJob: A job in a workspace (an ingestion, reconciliation, knowledge-graph build, automatic search, QA turn, file replace or delete, or workspace delete), passed through from the document service. Read it again with `GET /v1/documents/jobs/{id}`.
  - `job_id` string, uuid, required
  - `kind` string, required: The document service's job kind, such as `ingestion`, `reconciliation`, `kg_build`, `intelligent_search` (automatic search), `automatic_agent` (QA), `file_replace`, `file_delete` or `workspace_delete`.
  - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled', required
  - `workspace_id` string
  - `result` unknown

## Other responses

- `202`: The job, still running. Read it at `GET /v1/documents/jobs/{id}`.
- `401`: Missing or invalid API key (`authentication_error`, code `invalid_api_key`).
- `403`: A `paths` entry names a file the key can't read, or another key started the QA session (`permission_error`, code `access_denied`).
- `404`: No workspace with this id that the key may use (`not_found_error`, code `workspace_not_found`), or Workspaces are off on this deployment (`not_found`).
- `409`: The conversation's last turn is still running (`conflict_error`, code `session_busy`).
- `422`: The body or a parameter is invalid, or the document service refused it (`invalid_request_error`).
- `429`: Over the account's requests per minute, or over 60 searches and QA turns per account every 10 minutes (`rate_limit_error`, code `rate_limited`).
- `500`: Something failed on Drex's side (`internal_error`).
- `502`: The document service refused Drex's own request (`upstream_error`, code `ndi_refused_drex`). Retry later.
- `503`: The document service is unavailable (`service_unavailable`).

---

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