Counts the documents in each of your indexes.
Counts the documents in each of your indexes. Reports every index the caller's own org holds with its document count, plus the org's total.
GET /v1/index/stats
| Address | https://api.hanzo.ai/v1/index/stats |
| Method | GET |
| Operation | get_index_stats |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Counts the documents in each of your indexes.
Reports every index the caller's own org holds with its document count, plus
the org's total. isIndexing is always false because writes here are applied
before their response — there is never a background pass to wait on.
The tenant is the org minted from the VALIDATED bearer's owner claim, never a
client-supplied header, so this counts the caller's own documents and no
other tenant's. Without a validated principal the answer is 403 carrying the
dialect's invalid_api_key body.
Request
GET /v1/index/stats takes no parameters and no body — the credential is the whole request.
Response
| Status | Body | Meaning |
|---|---|---|
200 | indexStats | ok |
200 body — 5 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
databaseSize | body | integer | — | DatabaseSize is the org's total document count across its indexes. |
indexes | body | object | — | Indexes maps each index uid to its own count. |
indexes.* | body | indexCount | — | |
indexes.*.isIndexing | body | boolean | — | IsIndexing is always false: writes are applied before their response, so there is never a background pass a caller could be waiting on. |
indexes.*.numberOfDocuments | body | integer | — | NumberOfDocuments is how many documents this org holds in that index. |
Failure carries the platform error shape — see Errors.
Examples
hanzo index statsimport { Configuration, IndexApi } from 'hanzoai';
const api = new IndexApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getIndexStats();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import IndexApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = IndexApi(client).get_index_stats()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.IndexAPI.GetIndexStats(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, index_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = index_api::get_index_stats(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IndexApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new IndexApi(client).getIndexStats();curl https://api.hanzo.ai/v1/index/stats \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches index through the index tool, which names its 17 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "get_index_health"
}
}
}'How is this guide?