Search
Search for nodes in the graph database.
This endpoint performs semantic search across the knowledge graph to find relevant nodes based on the provided query. It supports different search types and can be scoped to specific datasets.
Request Parameters
- search_type (SearchType): Type of search to perform (default: GRAPH_COMPLETION). Use AGENTIC_COMPLETION to enable skills, tools and max_iter.
- datasets (Optional[List[str]]): List of dataset names to search within
- dataset_ids (Optional[List[UUID]]): List of dataset UUIDs to search within
- query (str): The search query string
- system_prompt Optional[str]: System prompt to be used for Completion type searches in Cognee
- node_name Optional[list[str]]: Filter results to specific node_sets defined in the add pipeline (for targeted search).
- top_k (Optional[int]): Maximum number of results to return (default: 15)
- only_context bool: Set to true to only return context Cognee will be sending to LLM in Completion type searches. This will be returned instead of LLM calls for completion type searches.
- verbose (bool): Return detailed result information including the graph representation when available (default: false)
- skills (Optional[List[str]]): Skill names to load into the agentic retriever (AGENTIC_COMPLETION only)
- tools (Optional[List[str]]): Tool whitelist for AGENTIC_COMPLETION searches
- max_iter (Optional[int]): Max agentic iterations, must be >= 1 (AGENTIC_COMPLETION only)
- include_references (bool): Attach source references to completion-type results (default: false)
Response
Returns a list of search results containing relevant nodes from the graph.
Error Codes
- 403 Forbidden: User lacks permission on the requested datasets (error body)
- 422 Unprocessable Content: Search prerequisites not met (run add + cognify first), or skills/tools sent without search_type=AGENTIC_COMPLETION, or max_iter < 1
- 500 Internal Server Error: Unexpected error during search
Notes
- Datasets sent by name will only map to datasets owned by the request sender
- To search datasets not owned by the request sender, dataset UUID is needed
- If dataset_ids is provided, the datasets name list is ignored
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Retrieval strategy. Common values: GRAPH_COMPLETION (default, graph context + LLM answer), RAG_COMPLETION, CHUNKS, SUMMARIES, TEMPORAL, FEELING_LUCKY (auto-select), AGENTIC_COMPLETION (enables skills/tools/max_iter).
SUMMARIES, CHUNKS, RAG_COMPLETION, HYBRID_COMPLETION, TRIPLET_COMPLETION, GRAPH_COMPLETION, GRAPH_COMPLETION_DECOMPOSITION, GRAPH_SUMMARY_COMPLETION, CYPHER, NATURAL_LANGUAGE, GRAPH_COMPLETION_COT, GRAPH_COMPLETION_CONTEXT_EXTENSION, FEELING_LUCKY, TEMPORAL, CODING_RULES, CHUNKS_LEXICAL, AGENTIC_COMPLETION Dataset names to search. Names only resolve to datasets owned by the caller; use dataset_ids for datasets shared with you.
["default_dataset"]Dataset UUIDs to search (required for datasets shared with you). When provided, the datasets name list is ignored.
null
Restrict results to nodes in these node_sets (the node_set values used during add/remember).
null
Return detailed result information including the graph representation when available.
Skill names to load into the agentic retriever. Requires search_type=AGENTIC_COMPLETION; leave null otherwise.
null
Whitelist of tool names available to the agentic retriever. Requires search_type=AGENTIC_COMPLETION.
null
Maximum agentic tool-call iterations before forcing a final answer (positive integer; AGENTIC_COMPLETION only).
null
Attach source references to completion-type results.