---
title: "Get Agent Query Route"
method: GET
path: "/api/search/{team_key}/agent/{key}"
tags: ["search"]
---

# Get Agent Query Route

`GET /api/search/{team_key}/agent/{key}`

## Request

- Base URL: `https://api.superit.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.superit.ai/api/search/{team_key}/agent/{key}`
- Auth: HTTP bearer

Poll for agent query results.

## Path parameters

- `key` string, required
- `team_key` string, required

## Response `200`

Successful Response

- AgentQueryDetail: Response for GET — full query state.
  - `key` string, required
  - `status` 'pending' | 'running' | 'completed' | 'unavailable' | 'failed', required: Lifecycle of one natural-language data question. The route's create writes ``pending``; the DBOS workflow moves the row to ``running`` and then to exactly one terminal state. Values are stored verbatim in ``search.agent_query.status``, so this enum is the single source of truth for the repository, the workflow and the polled response — a state the poller cannot match is now a name that does not resolve. ``unavailable`` is terminal and is NOT a failure: the agent understood the question and established that no readable relation answers it. Rendering it as ``failed`` would tell users to retry something that cannot succeed, and as ``completed`` with zero rows would tell them the answer is "none".
  - `question` string, required
  - `sql` string, nullable
  - `data` object[], nullable
  - `explanation` string, nullable
  - `error` string, nullable
  - `attempts` integer
  - `createdAt` string, nullable
  - `completedAt` string, nullable

## Other responses

- `400`: Invalid input
- `401`: Not authenticated
- `403`: Forbidden
- `404`: Not found
- `405`: Method not allowed
- `409`: Conflict
- `422`: Validation Error

---

[API](https://skmtc.dev/superit/apis/super-it-api.md) - [All operations](https://skmtc.dev/superit/apis/super-it-api/llms.txt) - [OpenAPI document](https://skmtc.dev/superit/apis/super-it-api/revisions/4944d556c2bb?raw)
