Skip to main content
POST
Query Dataset With Sparql

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

dataset_id
string<uuid>
required

Dataset UUID, the id field from GET /api/v1/datasets (not the name)

Example:

"b8a7c3de-4f5a-4b6c-8d9e-0f1a2b3c4d5e"

Body

application/json
query
string
required

A read-only SPARQL 1.1 query: SELECT, ASK, CONSTRUCT or DESCRIBE.

Minimum string length: 1
Example:

"SELECT ?s ?name WHERE { ?s rdfs:label ?name } LIMIT 10"

baseIri
string | null

Prefix for the IRIs minted for nodes without an ontology_uri and for cognee-native predicates. Defaults to https://cognee.ai/graph/.

Example:

"https://example.org/memory/"

limit
integer
default:1000

Maximum number of SELECT rows to return; sets truncated when hit.

Required range: 1 <= x <= 10000

Response

Successful Response

One query form's result; the fields for the other forms are omitted.

Keys are deliberately snake_case (not the API's usual camelCase): they mirror the SPARQL JSON results vocabulary callers already parse.

variables
string[] | null

SELECT: projected names

rows
((string | null)[])[] | null

SELECT: one list per solution, aligned with variables. IRIs and literal lexical forms as strings, blank nodes as _:id, unbound as null.

row_count
integer | null

SELECT: len(rows)

truncated
boolean | null

SELECT: true when more rows existed than limit

boolean
boolean | null

ASK: the answer

turtle
string | null

CONSTRUCT / DESCRIBE: the result graph as Turtle