response = client.databases.collections(database="my_first_database")
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="my_first_database")
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
}
}
Collections are created by writing to them. A new database has none: the first ingest without a
collection creates the default collection, and the first ingest under a new collection value creates that one. The list grows as your application writes.
response = client.databases.collections(database="my_first_database")
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 - Delete a collection: Delete 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"]
}
Null on success; an object with code and message on failure.
Show child attributes
Show child attributes
Example:
null
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": "team_docs",
"tenant_id": "acme_corp"
}
Whether the request succeeded.
Example:
true
Was this page helpful?
