Skip to main content
POST
Run one KnowQL query turn

Authorizations

Authorization
string
header
required

Session token from POST /auth/login. Pass as Authorization: Bearer <token>. The alternative X-Pinecone-Api-Key header is also accepted for direct-key auth (used by the Nexus CLI on first contact).

Headers

X-Pinecone-Api-Version
string
default:2026-07

Date-based contract version. Omit to resolve to the Nexus default version (2026-07, the oldest served version); send unstable for the in-development surface. The resolved version is echoed back on the same header. A present-but-unrecognized value is rejected with 400 unsupported_api_version.

Body

application/json

A single KnowQL query turn. scope and the session-config fields (system_prompt, guardrails, model/models, tools) are honored only when starting a NEW session and are pinned for its life; continue an existing session with session_id or previous_query_id. The per-turn controls (workflow, shape, max_steps, thinking_level, compose, retrieval_only/pointers_only, chunks_only/artifacts_only, max_retrieved/max_retrieved_chars) ride the turn and are not pinned to the session.

ask
string
required

The natural-language question

scope
string[]

Context slugs/UUIDs. New session only; pinned for the session's life. A scope may not mix work and search contexts.

Required array length: 1 - 10 elements
session_id
string

Continue an existing session

previous_query_id
string

Continue the session this query belongs to

workflow
string

Search workflow for this turn. Legacy aliases query_search/query_sac, query_cc, query_rag are still accepted on input. Ignored for work contexts, which always run the work runtime.

system_prompt
string

Instructions pinned to a new session

guardrails
string

Guardrails pinned to a new session

shape
object

JSON Schema subset for structured output; result in output_json

model
string

provider/model

models
string[]

Ordered fallback list; takes precedence over model

tools
string[]
stream
boolean

SSE streaming. Mutually exclusive with background.

background
boolean

Fire-and-forget: 202 + in_progress query; poll GET /queries/{id}. Mutually exclusive with stream.

timeout_seconds
integer<int64>

May only LOWER the 15-minute (900s) cap

max_steps
integer<int64>

Cap the agent's tool-loop steps for this turn

thinking_level
string

Gemini reasoning depth. Default low. Gemini-backed workflows only; ignored for search_cc.

compose
boolean

false skips synthesis (alias for retrieval_only)

retrieval_only
boolean

Skip synthesis; return retrieved hits in output_json

pointers_only
boolean

Skip synthesis; return just pointers in output_json

chunks_only
boolean

Retrieval-only, narrowed to chunks

artifacts_only
boolean

Retrieval-only, narrowed to artifacts

max_retrieved
integer<int64>

Cap the item count for retrieval-only turns

max_retrieved_chars
integer<int64>

Cap per-item verbatim text length for retrieval-only turns

comparison_group
string

Client-generated id shared by the turns of one Compare run, so the preview per-project query cap treats them as a single action. The group is size-bounded server-side (max 3 turns). Omit for a normal single query.

Response

The completed query turn (synchronous), or the SSE stream when stream=true

One query turn. Read the answer from output[].content[].text.

id
string
required
object
string
required
session_id
string
required
created
integer<int64>
required

Unix seconds

status
string
required
input
object[]
required

The stored message array (plain-text content).

output
object[]
required

Output items; assistant text is {role, content:[{type: output_text, text}]}

citations
object[]
required
steps
object[]
required
usage
object
required
runtime_ms
integer<int64>
required
model
string | null
error
string | null
previous_query_id
string | null
comparison
object[] | null
feedback
object | null
output_json
object | null

Present when a shape was used, or on a retrieval-only turn

rollup
object | null

Per-turn token/cache totals + tool tally (response.turn_rollup)

synthesis
object | null

Token/latency of the answer completion (response.synthesis)

trace_ref
string | null

Blob key of the persisted trace