response = client.databases.collections(database="your database id")
const response = await client.databases.collections({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/collections?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"collections": ["user_alex", "user_johndoe", "workspace_42", "collection_default_abc123"],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"collections": [],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Databases
List Collections
List collection IDs inside a database.
GET
/
databases
/
collections
response = client.databases.collections(database="your database id")
const response = await client.databases.collections({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/collections?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"collections": ["user_alex", "user_johndoe", "workspace_42", "collection_default_abc123"],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"collections": [],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
- The default collection is not created until the first write - no collection exists until then. Once you ingest without an explicit
collection, the default collection is created and stores all context written without acollection. Create additional collections at any time to scope data to users, teams, or projects. - Implicit creation. Collections are auto-created when ingestion writes data under a new
collection. The returned list grows organically as your application writes data under new values.
response = client.databases.collections(database="your database id")
const response = await client.databases.collections({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/collections?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"collections": ["user_alex", "user_johndoe", "workspace_42", "collection_default_abc123"],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"collections": [],
"message": "Successfully retrieved collection IDs"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Related Resources
- Inspect content: List Documents - scoped to a
collection - Inspect usage: Database Stats
Authorizations
API key sent as a Bearer token: "Bearer prefix.secret"
Query Parameters
Database identifier
Example:
"acme_corp"
Response
OK
Show child attributes
Show child attributes
Example:
{
"collections": ["team_docs", "engineering"],
"message": "Success",
"sub_tenant_ids": ["sub_tenant_4567", "sub_tenant_8901"]
}
Error message, empty string on success.
Show child attributes
Show child attributes
Example:
{
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
}
Show child attributes
Show child attributes
Example:
{
"collection": "team_docs",
"database": "acme_corp",
"latency_ms": 12.3,
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"source_type": "file",
"sub_tenant_id": "sub_tenant_4567",
"tenant_id": "tenant_1234"
}
Whether the request succeeded.
Example:
true
Was this page helpful?
