Recall
POST /api/v1/recall — Retrieve information from the knowledge graph.
Auto-routes the query to the best retrieval strategy. This is the primary search endpoint.
Results are ranked for the calling user: a completion-based search over a single dataset nudges ranking toward what that user has rated well, away from what they rated poorly, and carries their stated preferences as guidance. See Personalized ranking.
query is a required body field: a request that omits it is rejected with 400 and a detail array naming the missing field, rather than being answered — see Requests without a query for the error shape and the history of the removed default.
The request body accepts an include_references boolean (default true). When enabled, completion-style answers get a deterministic Evidence: block appended to the answer text, citing the source chunks or graph context. The response schema is unchanged. Set include_references to false to restore the exact prior answer text.
Streaming
A recall can stream its answer as server-sent events instead of waiting for the full JSON payload. Opt in withstream: true in the body, or an Accept header that ranks text/event-stream above application/json:
text/event-stream: stage frames name the phase (retrieving, generating), delta frames carry answer tokens, a reset frame tells the client to discard the partial text (the model call was retried), and the stream ends with a final frame carrying the same payload the JSON path returns — the streamed tokens are a preview, the final payload is authoritative. Keepalive comments pad quiet stretches.
Two boundaries to know:
- Token deltas need a streamable answer call. They flow for a session-backed completion — the path the Search UI uses. A sessionless recall, an
only_contextone, and a recall constrained by aresponse_schemaall still return an event stream, but one carryingstageandfinaland nodeltaframes at all. Zero deltas is a supported outcome, not a failure. Callers that don’t opt in get the unchanged JSON response. - The pre-flight credit guard still runs first: an exhausted balance is a real HTTP 402 before any stream starts, not an error frame inside a
200.
Session retention
Session-cache rows — Search-page conversations plus agent Q&A and trace entries — are kept for one year of inactivity. The TTL is re-stamped on every write, so only a conversation untouched for a full year expires. Before mid-September 2026 the window was cognee’s seven-day default.Recall and search history
GET /api/v1/recall — Retrieve recall history for the authenticated user.
Recall records the questions it answers. A POST /api/v1/recall that runs graph retrieval writes its question and answer into the same history that POST /api/v1/search uses, so recall traffic — including questions from agents and the Search UI, which both call recall — appears in both GET /api/v1/recall and GET /api/v1/search.
What a recall records:
- The search type that ran. If you omit
search_type, recall auto-routes the question, and the history row stores the type the router chose —HYBRID_COMPLETIONfor an ordinary question, orCHUNKS_LEXICAL/CODING_RULESwhen a routing rule matched. - One question-and-answer entry per dataset that answered. A recall spanning several datasets records a separate pair for each, attributed to that dataset, rather than one combined entry. Recalls whose results carry no dataset — which is what happens when access control is disabled — are recorded without dataset attribution.
- Unanswered questions too. A recall that matched nothing still records one entry, unattributed, with empty answer text.
COGNEE_LOG_SEARCH_HISTORY to false to stop recording history altogether.
DELETE /api/v1/search/history: Delete the authenticated user’s own search and recall history.
It removes every question and answer recorded for you, which is everything GET /api/v1/search and GET /api/v1/recall list. That covers every dataset, including entries recorded without a dataset. It also removes entries recorded before COGNEE_LOG_SEARCH_HISTORY was turned off. The endpoint takes no path, query or body parameters. Because it has no user parameter, nobody can use it to delete another user’s history, including admins and tenant owners.
0.
Recall prerequisites
Recall reads from an existing knowledge graph — it does not create one. Before recall (or search) returns anything, the dataset must already be ingested and processed:POST /api/v1/remember, orPOST /api/v1/addfollowed byPOST /api/v1/cognify.
Recall prerequisites not met 422 below. The table also lists the other errors recall can return:
Errors raised inside Cognee reach the caller with their own status code and a single
detail field of the form "<message> [<ErrorName>]" — see Error Handling.Structured output with response_schema
The request body accepts an optional response_schema object: a JSON Schema describing the shape you want the completion to conform to, typically produced client-side with MyModel.model_json_schema(). The server rebuilds a Pydantic model from it and validates the completion against that model, so each result carries the validated payload in its structured field. Only completion-style search types support it.
recall(response_model=...) runs against a remote server, the client forwards response_model.model_json_schema() as response_schema.
Supported schema subset
The server accepts only the structural subset that Pydantic itself emits:
Two budgets guard the service against abusive schemas: nesting may not exceed 10 levels, and the schema may not declare more than 200 properties in total.
Retriever options with retriever_specific_config
The request body accepts an optional retriever_specific_config object (camelCase retrieverSpecificConfig also works). It holds options for the retriever behind the chosen search type. It is the same dict the SDK’s recall(retriever_specific_config=...) takes, and the server forwards it unchanged. Options include chunks_top_k, entities_top_k, facts_top_k, include_external_metadata and external_metadata_keys for HYBRID_COMPLETION.
trueandfalseare not accepted as integers.nullis accepted only forchunks_top_k,entities_top_k,facts_top_k,text_summaries_top_k,candidate_top_kandexternal_metadata_keys. It means “use the retriever’s default”. Other known keys rejectnull.- Keys not in the table are forwarded unchanged, for example
max_subqueries,decomposition_system_prompt_pathand theagentic_*prompt paths. A retriever that does not read a key ignores it.HYBRID_COMPLETION_DECOMPOSITIONchecksmax_subqueriesitself and rejects values outside 1–20. response_modelis rejected, because it is a Python type and cannot be sent as JSON. For structured output, sendresponse_schemato/recallinstead.
400 with the validation errors in detail, in the same shape as Requests without a query. NaN and Infinity sent for a key in the table are rejected the same way and echoed as strings in body. These checks apply only to HTTP requests. The Python SDK does not apply the bounds.
Using the global context index (dataset summaries)
improve builds a dataset’s global context index by default: a summary of the whole dataset plus summaries of its document groups. Retrieval does not read it unless you ask. To add it to the answer’s context, send include_global_context_index: true with GRAPH_COMPLETION or HYBRID_COMPLETION (other search types ignore it):
World summary: (the dataset summary) and Relevant areas: (the global_context_index_top_k group summaries closest to the question, 3 by default). Send only_context: true to check that it is there. There is no workspace setting for this, and the Search page does not use it.
Search
POST /api/v1/search — Search for nodes in the graph database.
Provides direct control over the retrieval strategy. Accepts a search_type parameter to select a specific search mode.
Choosing a search type
You rarely need to pick one.POST /api/v1/recall without a search_type routes the question for you, and an ordinary question runs HYBRID_COMPLETION. Set search_type (on recall or search) when you want one kind of retrieval:
TEMPORAL, CYPHER and NATURAL_LANGUAGE are not available on Cloud: POST /api/v1/search rejects them with 400 and search_type=<TYPE> is not supported on this deployment.
The Search page has no search-type picker: questions go through recall, except when every dataset in the scope is a connected repository, which turns the chat into a code lookup.
The request body also accepts an include_references boolean (default true), which behaves the same as on POST /api/v1/recall: it appends an Evidence: block to completion-style answer text. Set it to false to disable.
The request body also accepts retriever_specific_config (or retrieverSpecificConfig), with the same checks and 400 errors as on POST /api/v1/recall — see Retriever options with retriever_specific_config.
query is required here as well, on the same terms as on POST /api/v1/recall — see Requests without a query.
Scoping by node type
POST /api/v1/recall and POST /api/v1/search both accept node_type (also nodeType), which says what the names in node_name are:
- Omitted or
null: the names are node-set tags, thenode_setvalues given to/api/v1/addor/api/v1/remember. This is the behavior when you leave the field out. - A class name: the graph search is scoped to the named nodes of that graph node type and their one-hop neighbours. Pass the bare class name, such as
"TextDocument","SchemaColumn"or"Entity". On recall, auto-routing then picks only search types that apply such a scope.
module.ClassName path is refused. Only node types the server ships or imports resolve. A class defined only in your own process cannot be named, and neither can one a remote cognify rebuilt from a graph_model schema. Anything else returns 422 with UnknownNodeType before retrieval starts.
The Python SDK sends this field for you when recall() or search() runs against a remote server with a typed node_type. It refuses to send a typed scope to a server that predates the field.
Search history
GET /api/v1/search — Retrieve search history for the authenticated user.
Searches are recorded per dataset. A POST /api/v1/search spanning several datasets records one question-and-answer entry for each dataset that answered, rather than a single combined entry, so history grows in proportion to the datasets a search touches. See Recall and search history for the full recording rules, which are shared by both endpoints. To clear your history, use DELETE /api/v1/search/history.
Requests without a query
query is a required body field on both POST /api/v1/recall and POST /api/v1/search. A body that omits it fails request validation before any retrieval runs, and Cognee returns 400 — not the 422 that FastAPI emits by default — with the validation errors in detail:
query string. This matters most for integrations written against earlier releases, where both endpoints declared query with a default of "What is in the document?": a {} body returned 200 with an answer to that placeholder question, searched across every dataset the caller could read. Those calls now fail loudly instead of returning an answer to a question nobody asked. Requests that already pass a real query — including every example on this page — are unaffected.
The placeholder string is still the schema example for the field, so the interactive reference and Swagger “Try it out” keep prefilling it in the request body. It is an example you can edit or replace, not a value the server substitutes when you leave query out.
The Python SDK is unaffected: recall() and search() already take the query as a required positional argument.
Visualize
GET /api/v1/visualize — Generate an HTML visualization of a dataset’s knowledge graph.
Requires a dataset_id query parameter (UUID). Returns a self-contained HTML page with an interactive graph.
POST /api/v1/visualize/multi — Generate a combined visualization from multiple users’ datasets.
recall is recommended for most use cases. Use search when you need to specify a particular retrieval strategy.