> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quivr.thevibecompany.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Get corpus stats

> Running eligible-document and catalog totals from transactional aggregates. Eligible documents have a current baseline-ready, non-quarantined Version and no withdrawal or tombstone. Catalog membership includes withdrawn and unready Record identities. Counts are independent of projection generations. All requested fields share one database snapshot at observed_at. complete=false and approximate=true mean historical initialization has not finished; partial zeros are not certified empty. Archived Corpora return 409 corpus_archived. Default reads return totals only. Include histogram and/or sources explicitly. History uses the CURRENT Version's acceptance time, stored in UTC hours; a correction moves its Record to the new hour. Day resolution groups UTC days. Local days can be reconstructed exactly only for whole-hour UTC offsets. Fractional-hour offsets require finer data and must not be labelled exact. History has no lifetime cutoff: each page covers at most 10000 consecutive buckets, with missing buckets zero only within its covered interval at observed_at when complete=true. Boundary days may be clipped by the requested time range. Consume histogram.next_page_cursor with histogram_cursor and repeat the original parameters. Sources use namespace plus trusted connector identity; historical and public submissions have connector_id unknown. Source counts are lifetime totals regardless of histogram bounds. Consume sources.next_page_cursor with sources_cursor. Each continuation is an independent snapshot; concurrent corrections can change earlier pages, so multiple pages are not one census. Cursors bind Corpus, authorization scope and every query option.



## OpenAPI

````yaml /openapi.yaml get /v0/corpora/{corpus_id}/stats
openapi: 3.1.0
info:
  title: Quivr HTTP API
  version: 0.0.0-draft
  description: >-
    Every endpoint of the Quivr v0 HTTP API. Send an API key as a bearer token;
    the key decides the Organization, the actions and the Corpora a request may
    reach.
servers: []
security:
  - ApiKey: []
paths:
  /v0/corpora/{corpus_id}/stats:
    get:
      tags:
        - Corpora
      summary: Get corpus stats
      description: >-
        Running eligible-document and catalog totals from transactional
        aggregates. Eligible documents have a current baseline-ready,
        non-quarantined Version and no withdrawal or tombstone. Catalog
        membership includes withdrawn and unready Record identities. Counts are
        independent of projection generations. All requested fields share one
        database snapshot at observed_at. complete=false and approximate=true
        mean historical initialization has not finished; partial zeros are not
        certified empty. Archived Corpora return 409 corpus_archived. Default
        reads return totals only. Include histogram and/or sources explicitly.
        History uses the CURRENT Version's acceptance time, stored in UTC hours;
        a correction moves its Record to the new hour. Day resolution groups UTC
        days. Local days can be reconstructed exactly only for whole-hour UTC
        offsets. Fractional-hour offsets require finer data and must not be
        labelled exact. History has no lifetime cutoff: each page covers at most
        10000 consecutive buckets, with missing buckets zero only within its
        covered interval at observed_at when complete=true. Boundary days may be
        clipped by the requested time range. Consume histogram.next_page_cursor
        with histogram_cursor and repeat the original parameters. Sources use
        namespace plus trusted connector identity; historical and public
        submissions have connector_id unknown. Source counts are lifetime totals
        regardless of histogram bounds. Consume sources.next_page_cursor with
        sources_cursor. Each continuation is an independent snapshot; concurrent
        corrections can change earlier pages, so multiple pages are not one
        census. Cursors bind Corpus, authorization scope and every query option.
      operationId: getCorpusStats
      parameters:
        - name: corpus_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
        - name: include
          in: query
          description: Comma-separated histogram and/or sources; omit for totals only.
          schema:
            type: string
        - name: resolution
          in: query
          description: Histogram grouping. Requires include=histogram.
          schema:
            type: string
            enum:
              - day
              - hour
            default: day
        - name: accepted_after
          in: query
          description: Inclusive histogram bound, RFC 3339 at a UTC-hour boundary.
          schema:
            type: string
            format: date-time
        - name: accepted_before
          in: query
          description: Exclusive histogram bound, RFC 3339 at a UTC-hour boundary.
          schema:
            type: string
            format: date-time
        - name: histogram_cursor
          in: query
          schema:
            type: string
            minLength: 1
        - name: sources_cursor
          in: query
          schema:
            type: string
            minLength: 1
        - name: source_limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
      responses:
        '200':
          description: Totals and any requested series.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CorpusStats'
        default:
          description: Structured error; see contract HTTP mapping.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CorpusStats:
      type: object
      additionalProperties: false
      required:
        - corpus_id
        - total
        - catalog_total
        - undated_total
        - catalog_undated_total
        - observed_at
        - approximate
        - complete
      properties:
        corpus_id:
          type: string
        total:
          type: integer
          format: int64
          minimum: 0
        catalog_total:
          type: integer
          format: int64
          minimum: 0
        undated_total:
          type: integer
          format: int64
          minimum: 0
        catalog_undated_total:
          type: integer
          format: int64
          minimum: 0
        first_catalog_hour:
          type: string
          format: date-time
          description: >-
            First occupied catalog UTC hour; not the exact first acceptance
            time. Absent for an undated or empty corpus.
        last_catalog_hour:
          type: string
          format: date-time
          description: Last occupied catalog UTC hour; not the exact last acceptance time.
        observed_at:
          type: string
          format: date-time
        approximate:
          type: boolean
        complete:
          type: boolean
        histogram:
          $ref: '#/components/schemas/CorpusStatsHistogram'
        sources:
          $ref: '#/components/schemas/CorpusStatsSources'
    Error:
      type: object
      additionalProperties: false
      properties:
        request_id:
          type: string
          description: Bounded caller X-Request-ID, or an engine-generated correlation ID.
        trace_id:
          type: string
          description: W3C trace ID when a trace context is present.
        span_id:
          type: string
          description: W3C span ID of the API handler when a trace context is present.
        code:
          type: string
          minLength: 1
        message:
          type: string
          minLength: 1
        retryable:
          type: boolean
        field:
          type: string
          minLength: 1
          description: >-
            JSON Pointer (RFC 6901) to the request member that caused a 422,
            when known (for example /config/url or /credential/secret/token on
            connector commands).
        resync_url:
          type: string
          format: uri-reference
      required:
        - code
        - message
        - retryable
    CorpusStatsHistogram:
      type: object
      additionalProperties: false
      required:
        - from
        - to
        - resolution_seconds
        - items
      properties:
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        resolution_seconds:
          type: integer
          enum:
            - 3600
            - 86400
        items:
          type: array
          maxItems: 10000
          items:
            type: object
            additionalProperties: false
            required:
              - start
              - count
              - catalog_count
            properties:
              start:
                type: string
                format: date-time
              count:
                type: integer
                format: int64
                minimum: 0
              catalog_count:
                type: integer
                format: int64
                minimum: 0
        next_page_cursor:
          type: string
          minLength: 1
    CorpusStatsSources:
      type: object
      additionalProperties: false
      required:
        - items
      properties:
        items:
          type: array
          maxItems: 1000
          items:
            type: object
            additionalProperties: false
            required:
              - namespace
              - connector_id
              - count
              - catalog_count
            properties:
              namespace:
                type: string
              connector_id:
                type: string
                description: >-
                  Trusted accepting connector instance, or the explicit unknown
                  bucket for historical/public submissions.
              count:
                type: integer
                format: int64
                minimum: 0
              catalog_count:
                type: integer
                format: int64
                minimum: 0
        next_page_cursor:
          type: string
          minLength: 1
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      description: >-
        API key, not necessarily a JWT. Server derives Organization, permitted
        actions and Corpus scope; every resource access is authorized.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.