stats = client.databases.stats(database="my_first_database")
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="my_first_database")
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
}
}
Returns row counts for a database: one for knowledge (
data.knowledge_collection) and one for memories (data.memory_collection), each summed across every collection in the database. Use it to check how much a database holds.
stats = client.databases.stats(database="my_first_database")
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
}
}
row_count counts chunks, not sources: One ingested document typically becomes many chunks (for example, a 30-page PDF can produce 100+ rows). To count distinct sources, use List Context with page_size=1 and read pagination.total.
Both stores always report: Both counts are returned even if you have ingested only knowledge or only memories. An empty store reports row_count: 0.
Stats are eventually consistent: Immediately after ingestion or deletion, counts can lag until background processing completes. Check Ingestion Status for recently ingested IDs before treating counts as final.
Related resources
- Related: List Context: browse and count sources
- Related: List Collections: list the collections in a database
- Related: Database Status: check provisioning readiness
- Guide: Databases and Collections
Authorizations
Send your API key as Authorization: Bearer <your_api_key>.
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 details on failure, or null on success.
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": "sub_tenant_4567",
"tenant_id": "tenant_1234",
"warnings": [
{
"code": "acl_ignored_by_connector_enforcement",
"message": "This connector enforces ACL, so the request's acl was ignored."
}
]
}
Whether the request succeeded.
Example:
true
Was this page helpful?
