stats = client.databases.stats(database="your database id")
const stats = await client.databases.stats({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/stats?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": {
"row_count": 42318
},
"memory_collection": {
"row_count": 287
},
"message": "Successfully retrieved tenant collection statistics"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": { "row_count": 0 },
"memory_collection": { "row_count": 0 },
"message": "Successfully retrieved tenant collection statistics"
},
"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
Database Stats
Retrieve usage statistics for a database.
GET
/
databases
/
stats
stats = client.databases.stats(database="your database id")
const stats = await client.databases.stats({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/stats?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": {
"row_count": 42318
},
"memory_collection": {
"row_count": 287
},
"message": "Successfully retrieved tenant collection statistics"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": { "row_count": 0 },
"memory_collection": { "row_count": 0 },
"message": "Successfully retrieved tenant collection statistics"
},
"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
}
}
Get detailed metrics including storage growth and object counts.
The response splits stats into two database-wide collections:
data.knowledge_collection (Knowledge) and data.memory_collection (User memories), each with its own row count. Counts aggregate across all collections in the database.
stats = client.databases.stats(database="your database id")
const stats = await client.databases.stats({
database: "my_first_database",
});
curl -X GET 'https://api.hydradb.com/databases/stats?database=my_first_database' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": {
"row_count": 42318
},
"memory_collection": {
"row_count": 287
},
"message": "Successfully retrieved tenant collection statistics"
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"database": "my_first_database",
"knowledge_collection": { "row_count": 0 },
"memory_collection": { "row_count": 0 },
"message": "Successfully retrieved tenant collection statistics"
},
"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
}
}
Behavior notes
row_count is chunks, not sources. One ingested document typically becomes many chunks (e.g., a 30-page PDF can produce 100+ rows). To count distinct sources, use List Documents with page_size=1 and read total.- Both collections always exist: Even if you’ve only ingested knowledge (or only memories), both collections are provisioned. Empty collections report
row_count: 0. - Stats are eventually consistent: Immediately after ingestion or deletion, counts may lag until background processing completes. Check Ingestion Status for recently ingested IDs before treating counts as final.
Related Resources
- List sources/memories: List Documents
- List collections: List Collections
- Check provisioning: Database Status
- Read more: Concepts → Multi-Tenant Support
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:
{
"database": "acme_corp",
"knowledge_collection": { "row_count": 1280 },
"memory_collection": { "row_count": 1280 },
"message": "Success",
"tenant_id": "tenant_1234"
}
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?
