curl -X POST https://api.aiql.io/queries \
-H "Authorization: Bearer $AIQL_API_KEY" \
-H "AiQL-Workspace: $AIQL_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{"content": "count events grouped by day"}'import os
from aiql import AiQL
client = AiQL(api_key=os.environ["AIQL_API_KEY"])
query = client.queries.create(
workspace_id="ws_3a1b",
content="count events grouped by day",
)import { AiQL } from "@aiql.io/sdk";
const client = new AiQL({ apiKey: process.env.AIQL_API_KEY });
const query = await client.queries.create({
workspaceId: "ws_3a1b",
content: "count events grouped by day",
});{
"id": "<string>",
"content": "<string>",
"status": "<string>",
"output": "<string>",
"steps": [
{
"text": "<string>"
}
],
"run_id": "<string>",
"channel": "<string>",
"token": "<string>",
"subscription_token": "<string>",
"ws_url": "<string>",
"since": {
"offset": 123,
"epoch": "<string>"
}
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Query
curl -X POST https://api.aiql.io/queries \
-H "Authorization: Bearer $AIQL_API_KEY" \
-H "AiQL-Workspace: $AIQL_WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{"content": "count events grouped by day"}'import os
from aiql import AiQL
client = AiQL(api_key=os.environ["AIQL_API_KEY"])
query = client.queries.create(
workspace_id="ws_3a1b",
content="count events grouped by day",
)import { AiQL } from "@aiql.io/sdk";
const client = new AiQL({ apiKey: process.env.AIQL_API_KEY });
const query = await client.queries.create({
workspaceId: "ws_3a1b",
content: "count events grouped by day",
});{
"id": "<string>",
"content": "<string>",
"status": "<string>",
"output": "<string>",
"steps": [
{
"text": "<string>"
}
],
"run_id": "<string>",
"channel": "<string>",
"token": "<string>",
"subscription_token": "<string>",
"ws_url": "<string>",
"since": {
"offset": 123,
"epoch": "<string>"
}
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
API key or UI session JWT passed as a Bearer token.
Headers
ID of the workspace the request operates on.
Body
Natural-language content of the query. Empty when resuming tools.
Query id to continue, or a new client-chosen id to create. Omit to start a chat with a server-generated id. Returns 404 if the id belongs to another workspace.
Inquiry interaction mode: ask, reason, or build.
ask, reason, build When true, expose graph visualization tools.
When true, expose follow-up question tools.
Bound artifact ids and selected snippets for this turn.
Show child attributes
Show child attributes
Client-side tool results used to resume a deferred turn.
Response
Successful Response
Unique identifier of the query.
Natural-language content of the query.
Status of the query: PENDING, PROCESSING, PROCESSED, or FAILED.
Result the query produced.
Ordered steps taken while working toward the final output. Each step is either an assistant text message ({"text": ...}) or a tool invocation ({"tool": ...}). Reasoning parts, tool arguments, and tool outputs are not included, and the final output is not repeated.
- QueryTextStep
- QueryToolStep
Show child attributes
Show child attributes
Active agent run id when a turn was just started.
Realtime channel for streaming this query.
Centrifugo connection token for streaming.
Centrifugo subscription token for the query channel.
Centrifugo websocket URL.
Stream position to subscribe from.
Show child attributes
Show child attributes