List datasets
GET /api/v1/datasets/ — List all datasets accessible to the authenticated user.
id (a UUID) and name. This is where to look up the dataset_id that other endpoints take; in the app, the same ID is the last part of the dataset page’s URL.
There is no endpoint to rename or merge datasets. See Can I rename a dataset? and Can I merge two datasets?.
Create a dataset
POST /api/v1/datasets/ — Create a new dataset or return the existing one if the name already exists.
Datasets are also created implicitly when you call
add or remember with a dataset_name that does not yet exist.Dataset status
GET /api/v1/datasets/status — Get the processing status of all datasets.
Returns the pipeline state for each dataset: whether cognify is pending, running, or completed.
Passing a dataset UUID you cannot read is a permission failure, not a conflict: the endpoint returns 403 Forbidden with the standard permission-denied body, and every UUID you pass must be readable — one inaccessible entry fails the whole request. A UUID that does not exist at all fails the same check, so it returns 403 too, not 404.
409 is reserved for an unexpected failure while retrieving the statuses.
In-flight progress
GET /api/v1/datasets/status/progress — Get the same statuses, plus how far each running pipeline has got.
Takes the same selection parameters as /status: repeat dataset for each dataset UUID (omit it to cover every dataset you can read) and repeat pipeline to pick pipelines (omit it to default to cognify_pipeline).
{status, progress} rather than a bare status. The flat-versus-nested rule matches /status — flat for zero or one pipeline, nested per dataset and pipeline for more than one:
- completed_items / total_items: files finished out of files in the run. An item that errored still counts as finished, so
completed_itemsalways reachestotal_items. - current_stage: the task most recently entered in an item’s task chain. Results stream through the whole chain before they surface, so in practice this names the chain’s final task (
add_data_pointson the default cognify pipeline) once the first result lands, and isnullbefore that. Treat it as “the run is moving”, not as a stage-by-stage position —completed_items/total_itemsare the fields to drive a progress bar from.
progress is null when there is nothing in flight to report — before the run’s first progress tick, and once the run reaches a terminal state, since the completed or errored record carries no progress snapshot. Treat null as “no progress information”, not as an error.
Progress ticks are throttled to roughly 20 database writes per run (the first and last file always persist), so on a large batch the numbers advance in steps rather than one file at a time.
/status is unchanged — it still returns bare status values in the same shape. Use /status/progress when you want the N-of-M numbers, and the cognify WebSocket when you want live in-flight updates while a run is executing; polling this endpoint is how a client recovers granular progress after a page refresh or a dropped subscription./status: asking for a dataset you do not have read permission on returns 403 Forbidden with the PermissionDeniedError body, and a 409 means the progress could not be retrieved for an unexpected reason.
Per-item processing status
GET /api/v1/datasets/{dataset_id}/processing-status — Get which individual data items in one dataset have been processed by a pipeline, and which have not.
/status and /status/progress report the state of a run. This endpoint reports the state of the dataset’s items: which of them carry the per-item completion stamp for a pipeline. It is the endpoint to reach for when triaging an incremental load — after a partial or interrupted run, it names the files that still need work.
The optional pipeline query parameter selects the pipeline whose stamp is counted. It defaults to cognify_pipeline; add_pipeline and code_graph_pipeline are the other pipeline names Cognee stamps items with. An unknown name is not rejected — it simply reports every item as pending.
- total: number of data items in the dataset.
- completed: items carrying the per-item completion stamp for the requested pipeline.
- pending:
total - completed. - items: one entry per data item, newest first — the same order as
GET /api/v1/datasets/{dataset_id}/data, though this list is not paginated and always covers the whole dataset. Eachidis thedata_idaccepted byDELETE /api/v1/datasets/{dataset_id}/data/{data_id}and byforget(data_id=...), so an item listed here as pending can be acted on directly.
Per-item errored state is not persisted, so it is not reported. A
pending item may be untouched, in progress, or failed — the flag is “not stamped complete”, not “not started”. Use /status or /status/progress to tell whether a run is currently going, and this endpoint to tell which items it has finished.404 is returned when the dataset does not exist or you do not have read permission on it, and a 409 when the status cannot be computed — the same codes as the other per-dataset routes such as GET /api/v1/datasets/{dataset_id}/data.
Graph summary
GET /api/v1/datasets/graph-summary — Get node and edge counts for each dataset.
Counts are computed once per dataset’s latest cognify run and cached, so this is much cheaper than the full graph endpoint when polling dataset sizes repeatedly.
dataset_ids query parameters to summarize specific datasets. Omit it to summarize every dataset you have read access to.
- datasetId: The dataset’s UUID
- pipelineRunId: The dataset’s latest cognify run, or
nullif it has never been cognified - numNodes / numEdges: Graph size for that run
- computedAt: When the counts were cached, or
nullif no cached row was written for this run. Anullhas three causes, and they do not all mean the same thing — read the counts themselves rather than treating everynullas a failure:- The count degraded (for example, the graph store was unavailable). The counts are
0placeholders. This result is held for about 15 seconds before the next recount, so later calls keep returning the0s until then — even when the graph store comes back sooner. - A concurrent caller cached the same run first. The counts are exact, nothing is held, and the next call returns the cached row with a non-null
computedAt. - The counts were computed but could not be cached (for example, the relational store was unreachable). The counts are exact and are held for about 60 seconds before the next recount.
- The count degraded (for example, the graph store was unavailable). The counts are
pipelineRunId) is always counted immediately. Calls that arrive while a run is already being counted wait for that count instead of starting their own. Held results and in-progress counts live in the server process’s memory, so each worker keeps its own.
Self-hosted deployments can tune the two holds with
GRAPH_COUNTS_FAILED_TTL_SECONDS (default 15, for degraded 0 counts) and GRAPH_COUNTS_UNCACHED_TTL_SECONDS (default 60, for exact counts that could not be cached). Set either to 0 to stop holding results of that kind. Negative values count as 0, and a non-numeric value falls back to the default with a warning. Keep GRAPH_COUNTS_FAILED_TTL_SECONDS well above your polling interval; if it equals the interval, whether a poll recounts depends on request latency.409 is returned when the summary could not be built. This means the relational read failed — a single unreadable graph store does not cause it, since that dataset simply comes back with zero counts.
Live dataset updates
WS /api/v1/visualize/subscribe/{dataset_id} — Follow one dataset’s activity over a WebSocket instead of polling.
This is the push replacement for repeatedly calling GET /api/v1/visualize/live-events and refetching the graph payload just to notice that a cognify run finished. Authentication accepts the same credentials as every other endpoint — API key header, bearer header, or auth cookie, sent with the handshake — plus one WebSocket-only fallback: a browser cannot set headers when opening a WebSocket, so the same API key or bearer token can be passed as a ?token= query parameter instead. Prefer the header or cookie where you can send one — a handshake is an HTTP request, and its full URL (query string included) lands in the default access logs of common reverse proxies such as nginx or an AWS ALB, so deployments terminating WebSocket traffic behind one should redact the token parameter there. Cognee redacts it from uvicorn’s own logs. Nothing is ever read from client frames.
Every frame is a JSON object discriminated by kind:
ready—{"kind": "ready", "dataset_id": str, "cursor": str | null}, sent once the connection is authorized, echoing the cursor it starts fromlive_events—{"kind": "live_events", "events": [...], "cursor": str}, roughly every 2s and only when the delta is non-empty. The events are exactly whatGET /api/v1/visualize/live-eventsreturnsgraph_grew—{"kind": "graph_grew", "pipeline_run_id": str}, within about 5s of a cognify run for this dataset completing. A run already complete when you connected is the baseline and is not announcedheartbeat—{"kind": "heartbeat", "time": str}, every 15s or so, so a quiet stream is distinguishable from a dead one
cursor from the last live_events frame back as the since query parameter when reconnecting; omit it to start from every available event.
Close codes:
- 1008: not authenticated, or no read permission on this dataset. A retry replays the same rejection, so clients should stop. Permission is re-checked on every poll, so access revoked mid-stream closes the connection this way too
- 1011: the stream failed server-side; reconnecting is reasonable
since, or a dataset_id that is not a UUID, fails request validation before the connection is accepted. Depending on the ASGI server the client sees either a 1008 close or a plain HTTP rejection of the handshake, so treat a handshake that never opened as a client-side bug rather than a stream error.
Dataset data
GET /api/v1/datasets/{dataset_id}/data — List one page of data items in a dataset.
The response is a page, not the whole dataset. It carries at most limit items — 100 by default — ordered newest first (created_at descending, ties broken by id).
- limit (default
100, range1–1000): maximum number of items in the page. A value outside the range fails request validation with422. - offset (default
0, maximum1000000): number of items to skip. An offset above 1,000,000 fails request validation with422. - content_hash (optional): return only the items you added whose stored
contentHashequals this MD5 hex digest. Case-insensitive; any value that is not 32 hex characters fails request validation with422. Matches are scoped to rows you added, so another user’s copy of the same content in a shared dataset is not returned.limit/offsetpage the matches the same way they page the listing, and an empty first page means you added no such content. The hash is the hex MD5 of the payload, with text encoded as UTF-8 (compute_content_hashin the Python SDK, seedatasets.find_data()).
- label: The label given to this file via the
labelsfield on add or remember, ornullif none was set - externalMetadata: The stored metadata object — the
external_metadataentry you sent merged over loader-derived keys, plus anode_setkey when one was passed at ingest. A file uploaded without metadata stores an empty object rather thannull. - dataSize: The stored size of the file in bytes, or
nullfor a row written without one. - contentHash: The MD5 hex digest of the ingested payload, the value the
content_hashquery parameter matches on.
Paging through a dataset
The response is a bare JSON array: there is noX-Total-Count header and no truncation marker, so a full page is indistinguishable from a complete dataset — that is what /data/count is for. Raising limit only grows the page; it does not lift the cap. To read a whole dataset, advance offset until a short page comes back:
Data count
GET /api/v1/datasets/{dataset_id}/data/count — Get the total number of data items in a dataset without listing them.
The length of a /data response is a page size, not a total, so this is the endpoint to read when you only need “how many documents” — a count badge, or polling an upload until every file has landed.
404 is returned when the dataset does not exist or you do not have read permission on it, the same as GET /api/v1/datasets/{dataset_id}/data.
Download a raw file
GET /api/v1/datasets/{dataset_id}/data/{data_id}/raw — Download the original file for a specific data item. Requires read permission on the containing dataset; ownership of the data item itself is not required, so a dataset shared with you is fully downloadable.
Query the graph with SPARQL
POST /api/v1/datasets/{dataset_id}/sparql — Run a read-only SPARQL 1.1 query over one dataset’s knowledge graph. Requires read permission on the dataset.
SPARQL is the way to query graph structure directly on Cloud. Cypher is not available:
POST /api/v1/search with search_type CYPHER or NATURAL_LANGUAGE returns 400 (search_type=CYPHER is not supported on this deployment.), and there is no setting to turn it on. ALLOW_CYPHER_QUERY applies only to a self-hosted Cognee.ontology_uri keep that IRI, other nodes get {base_iri}node/{id}, cognee-native edges become {base_iri}prop/{relationship_name}, name becomes rdfs:label, and is_a becomes rdf:type or rdfs:subClassOf.
The response depends on the query form. Its keys are snake_case, unlike most of the API, to match the SPARQL results vocabulary:
- SELECT:
variables(the projected names),rows,row_countandtruncated. Each row is a list aligned withvariables. IRIs and literals come back as plain strings (a literal’s datatype and language tag are dropped), blank nodes as_:id, and unbound variables asnull.truncatedistruewhen more rows existed thanlimit. - ASK:
boolean. - CONSTRUCT / DESCRIBE:
turtle, the result graph serialized as Turtle. Datatypes and language tags are kept.
message field:
400 Bad Request: the query contains a SPARQL Update keyword (INSERT,DELETE,LOAD,CLEAR,DROP,CREATE,ADD,MOVE,COPY) or does not parse. Keywords inside string literals, IRIs and comments do not count, soFILTER(CONTAINS(?name, "delete"))runs. A query that usesSERVICE,FROMorFROM NAMEDis also refused, anywhere in the query (subqueries,OPTIONALandUNIONincluded), because it runs over this dataset’s graph only and cannot read other graphs or endpoints. A string or variable that merely spellsserviceis fine. These checks run before the graph is loaded. A missingqueryor alimitout of range is also a400, with the usual validation body.403 Forbidden: the dataset does not exist, or you cannot read it. This one carries the standard permission-denied body (adetailfield), notmessage.413 Content Too Large: the graph has more nodes than the server’s ceiling. The count is checked before the graph is loaded. On a self-hosted instance, serialize the graph to Turtle withserialize_memory_graph(see RDF export) and load it into a triple store instead.504 Gateway Timeout: loading the graph and running the query took longer than the server’s time budget. The server stops waiting, but the query keeps running in a worker thread until it finishes.
Self-hosted deployments set the two limits with
SPARQL_MAX_GRAPH_NODES (default 200000) and SPARQL_QUERY_TIMEOUT_SECONDS (default 30). The whole graph is held in memory for each request, so raise the node ceiling only as far as your server’s memory allows.cognee.datasets.sparql().
Export a dataset
To take your data out, combine these endpoints:
To move data between Cognee Cloud and a local instance, see Syncing a local instance.
The API is available on every workspace, including one running on the free starting credit, and there is no separate fee for it. Exports and file downloads are reads and use no credits; only calls that run the language model, such as ingestion and search, use credits, the same as in the app. See Account & Billing.
Agent sessions and chat context that agents saved to memory live in their own dataset (
agent_sessions by default, see Sessions), so export that dataset too if you want them.
COGX archive
GET /api/v1/export — Download a dataset’s knowledge graph as a COGX archive (.cogx.tar.gz). Pass exactly one of dataset_id or dataset_name as a query parameter. There is no export button in the app yet; this is an API-only route.
- Which datasets you can export.
dataset_idresolves any dataset you can read, including one shared with you or owned by one of your agents.dataset_nameonly resolves datasets you own in this workspace, so a dataset shared with you, or owned by one of your agents, is a404by name and a200by id. - What is in the file. Every node and edge of the dataset, except each member’s private preference record used for personalized ranking and the edges touching it. Document, chunk and other non-entity nodes keep all their properties, including
source_user(normally the contributing member’s email) and, for documents, their storage location (raw_data_location). - Response headers.
X-Cognee-Export-Nodes,X-Cognee-Export-EdgesandX-Cognee-Export-Dataset-Idcarry the graph counts and the resolved dataset id, so you can sanity-check a download without unpacking it. - No resumed downloads. Every request builds a fresh archive and the response sends
Accept-Ranges: none, so aRangeheader is ignored. Restart an interrupted download from the beginning. - No credits. Export is a graph read and makes no LLM call.
.cogx.tar.gz file to POST /api/v1/remember with content_type=cogx-archive (on Cloud, also pass run_in_background=false), or extract it and pass the folder to COGXArchiveSource.
.cogx.tar.gz (or .cogx) and be at most 128 MiB; anything else, or the same file sent without content_type=cogx-archive (including through Add files or POST /api/v1/add), is refused with 415 Unsupported upload file type. An archive with more than 1,000 members, or one that unpacks past 512 MiB, is refused with 413. If a download is not a valid archive, check that it is not a saved error body: run the export with curl -f so a failed export does not write a file.
To import into a local instance:
Delete
DELETE /api/v1/datasets/{dataset_id} — Delete a dataset and all its contents.
DELETE /api/v1/datasets/{dataset_id}/data/{data_id} — Delete a specific data item from a dataset.