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

# Workspace analytics

> Returns aggregate analytics for a workspace: stored-file totals with a per-kind breakdown, detection health (status mix, error rate, and durations), and inference token usage (workspace totals plus a per-model breakdown). Breakdowns list every kind/status, zero-filled, in a stable order.



## OpenAPI

````yaml /api-reference/openapi.json get /workspaces/{workspaceId}/analytics
openapi: 3.1.0
info:
  title: Nvisy API
  summary: Document detection and redaction platform
  description: >-
    Nvisy provides intelligent detection of sensitive content in documents,
    redaction pipelines, and reviewer workflows. This API enables document
    upload, detection analysis, redaction, and collaborative review across your
    workspaces.
  termsOfService: https://nvisy.com/legal/terms-of-service
  contact:
    name: Nvisy Support
    url: https://nvisy.com
    email: hello@nvisy.com
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.1.0
servers: []
security: []
tags:
  - name: Health
    description: Service health checks
  - name: Capabilities
    description: Read-only reference data describing this deployment
  - name: Accounts
    description: Account management and profile operations
  - name: Identities
    description: 'Account sign-in methods: password and linked providers'
  - name: Avatars
    description: Public avatar image serving
  - name: Authentication
    description: Login, signup, and token management
  - name: Workspaces
    description: Workspace creation and management
  - name: Activities
    description: Workspace activity log and export
  - name: Documents
    description: Document upload, download, and management
  - name: Analytics
    description: Aggregate metrics over a workspace's documents
  - name: Members
    description: Workspace member management
  - name: Invites
    description: Workspace invitation handling
  - name: API Tokens
    description: API token management
  - name: Connections
    description: External provider connections
  - name: Connection Syncs
    description: Connection synchronization runs
  - name: Providers
    description: Inference-provider configuration
  - name: Pipelines
    description: Redaction pipeline configuration
  - name: Detections
    description: Detection analysis and redaction
  - name: Redactions
    description: Redactions produced from a detection, with reviewer edits
  - name: Reviews
    description: Document reviews, the review queue, and their discussion
  - name: Policies
    description: Redaction policy configuration
  - name: Webhooks
    description: Webhook configuration
  - name: Notifications
    description: Account notification management
paths:
  /workspaces/{workspaceId}/analytics:
    get:
      tags:
        - Analytics
      summary: Workspace analytics
      description: >-
        Returns aggregate analytics for a workspace: stored-file totals with a
        per-kind breakdown, detection health (status mix, error rate, and
        durations), and inference token usage (workspace totals plus a per-model
        breakdown). Breakdowns list every kind/status, zero-filled, in a stable
        order.
      parameters:
        - in: path
          name: workspaceId
          description: Workspace identifier.
          required: true
          schema:
            description: Workspace identifier.
            type: string
            format: uuid
          style: simple
      responses:
        '200':
          description: >-
            Aggregate analytics for a workspace: what it stores, how its
            detections fare, and

            the inference tokens they spent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkspaceAnalytics'
        '401':
          description: >-
            The serialized shape of an HTTP error: the inert wire/OpenAPI-schema
            view

            that [`Error`] renders to at the response boundary.


            It carries no builder logic — [`Error`] is the type handlers
            construct and

            thread through `Result`, and it builds an `ErrorResponse` directly
            in its

            `IntoResponse` impl. `context` and `status` are not part of the JSON
            body

            (`context` is logged, `status` sets the HTTP status line).


            [`Error`]: crate::response::Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            The serialized shape of an HTTP error: the inert wire/OpenAPI-schema
            view

            that [`Error`] renders to at the response boundary.


            It carries no builder logic — [`Error`] is the type handlers
            construct and

            thread through `Result`, and it builds an `ErrorResponse` directly
            in its

            `IntoResponse` impl. `context` and `status` are not part of the JSON
            body

            (`context` is logged, `status` sets the HTTP status line).


            [`Error`]: crate::response::Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            The serialized shape of an HTTP error: the inert wire/OpenAPI-schema
            view

            that [`Error`] renders to at the response boundary.


            It carries no builder logic — [`Error`] is the type handlers
            construct and

            thread through `Result`, and it builds an `ErrorResponse` directly
            in its

            `IntoResponse` impl. `context` and `status` are not part of the JSON
            body

            (`context` is logged, `status` sets the HTTP status line).


            [`Error`]: crate::response::Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    WorkspaceAnalytics:
      description: >-
        Aggregate analytics for a workspace: what it stores, how its detections
        fare, and

        the inference tokens they spent.
      type: object
      properties:
        detections:
          description: 'Detection health: volume, status mix, and durations.'
          allOf:
            - $ref: '#/components/schemas/WorkspaceDetectionAnalytics'
        storage:
          description: Stored-file totals and their per-kind breakdown.
          allOf:
            - $ref: '#/components/schemas/WorkspaceStorageAnalytics'
        usage:
          description: 'Inference token usage: workspace totals and a per-model breakdown.'
          allOf:
            - $ref: '#/components/schemas/WorkspaceUsageAnalytics'
      required:
        - storage
        - detections
        - usage
    ErrorResponse:
      description: >-
        The serialized shape of an HTTP error: the inert wire/OpenAPI-schema
        view

        that [`Error`] renders to at the response boundary.


        It carries no builder logic — [`Error`] is the type handlers construct
        and

        thread through `Result`, and it builds an `ErrorResponse` directly in
        its

        `IntoResponse` impl. `context` and `status` are not part of the JSON
        body

        (`context` is logged, `status` sets the HTTP status line).


        [`Error`]: crate::response::Error
      type: object
      properties:
        message:
          description: User-friendly error message safe for client display.
          type: string
        name:
          description: The error name/type identifier.
          type: string
      required:
        - name
        - message
    WorkspaceDetectionAnalytics:
      description: Detection health for a workspace.
      type: object
      properties:
        avgDurationMs:
          description: |-
            Mean completed-detection duration in milliseconds; omitted until a
            detection completes.
          type: integer
          format: int64
        byStatus:
          description: >-
            Per-status breakdown, one entry per detection status (zero-filled),
            in a

            stable order.
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceDetectionStatusEntry'
        errorRate:
          description: >-
            Failed / (completed + failed). Omitted when no detection has reached
            a

            terminal state (genuinely no signal, not zero).
          type: number
          format: double
        p95DurationMs:
          description: >-
            95th-percentile completed-detection duration in milliseconds;
            omitted until

            a detection completes.
          type: integer
          format: int64
        total:
          description: Total number of detections.
          type: integer
          format: int64
      required:
        - total
        - byStatus
    WorkspaceStorageAnalytics:
      description: Storage totals across a workspace's live files.
      type: object
      properties:
        byKind:
          description: >-
            Per-kind breakdown, one entry per document `kind` (zero-filled), in
            a

            stable order.
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceStorageKindEntry'
        fileCount:
          description: Number of live files.
          type: integer
          format: int64
        totalBytes:
          description: Total bytes of all live files.
          type: integer
          format: int64
      required:
        - totalBytes
        - fileCount
        - byKind
    WorkspaceUsageAnalytics:
      description: Inference token usage across a workspace's detections.
      type: object
      properties:
        byModel:
          description: Per-model breakdown, one entry per model used, in a stable order.
          type: array
          items:
            $ref: '#/components/schemas/WorkspaceModelUsageEntry'
        inputTokens:
          description: Total input/prompt tokens across all models.
          type: integer
          format: int64
        outputTokens:
          description: Total output/completion tokens across all models.
          type: integer
          format: int64
        totalTokens:
          description: |-
            Total tokens as reported across all models (not necessarily input +
            output).
          type: integer
          format: int64
      required:
        - inputTokens
        - outputTokens
        - totalTokens
        - byModel
    WorkspaceDetectionStatusEntry:
      description: One status's share of a workspace's detections.
      type: object
      properties:
        count:
          description: Number of detections in this status.
          type: integer
          format: int64
        status:
          description: The detection status.
          allOf:
            - $ref: '#/components/schemas/DetectionStatus'
      required:
        - status
        - count
    WorkspaceStorageKindEntry:
      description: One document `kind`'s share of a workspace's storage.
      type: object
      properties:
        fileCount:
          description: Number of live documents of this kind.
          type: integer
          format: int64
        kind:
          description: The document kind.
          allOf:
            - $ref: '#/components/schemas/DocumentKind'
        totalBytes:
          description: Total bytes of live documents of this kind.
          type: integer
          format: int64
      required:
        - kind
        - fileCount
        - totalBytes
    WorkspaceModelUsageEntry:
      description: One model's token usage across a workspace's detections.
      type: object
      properties:
        inputTokens:
          description: Input/prompt tokens summed for this model (`0` if never reported).
          type: integer
          format: int64
        model:
          description: The model.
          type: string
        outputTokens:
          description: >-
            Output/completion tokens summed for this model (`0` if never
            reported).
          type: integer
          format: int64
        totalTokens:
          description: Reported total tokens summed for this model (`0` if never reported).
          type: integer
          format: int64
      required:
        - model
        - inputTokens
        - outputTokens
        - totalTokens
    DetectionStatus:
      description: >-
        The execution status of a detection (one analysis pass of a file).


        Corresponds to the `DETECTION_STATUS` `PostgreSQL` enum. A detection is

        `Pending` (enqueued, no worker yet), then `Executing` (a worker is
        actively

        analyzing), then settles into `Complete` (analysis done, ready to
        redact)

        or `Failed`. Redaction is a separate, repeatable action over a complete

        detection and does not change this status.
      oneOf:
        - description: Enqueued for detection; no worker has picked it up yet.
          type: string
          const: pending
        - description: A worker is actively analyzing the document.
          type: string
          const: executing
        - description: Analysis done; the detection is ready to redact.
          type: string
          const: complete
        - description: Detection failed with an error.
          type: string
          const: failed
    DocumentKind:
      description: |-
        The kind of a human-facing document.

        Corresponds to the `DOCUMENT_KIND` `PostgreSQL` enum. Machine byproducts
        (detection audits, review audits, enrichment intermediates) are not
        documents — they reference blobs directly from their own tables.
      oneOf:
        - description: Source document, uploaded or imported.
          type: string
          const: original
        - description: Redacted output produced by a redaction.
          type: string
          const: redacted

````