---
title: "get_workspace_stats"
method: GET
path: "/v1/workspaces/{workspace_id}/stats"
tags: ["workspaces"]
---

# get_workspace_stats

`GET /v1/workspaces/{workspace_id}/stats`

## Request

- Base URL: `https://ndi-api.nace.ai`
- URL: `https://ndi-api.nace.ai/v1/workspaces/{workspace_id}/stats`
- Auth: API key in header `X-API-Key`
- TypeScript: <https://skmtc.dev/nace/apis/ndi-platform-api/docs/v1/workspaces/:workspace_id/stats/get.ts> (a function with typed inputs; its response is checked against the schema)

Compute workspace content statistics. Cost class: fast.

Returns file counts, byte totals, ingestion timestamps, and expiry
information — enough for a caller to determine whether the workspace needs
ingestion or a re-ingest without paging through ``list_files``.

``kg_nodes`` / ``kg_edges`` describe the workspace's published knowledge
graph, and are zero until a build has finished one. They come from the
build's own record rather than the graph itself, so this stays a fast read;
an unreachable graph store reports zero rather than failing the request.

## Path parameters

- `workspace_id` string, uuid, required: Workspace identifier.

## Response `200`

Successful Response

- WorkspaceStats: Per-workspace content summary. ``files_by_ingestion_status`` is the completeness instrument: a caller does not need to page through ``list_files`` to know whether anything is stale. ``stale > 0`` means observed and ingested hashes diverged — call ``POST .../ingestions`` with ``stale_only=true`` to catch up. ``expired > 0`` means derived representations were dropped by retention; a re-ingest is needed to make those files searchable again.
  - `bytes_total` integer, required
  - `files_by_ingestion_status` object, required
  - `files_expiring_within_7d` integer, required
  - `files_total` integer, required
  - `index_documents` integer, required
  - `kg_edges` integer, required: Edges in the workspace's published knowledge graph; 0 when none is built.
  - `kg_nodes` integer, required: Nodes in the workspace's published knowledge graph; 0 when none is built.
  - `last_ingestion_at` string, date-time, nullable, required
  - `last_reconciliation_at` string, date-time, nullable, required
  - `next_expiry_at` string, date-time, nullable, required: Earliest artifact ``expires_at``; null when nothing expires.
  - `pages_ingested` integer, required

## Other responses

- `504`: Gateway Timeout
- `default`: Typed error envelope used by every 4xx and 5xx. ``error.code`` distinguishes the failure; HTTP status is a consequence of the code.

---

[API](https://skmtc.dev/nace/apis/ndi-platform-api.md) - [All operations](https://skmtc.dev/nace/apis/ndi-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nace/apis/ndi-platform-api/revisions/d002a3589a67?raw)
