---
title: "Get all document stats"
method: GET
path: "/api/v0/knowledge-bases/stats"
tags: ["Knowledge Bases"]
---

# Get all document stats

`GET /api/v0/knowledge-bases/stats`

Get component statistics across all of the user's documents.

## Response `200`

Successful Response

- KnowledgeBaseStatsResponse — Response for knowledge base component statistics.
  - `document_count` integer, required — The number of documents in the knowledge base.
  - `total_pages` integer, required — The total number of pages across all documents.
  - `component_counts` object, required — Component counts by type (e.g., table, flowchart, text).
  - `total_components` integer, required — The total number of components across all documents.
  - `document_stats` DocumentStatsItem[], required — Per-document component statistics.
    - `document_id` string, uuid, required — The public ID of the document.
    - `name` string, required — The name of the document.
    - `file_type` string, required — The file type of the document.
    - `num_pages` integer, required — The number of pages in the document.
    - `component_counts` object, required — Component counts by type for this document.
    - `total_components` integer, required — The total number of components in this document.
  - `page_type_stats` PageTypeStatsItem[] — Per-page-type component statistics.
    - `page_type` string, required — The page type (e.g., general_document, engineering_drawing), or 'unclassified' for pages the classifier never assigned a type.
    - `page_count` integer, required — The number of pages of this type.
    - `component_counts` object, required — Component counts by type across pages of this page type.
    - `total_components` integer, required — The total number of components on pages of this type.
    - `input_tokens` integer — Page-scoped input tokens for pages of this type.
    - `output_tokens` integer — Page-scoped output tokens for pages of this type.
    - `estimated_cost_usd` number — Estimated USD cost of page-scoped work for pages of this type. Document-level work (summarization, finalization) belongs to no page and is excluded, so these totals sit below the document total.
    - `num_calls` integer — Page-scoped LLM calls.
    - `duration_ms` integer — Page-scoped LLM call duration in milliseconds.

---

[API](https://skmtc.dev/outerport/apis/outerport-api.md) · [All operations](https://skmtc.dev/outerport/apis/outerport-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/outerport/outerport-api/revisions/f565b46daaea/schema)
