Skip to main content
POST
Searches knowledge, memories, or both, and returns ranked chunks (passages of a source) with their source details. This page is the parameter reference: for a walkthrough, see the Query guide, and for which settings fit which use case, see Recommended configurations.
The prompt strings in the response examples are abbreviated. A zero-result query returns empty arrays and maps, not an error, as shown in the Zero results tab.

Use the context to generate an answer

By default, data.llm_prompt contains the question and matching context as Markdown, with source references and citation instructions. Pass this string to your model to generate an answer using that context. See Query for Python and TypeScript examples.

Request body

To tune alpha, recency_bias, and max_results for your content, see the Query guide.

Querying multiple collections

Use collections to search several collections in one request. The field accepts a list or a weighted object:
Equal weighting
Weighted ranking
  • A list gives every collection equal weight. An object assigns positive relative weights with at most one decimal place. HydraDB normalizes the weights.
  • A request can include at most 100 collections. Missing collections return 400 INVALID_INPUT with their names.
  • Without max_results, HydraDB retrieves up to 10 results per collection, capped at 1,000 candidates before final ranking.
  • With max_results, the limit applies to the final combined response across all collections.

Metadata filters

Top-level metadata_filters keys filter schema-backed metadata. Keys under additional_metadata filter free-form fields (document_metadata is a legacy alias). Separate keys combine with AND.
See Metadata Filters for operators and examples. Filters narrow results. They do not replace the caller’s acl or connector ACL enforcement. Declare frequently filtered fields in database_metadata_schema.

Decision matrix

For query_by: "hybrid":The response does not report which pipeline "auto" resolved to, so budget latency as thinking-level in the worst case. Set mode to "fast" or "thinking" when you need a predictable pipeline.

Example requests

Search the collection that holds shared knowledge and the collection that holds the user’s memories. Both collections must already exist.
A query that names several distinct entities, like this one, is likely to route to "thinking". Omitting mode behaves exactly like mode: "auto". See Modes for when to set it explicitly.

Errors

Common codes: 400 INVALID_INPUT (empty query, operator: "and" or "phrase" without query_by: "text", a malformed filter operator, or a listed collection that does not exist), 400 VALIDATION_ERROR (a metadata filter that does not fit the declared field type), 404 DATABASE_NOT_FOUND, 422 TENANT_INFRA_NOT_READY (the database is still provisioning; poll Database Status until ready_for_ingestion is true), 500 INTERNAL_ERROR. See Error Responses for the full list. 400 also covers oversized filters: a metadata_filters list above 500 values, or a metadata_filters object above 64 KiB of compact JSON. The message names the offending key or reports the actual byte count. See Filter size limits.

Common mistakes

  • query_forceful_relations requires mode to resolve to "thinking": In fast mode the flag is silently skipped. The server does not error or warn; additional_context is empty. Under mode: "auto" this depends on that request’s routing decision, not on what you asked for.
  • Relation timestamp is a Unix epoch float here: In the graph_context slice returned by /query (and in the passthrough relations returned by List Context with include_fields: ["relations"]), each relation’s timestamp is a Unix epoch value in seconds (a float, for example 1778573640.0). The dedicated Context Relations endpoint returns the same field as an ISO-8601 string instead. Normalize before comparing relation timestamps across endpoints.
  • Use the right metadata namespace: Filter schema-backed fields at the top level of metadata_filters and free-form fields under additional_metadata. See Metadata filters.
  • Check indexing first: New sources are not searchable until Ingestion Status reports them indexed.
  • Collection scope: If you omit collection, HydraDB queries the default collection, and a query that names a collection does not read the default one. Use List Collections to discover available IDs.

Authorizations

Authorization
string
header
required

Send your API key as Authorization: Bearer <your_api_key>.

Body

application/json

The query and how to scope and rank it.

acl
string[]

Optional principals for non-enforced connectors. Enforced connectors use the caller and return acl_ignored_by_connector_enforcement only when acl is supplied.

additional_context
string
deprecated

Deprecated: use additional_graph_context for the retrieval hint.

Example:

"The user is on the billing page."

additional_graph_context
string

Short factual hint that guides retrieval, for example the user is on the billing page. It is not a filter.

Example:

"The user is on the billing page."

alpha

Hybrid search balance. Use auto or a number from 0 to 1.

Available options:
auto
Example:

"auto"

Force repository code search on (true) or off (false) for this query. Omit it to let HydraDB decide. Has no effect where code search is not enabled.

Example:

true

collection
string

Collection scope. Defaults to the default collection when omitted. Formerly sub_tenant_id; the sub_tenant_id alias is still accepted (deprecated).

Example:

"team_docs"

collections

Collections to search as a list of IDs or a mapping of IDs to ranking weights. Use collection to select a single collection.

Required array length: 1 - 100 elements
Example:
database
string

The database to query. Formerly tenant_id, which is still accepted.

Example:

"acme_corp"

follow_forceful_relations
boolean
deprecated

Deprecated: use query_explicit_relations. Used when the canonical switch is absent; takes precedence over query_forceful_relations.

Example:

true

graph_context
boolean
default:true

Include graph context in fast mode. Thinking mode always includes graph context.

Example:

true

ids
string[]

Source or memory IDs to search. Returns no matches if none of the IDs match.

Maximum array length: 200
Example:
include_table_sql
boolean

When true, a successful table answer also returns the SQL statement that produced it in tabular_data.sql.

Example:

true

max_results
integer

Maximum number of chunks to return.

Example:

10

metadata_filters
SearchMetadataFilters · object

Use contains, contains_any, or equals. Scalars mean equality; lists mean any match. Use bare values in additional_metadata. Keys are ANDed. Max 500 values per list; 64 KiB total.

Example:
mode
enum<string>
Available options:
fast,
thinking,
auto
Example:

"thinking"

Number of adjacent chunks to pull alongside each matched chunk for additional context.

Example:

3

operator
enum<string>
Available options:
or,
and,
phrase
Example:

"and"

query
string

Natural-language search query.

Example:

"Which mode does the user prefer?"

query_apps
boolean
default:true

Enable app-aware knowledge retrieval. Set false to disable it while still searching all selected knowledge, including app sources.

Example:

true

query_by
enum<string>

Retrieval method to use for the query.

Available options:
hybrid,
text
Example:

"hybrid"

query_explicit_relations
boolean
default:true

In thinking mode, follow the deterministic source links declared at ingestion and return their linked contexts. Defaults to true; false skips them.

Example:

true

query_forceful_relations
boolean
default:true
deprecated

Deprecated: use query_explicit_relations. The canonical switch takes precedence when both are sent.

Example:

true

recency_bias
number

Recency boost for ranking, from 0.0 to 1.0. Default 0.4; 0 disables it. It never buries a clearly more relevant result.

Example:

0.2

response_format
enum<string>

What data carries. Omit it for the result object with llm_prompt; structured leaves out llm_prompt; markdown returns the results as a single Markdown string.

Available options:
,
structured,
markdown
sub_tenant_id
string
deprecated

Deprecated: use collection for one collection or collections for several. Do not send it together with a multi-collection selector.

Example:

"team_docs"

sub_tenant_ids
deprecated

Deprecated: use collections, which accepts the same list or weighted object. Do not send both.

Required array length: 1 - 100 elements
Example:
table_limit
integer
default:100

Maximum table rows returned, from 1 to 100. Default 100; applied after aggregation and ordering.

Required range: 1 <= x <= 100
Example:

1

temporal_reasoning
boolean
default:true

Resolve time-based questions using dated facts. Defaults to true.

Example:

true

tenant_id
string
deprecated

Deprecated: use database.

Example:

"acme_corp"

titles
string[]

Exact document titles to search within, ORed. Titles are normalized like source_fields.title, then matched exactly. Intersected with ids when both are sent.

type
enum<string>
default:knowledge

Split: knowledge, memory or all. Unified: omit type or use unified; split values are ignored with type_ignored_on_unified.

Available options:
knowledge,
memory,
all,
unified

Response

OK

data

Results in the split or unified layout's shape, or a string when response_format is markdown.

Example:
error
HandlerApiError · object | null

Error details on failure, or null on success.

Example:

null

meta
HandlerResponseMeta · object
Example:
success
boolean

Whether the request succeeded.

Example:

true