Skip to main content
post/knowledge-fs/spaces/{knowledge_base_id}/queries/admission
Request example
Response
post/knowledge-fs/spaces/{knowledge_base_id}/queries/admission

Authorization

Authorizationstringheaderrequired#

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path parameters

knowledge_base_idstringrequired#
Knowledge base ID: the last segment of the Service API endpoint shown in the knowledge base's API Access dialog (…/knowledge-fs/spaces/<knowledge base ID>), and the segment after /datasets/new/ in the address bar.

Body

application/json
activeDocumentIdsstring[]#
These IDs do not filter or rank retrieved content. Leave empty.

Items: max 100

activeEntityIdsstring[]#
These IDs do not filter or rank retrieved content. Leave empty.

Items: max 100

modeenum<string>#
Retrieval depth: fast, deep, or research (see Retrieval Depth). Omit it (or send null) to use the knowledge base's default depth, retrieval.default_mode in Get Knowledge Base Settings.
Options:fastdeepresearchnull
querystringrequired#
The question. Use a nonblank query. Also limited to 16,384 UTF-8 bytes.

Length: max 16000Pattern: \S

sessionIdstring#

ID of a query session, as a UUID. Omit it to start a new session. Run Query returns the session ID in its x-session-id response header.

A session stores the last 20 queries but doesn't carry them into later answers. It expires after 30 minutes without a query.

An expired or unknown ID starts a fresh session under that ID, so a UUID you generate yourself stays valid as that session's ID.

Responses

application/json
Query token issued.
expires_atstring#
When the token expires, as an ISO 8601 timestamp in UTC. At most 60 seconds after issue. The deployment can shorten the lifetime.
operation_idstring#
Always createQuery, the operation the token is valid for. Callers can ignore it.
requestobject#
Request body for Run Query. Send it unchanged.
tokenstring#

Query token for Run Query on this knowledge base, good until expires_at. Send it as Authorization: Bearer <token>.

Create a new token for each call, including a retry.

It is a signed JWT. Read trace_id from this response for the X-Trace-ID header; you do not need to decode the token.

trace_idstring#
Value to send as the X-Trace-ID header of Run Query. It equals the token's trace_id claim. It is not the query record ID.
urlstring#
Where to send Run Query. An absolute URL when the deployment sets SERVICE_API_URL. Otherwise the path /v1/knowledge-fs/query-stream, which already carries the /v1 prefix. Resolve that form against the scheme and host of your endpoint, not against the endpoint's path.