User configuration
Store and retrieve per-user configuration for your Cognee Cloud tenant.POST /api/v1/configuration/store_user_configuration — Store a configuration object.
GET /api/v1/configuration/get_user_configuration/{config_id} — Retrieve a specific configuration by ID. The id is resolved only among the configurations owned by the authenticated user and by the agent users they are the parent of. Any other id — including one that belongs to another account’s configuration — is treated exactly like a missing one: the response is an empty object {} with HTTP 200 (not 404), so a configuration’s existence cannot be probed by id.
GET /api/v1/configuration/get_user_configuration/ — Retrieve all configurations stored by the authenticated user and by the agent users they are the parent of. Each record is of the form {"id", "ownerId", "name", "configuration", "createdAt", "updatedAt"}; ownerId tells the caller’s own records apart from an agent’s. Returns an empty list when there are none.
Ontologies
Ontologies define the structural schema for knowledge graph extraction. They specify which entity types and relationships Cognee should look for during extraction, and an uploaded key can be passed asontology_key to either cognify or POST /api/v1/remember. See Ontologies for the underlying concept.
Uploaded ontologies are kept per user in Cognee’s file storage under DATA_ROOT_DIRECTORY: an index (<user id>/metadata.json) plus one file per key. They follow the data root, so on an s3:// data root they are objects in the bucket, and they are sealed when file encryption is on. Earlier releases wrote uploads to a local folder even on an s3:// data root; those files are not moved to the bucket, so upload those ontologies again after upgrading. There is no local fallback: if the storage cannot be read or written, the ontology endpoints return 500. The index is updated without a lock, so two concurrent uploads or deletes by the same user can lose an entry; send them one at a time.
GET /api/v1/ontologies — List uploaded ontologies. The response maps each ontology_key to its metadata: filename, content_type, format (the rdflib parser name detected at upload, such as xml or turtle), size_bytes, uploaded_at and description. Cognify, remember and export parse the stored file with this recorded format first. Ontologies uploaded before the format was recorded have no content_type or format and still load: Cognee tries each RDF syntax in turn.
POST /api/v1/ontologies — Upload an ontology file.
Cognee picks the parser from the filename extension:
If the extension is not in this list, the Content-Type of the file part decides. The accepted types are
application/ld+json, application/n-quads, application/n-triples, application/rdf+xml, application/trig, application/x-turtle, application/xml, text/n3, text/turtle and text/xml. Parameters such as ; charset=utf-8 are ignored. With curl, set the type on the part:
{"error": "..."}:
DELETE /api/v1/ontologies/{ontology_key} — Delete an uploaded ontology by key.
GET /api/v1/ontologies/{ontology_key}/export — Download an uploaded ontology in a chosen RDF syntax.
format query parameter is optional and defaults to turtle:
The response body is the ontology file, sent as an attachment (
Content-Disposition: attachment; filename="<ontology_key>.<ext>"). Cognee parses the stored file with rdflib and serializes it again, so the download is not a byte-for-byte copy of the upload: prefixes, triple order, blank node labels and formatting can differ, but the graph is the same.
Errors return a JSON body of the form {"error": "..."}:
Apply an ontology to a dataset
- In the app: on the dataset page, choose it in the Ontology dropdown (or Upload new, which takes a
.owlfile), then click Rebuild graph. Use the API above for other RDF formats. - Through the API: pass its key as
ontology_keytoPOST /api/v1/cognifyorPOST /api/v1/remember. An unknown key fails cognify with409.
ontology_valid, and given the class’s IRI as ontology_uri. Entities that match nothing stay in the graph with their extracted type. Matching runs at build time, so data built before you chose the ontology changes only after a rebuild. To see the effect, open the Graph page with only that dataset ticked under Datasets and go to the Types level, or query ontology_uri with SPARQL.
Ontologies are optional. Without one, Cognee uses its default extraction pipeline with generic entity types. Upload an ontology when you already maintain one for your domain; to have Cognee build one from your data instead, see Auto-ontology.
Dataset graph schema
Each dataset can store a graph schema (the model built in the Graph Model editor) and a custom extraction prompt.GET /api/v1/datasets/{dataset_id}/schema — Return {"graph_schema": ..., "custom_prompt": ...}; both are null when nothing is stored. Needs read permission on the dataset.
PUT /api/v1/datasets/{dataset_id}/schema — Store graphSchema and/or customPrompt, replacing the stored value of each one sent; an omitted key leaves its value unchanged. Needs write permission. Returns {"status": "ok"}.
PATCH /api/v1/datasets/{dataset_id}/schema — Merge a partial graph schema into the stored one instead of replacing it. Needs write permission, like PUT. The body takes entities, removeEntities, removeFields, options and root (snake_case keys work too); the custom prompt is not changed.
Person.phone field and a Draft entity; a removal that names anything missing fails the whole request with 422.
The merge works by name:
- Entities are upserted by
name: an unknown name is added, a known one is updated. - Fields of an entity are upserted by field
name. A field with a matching name is replaced whole, whatever itskind; fields not sent stay as they are. - Entity scalars (
description,primaryLabelField,indexFields,identityFields) change only when sent; an explicitnullclears one. - Removals run after the upserts: first
removeFields([{"entity", "field"}]), thenremoveEntities. optionsis shallow-merged: only the keys sent change.rootchanges only when sent; an explicitnullresets it to the first entity.- With no stored schema the patch is applied to an empty schema, so it creates the schema, like
PUT.
GET returns, with the merged schema.
Errors write nothing. 422 returns {"message": "..."}:
PUT stores any JSON as the graph schema, so a dataset can hold a schema that PATCH cannot parse. PATCH then returns 422; replace the schema with PUT first.LLM helpers
The tenant exposes two LLM helper endpoints that power the Graph Model editor and the Prompt editor in the UI. They are also usable directly with an API key.POST /api/v1/llm/infer-schema — Propose a JSON schema (entity types and relationships) from sample text and/or uploaded files. The request is multipart/form-data:
The response shape is
{ "graphSchema": { ... } }, validated against the graph model utility before being returned. The endpoint returns 400 when neither text nor data is supplied, 422 when the LLM output is not valid JSON, and 500 for other inference errors.
POST /api/v1/llm/custom-prompt — Generate a starter cognify prompt for a given graph model. The request is JSON:
{ "customPrompt": "..." }. The same parameters keys (temperature, max_tokens, top_p, seed) are accepted.
Both endpoints live on the tenant API (the per-tenant API base URL shown on the API Keys page), not the platform management API.