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 includeAPI-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.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. Picktype ("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.databases.status until provisioning completes:
Ingest knowledge
Upload documents, app sources, or both in one call:app_knowledge instead of documents. You can combine both in a single request.
Add user memories
Use the sameingest 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
Pollcontext.status with the IDs from the ingest response:
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 - switchtype and query_by to control behavior:
Browse, fetch, and inspect
Response envelope
All responses are wrapped in a consistent envelope: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,operatorandmode
- 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’serror payload:
IDE-driven discovery
Whether you’re using TypeScript, Python, VS Code, PyCharm, or any modern IDE, the workflow is the same:- Type the method name → see all available methods
- Open the parentheses → see all required and optional parameters
- Press
Cmd+Space(macOS) orCtrl+Space(Windows/Linux) → get inline documentation
Related sections
- API Reference - complete endpoint documentation
- Error Responses - HTTP codes, error codes, retry patterns
- Quickstart - build your first integration in five minutes
- Query - conceptual overview of
POST /query - Knowledge and Memories - ingestion deep-dives