---
title: "Create Agent Query Route"
method: POST
path: "/api/search/{team_key}/agent"
tags: ["search"]
---

# Create Agent Query Route

`POST /api/search/{team_key}/agent`

## 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`
- Auth: HTTP bearer

Submit a natural language data question.

## Path parameters

- `team_key` string, required

## Request body

- AgentQueryCreateBody: Request body for POST /search/{team_key}/agent.
  - `question` string, required

## Response `201`

Successful Response

- AgentQueryCreated: Response for POST — just the key and status.
  - `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".

## 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)
