CortexDB Docs
API Reference

POST /v1/answer

Recall a pack and answer a natural-language question over it, with citations.

POST
/v1/answer
AuthorizationBearer <token>

PASETO v4 public token (or deployment gate key). Auth-disabled dev instances accept any caller.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/answer" \  -H "Content-Type: application/json" \  -d '{    "scope": "string",    "question": "string"  }'
Empty

The question field

The field is question, not query

/v1/answer requires question (not query). Sending { "query": … }422 "missing field question". It shares view, include, temporal, budgets, and citation_mode semantics with recall.

Retrieval without the LLM

skip_answer_llm returns an empty answer with citations

skip_answer_llm: true returns 200 with answer: "" and diagnostics.answer_llm_skipped_by_request: true — it runs recall + citation shaping but skips the LLM. Use it when you want the answer endpoint's citation shaping without paying for generation. cite_sources (top-level) is accepted but has no observable effect on a content-only instance.

Response diagnostics

The response is { pack_id, answer, citations[{ marker, layer, id, support_strength }], provenance, diagnostics, as_of }. as_of is a top-level field here (unlike recall, where it does not exist).

diagnostics fields (v0.9.9)

diagnostics carries recall_ms, llm_ms, total_ms, answer_model, answer_llm_skipped_by_request, tokens_input, tokens_output, and a time_ms phase-map. Token counts are flat tokens_input / tokens_output — there is no pack_used field and no answer_tokens: { prompt, completion }. The model used is at diagnostics.answer_model.

Model and streaming

answer_model default is env-driven; streaming is not token-SSE self-hosted

The claude-opus-4-6 default is a managed-cloud value; self-hosted, answer_model resolves to whatever the answer lane (CORTEX_ANSWER_*) is configured with, and /v1/answer is disabled until that lane is set. ?stream=true returns a single complete JSON object (not an event:/data: token stream) on v0.9.9 self-hosted, and the response header is x-cortex-stability: stable. See Self-hosting defaults.

Notes

  • use_pack_id reuses a recall pack (same-scope only; a pack from a different scope → 404).
  • Temporal questions trigger internal "question shaping" — diagnostics.inferred_question_shape / question_shape_applied reflect it; no request field controls it.
  • order (relevance | recency) is forwarded to recall. When you omit it, recency-shaped questions ("recent…", "latest…", "currently…", "next best step…") auto-infer recency; an explicit value always wins. As with recall, the recency timeline tail is observable in the default holistic view (see POST /v1/recall). Kill-switches: CORTEX_RECENCY_INFERENCE=0 (disable the inference), CORTEX_RECENCY_ORDER=0 (disable the mode) — see Recall Tuning.

On this page