Skip to main content
The SDKs wrap every endpoint in the API Reference with typed methods and IDE autocomplete. They automatically set the API-Version: 2 header on every request, so you do not need to send it manually.

Installation

The SDKs ship as major-version bumps of the same packages used for v1. Pin to >=2.0.0 to use the latest method surface.

Client setup

Python: Both synchronous (HydraDB) and asynchronous (AsyncHydraDB) clients are available. They share an identical surface; choose based on your application’s concurrency model.

Naming conventions

The REST API uses snake_case for all request and response fields, and the Python SDK preserves those field names for request/response objects. TypeScript camelCases multi-word method names and all request and response fields.
Use camelCase request fields in TypeScript (e.g., client.context.list({ database: "...", pageSize: 50 })). The SDK converts them to snake_case on the wire and silently drops keys it does not recognize, such as page_size: 50. JSON-string values (documentMetadata, memories, appKnowledge) and free-form maps (metadataFilters) are sent as written, so keep snake_case inside them.The Python SDK also uses snake_case throughout (e.g., client.context.list(database="...", page_size=50)).database and collection are the current field names (formerly tenant_id and sub_tenant_id). The old names remain accepted as deprecated aliases for full backward compatibility.

SDK method structure

SDK methods are grouped under top-level namespaces, one per /api-reference/v2 group:

Method reference

Context

client.context.* covers every flow around content lifecycle: document uploads, app sources, memories, polling, fetching, listing, deletion, and graph inspection.

Query

A single method covers all retrieval. Pick type ("knowledge", "memory", "all") and query_by ("hybrid", "text") to control behavior.

Feedback

Databases

Connectors

Webhooks

The tables above use the Python method names. TypeScript camelCases multi-word ones (list_resources() is listResources()).

Migrating from v1

The v2 SDKs are a deliberate consolidation. A few common v1 to v2 method swaps: The v1 SDK methods remain available on the <2.0.0 releases of hydradb-sdk / @hydradb/sdk for as long as v1 routes are supported.

Getting started

Create a database

A database is an isolated workspace. B2C apps usually use one database with a collection per user; B2B apps use one database per customer. See Multi-tenancy for the full model.
Database creation is asynchronous. Poll databases.status until provisioning completes:

Ingest knowledge

Upload documents, app sources, or both in one call:
For app sources (Slack, Notion, Gmail, webpages), pass app_knowledge instead of documents. You can combine both in a single request.

Add user memories

Use the same ingest method with type: "memory":
infer defaults to false. Set infer: true for conversational content where you want HydraDB to extract implicit preferences. Use infer: false for content that should be stored verbatim.

Verify processing

Poll context.status with the IDs from the ingest response:
Wait until each indexing_status is completed (or graph_creation if you don’t need full graph traversal). See Context Overview for the full status pipeline.

Query

A single method covers every retrieval pattern: switch type and query_by to control behavior:
For the full parameter reference, see Query: Overview.

Browse, fetch, and inspect

Response envelope

All responses, except connector endpoints and PATCH /databases/{database}/metadata-schema, are wrapped in a consistent envelope:
The SDKs return the full envelope. Read the payload from the data field (e.g. response.data); on failure the SDK raises a typed exception instead of returning an envelope with error populated.

Error handling

Both SDKs throw exceptions for non-2xx responses. Error objects expose the envelope’s error payload:
The Python SDK raises a typed exception per status from hydra_db.errors. Each subclasses ApiError and carries status_code, headers, and the parsed response body, from which you can read body["error"]["code"].Not every status has its own class: 401 and 429 do not. Catch the base ApiError and branch on status_code, as above, whenever you need to handle those.
For the full list of error codes and retry patterns, see Error Responses.