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 - 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.

Versioning

The SDKs automatically include API-Version: 2 on every outbound request. Server-side routing resolves to the matching routes; the response includes an X-API-Version: 2 header echoing the resolved version. You can verify which version your client is using by inspecting the response headers in any SDK call.

Naming conventions

The REST API uses snake_case for all request and response fields, and both SDKs preserve those field names for request/response objects. TypeScript only camelCases multi-word method names.
Use snake_case request fields in TypeScript examples too (e.g., client.context.list({ database: "...", page_size: 50 })). The SDK sends the same names on the wire, matching the OpenAPI schema.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.
Your IDE’s autocomplete and type checking work directly off the API contract - if a field is optional in the API, it’s optional in the SDK.

SDK method structure

SDK methods are grouped under three 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.

Databases

The method-reference tables above use the Python (snake_case) method names. TypeScript keeps the same method names but camelCases any that are multi-word (for example, the connector method list_resources() in Python is listResources() in TypeScript). Request parameters stay snake_case in both SDKs.

Migrating from v1

The v2 SDKs are a deliberate consolidation. A few common v1 → 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. Most organizations create one database total, with collections for users or teams. See Multi-Tenant 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 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.

Type safety

Both SDKs are fully typed:
  • Autocomplete for all method names and parameters
  • Type checking for request and response objects
  • Inline documentation for each parameter, sourced from the OpenAPI spec
  • Compile-time validation for required vs optional fields
  • Enum-typed values for type, query_by, operator and mode
The SDKs provide exact type parity with the API specification:
  • Request parameters - every field documented in the API reference is reflected in method signatures
  • Response objects - return types match the JSON schema for each endpoint
  • Error types - exception structures mirror error response formats
  • Nested objects - complex parameters and responses keep their full structure

Error handling

Both SDKs throw exceptions for non-2xx responses. Error objects expose the envelope’s error payload:
For the full list of error codes and retry patterns, see Error Responses.

IDE-driven discovery

Whether you’re using TypeScript, Python, VS Code, PyCharm, or any modern IDE, the workflow is the same:
  1. Type the method name → see all available methods
  2. Open the parentheses → see all required and optional parameters
  3. Press Cmd+Space (macOS) or Ctrl+Space (Windows/Linux) → get inline documentation
This works because the SDKs are fully typed with comprehensive parameter docs sourced from the OpenAPI spec.