Skip to main content
POST
Run one KnowQL query turn

Authorizations

Authorization
string
header
required

Session token from POST /auth/login, sent as Authorization: Bearer <token>.

Headers

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

Date-based contract version, echoed back on the same header. Omit for the default (2026-07); send unstable for the in-development surface. An unrecognized value is rejected with 400 unsupported_api_version.

Body

application/json

One KnowQL query turn. scope and the session-config fields are honored only when starting a NEW session and are pinned for its life; continue an existing one with session_id or previous_query_id. Every other field rides the turn and is not pinned.

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

A context slug or UUID.

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. 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

A catalog model id from GET /models, or a tier name (lite, standard, pro) to let the deployment resolve one. New session only; pinned for the session's life.

models
string[]

Ordered fallback list, tried in turn. Takes precedence over model.

A catalog model id or tier name.

tools
string[]

Tool names the turn may call. New session only; pinned for the session's life.

A tool name.

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

Set false to skip synthesis, the same as 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 a query cap counts them as one action rather than several. Where the cap applies, a group is limited to 3 turns and a fourth is refused with 409. Omit for a normal 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

Turn id, qry_<uuid>.

object
string
required

Always query, so a caller can tell this document apart from a session.

session_id
string
required

The session this turn belongs to. A turn that started a new one names it here.

created
integer<int64>
required

Unix seconds

status
string
required

Where the turn is in its lifecycle.

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

What the answer was grounded in. Empty on a turn that cited nothing.

steps
object[]
required

The turn's reasoning steps, reduced from its response.step events.

usage
object
required

The turn's token totals. Embed and rerank bill on their own seam and are not counted here.

runtime_ms
integer<int64>
required

Wall time from turn start to terminal state.

model
string | null

The model that actually answered. Null before the turn resolves one.

error
string | null

Failure detail. Set on a failed turn.

previous_query_id
string | null

The turn this one continues. Null on a session's first turn.

comparison
object[] | null

The sibling turns of the same Compare run. Null on a normal single query.

feedback
object | null

Thumbs-up/down recorded on this turn. Null until a caller submits some.

output_json
object | null

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

max_steps
integer<int64> | null

The agentic tool-loop step cap this turn actually ran with, whether the request set it or the deployment default supplied it.

thinking_level
string | null

The thinking level this turn actually ran at. Null on the Claude-backed search_cc, which has no equivalent knob.

rollup
Response turn rollup · object | null

End-of-turn counters. Null on a turn the runtime never closed.

synthesis
Response synthesis · object | null

The answer completion's cost. Null on a turn that skipped synthesis, as retrieval-only turns do.

trace_ref
string | null

Blob key of the persisted trace. Fetch the trace itself from GET /queries/{id}/trace.