The big picture
The API has three jobs:
Two details in the diagram:
- Two stores, one ingest endpoint:
POST /context/ingestroutes to the Knowledge store whentype=knowledgeand to the Memories store whentype=memory. Same endpoint, different bucket. - One query endpoint, every retrieval method:
POST /queryis the only search entry point. Itstypefield picks the store andquery_bypicks the matching method. Query covers every parameter.
Ingestion lifecycle
Ingestion is asynchronous. A successful upload means HydraDB accepted the work and queued it, not that it is searchable yet. Each source moves through these statuses: PollGET /context/status with the returned id to follow each source, or register a webhook to be told instead. Two notes:
graph_creationis already searchable: chunks become retrievable as soon as embedding finishes. Wait forcompletedonly when you need full graph traversal.- Failures come with a reason: an
erroredstatus carries anerror_codeanderror_message, so you can tell a parse failure from a validation problem or an infrastructure issue.
From upload to query
The end-to-end flow, with the endpoint that owns each step:- Create a database with
POST /databases, optionally declaring a metadata schema up front. - Wait for it to be ready by polling
GET /databases/statusuntilinfra.ready_for_ingestionistrue. - Ingest context with
POST /context/ingest:type=knowledgefor documents and app sources,type=memoryfor preferences, decisions, and conversations. - Wait for indexing by polling
GET /context/statusuntil eachidreachescompleted, orgraph_creationif you do not need graph traversal. - Query with
POST /query, choosingtypeand the collection scope. Pass the result to your model with the helper in How to Use API Results.
Database isolation
Adatabase (formerly tenant_id, still accepted as a deprecated alias) is the top-level isolation boundary: no database can read another database’s data. Within a database, a collection (formerly sub_tenant_id) is a partition. One collection holds shared knowledge; separate collections hold data that must never meet in one query, such as one end user’s memories. Omitting collection on any call resolves to the database’s default collection, which is created on the first write.
Multi-tenancy covers when to create a new database rather than a new collection, and how scoping interacts with Memories and metadata filters.
Retrieval pipeline
EveryPOST /query call runs the same steps:
- Authenticate and scope: validate
databaseand apply the requestedcollectionorcollections(the default collection when neither is sent). - Filter before ranking: apply
metadata_filtersto narrow the candidate set. - Retrieve: run hybrid retrieval over the semantic vector store and the BM25 keyword index, blended by
alpha, or BM25 only whenquery_by: "text". - Enrich: attach the relevant slice of the context graph when
graph_contextis on. In thinking mode, also expand the query, rerank, and pull in author-declared linked sources.mode: "auto", the default, picks fast or thinking per query. - Shape the response: return ranked
chunks, deduplicatedsources, thegraph_contextslice, and anyadditional_context.
When results are empty
A query is synchronous and reads only context that has finished indexing. When results look incomplete, walk the chain in order:- Status first: did every
idreachcompleted, or at leastgraph_creation? CheckGET /context/status. - Scope second: is the
databasecorrect? Did you write under onecollectionand read under another? See Multi-tenancy. - Filters third: are you using the right namespace? Top-level
metadata_filterskeys matchmetadata; free-form fields belong underadditional_metadata, and top-level filter keys must be declared in the database schema. See Metadata.
Related
- Core Concepts: what to store, where to store it, and what a query returns
- Quickstart: build your first integration in five minutes
- Knowledge and Memories: the two kinds of context
- Query: the request, recipes, and every parameter of
POST /query - Multi-tenancy: scoping patterns and pitfalls
- Context Graphs: how the graph layer enriches retrieval
- Metadata: designing filterable fields
