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

# Get an analysis snapshot

> One call with what an analysing agent needs to start: agent settings, knowledge by type and status, failed sources, a gap summary, answer stats for the last 30 days and the latest test run. Sections the key or plan cannot see are null and listed in `unavailable`. `links` names the detail endpoints.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/agents/{agentId}/analysis-snapshot
openapi: 3.0.0
info:
  title: Totebot Public API
  description: >-
    Manage your agents (settings, instructions, widget, skills, actions, MCP
    connections, integrations), their knowledge, test questions, the help desk,
    customers and your team from code, read conversations and analytics, and
    analyse which knowledge each answer used.


    Authenticate with a Bearer token: a team API key (`tb_live_…`, created by a
    team owner in Team settings → API keys) or a legacy per-agent key.

    New keys can only read. Write access is opt-in per area (`agents:write`,
    `plugins:write`, `knowledge:write`, `conversations:write`, `helpdesk:write`,
    `team:write`, `members:write`, `chat:write`, `customers:delete`,
    `quality:write`, `experiments:write`, `sales:write`). Provider cost in USD
    needs the opt-in `billing:read` scope. A key may also be limited to some
    agents.

    Routes that act on one agent take it from the `agentId` path parameter or,
    on the older `/v1/<resource>` routes, from the `X-Agent-Id` header.

    Write routes accept an `Idempotency-Key` header. Over the rate limit you get
    429 with `Retry-After`. Errors share one shape: `{ status: "error", error: {
    code, message, details } }`.

    Not available through the API, on purpose: billing and plan changes,
    deleting the team, creating or changing API keys, and OAuth connect flows.


    This spec is public at https://api.totebot.ai/v1/openapi.json (and .yaml).
  version: '2.0'
  contact: {}
servers:
  - url: https://api.totebot.ai
security: []
tags: []
paths:
  /v1/agents/{agentId}/analysis-snapshot:
    get:
      tags:
        - Analysis
      summary: Get an analysis snapshot
      description: >-
        One call with what an analysing agent needs to start: agent settings,
        knowledge by type and status, failed sources, a gap summary, answer
        stats for the last 30 days and the latest test run. Sections the key or
        plan cannot see are null and listed in `unavailable`. `links` names the
        detail endpoints.
      operationId: PublicApiAnalysisController_snapshot
      parameters:
        - name: agentId
          required: true
          in: path
          schema: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalysisSnapshotDto'
        '400':
          description: Invalid request, or rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '401':
          description: Missing, invalid, revoked or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '403':
          description: >-
            The plan lacks the feature, or the key lacks a scope
            (`error.details.missingScopes`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
        '404':
          description: Not found, or not an agent this key can access.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorDto'
      security:
        - api-key: []
components:
  schemas:
    AnalysisSnapshotDto:
      type: object
      properties:
        generatedAt:
          type: string
          format: date-time
        agent:
          $ref: '#/components/schemas/SnapshotAgentDto'
        knowledge:
          $ref: '#/components/schemas/SnapshotKnowledgeDto'
        gaps:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/SnapshotGapsDto'
        answerStats:
          nullable: true
          description: Last 30 days; lists cut to 10 items.
          allOf:
            - $ref: '#/components/schemas/AnswerStatsDto'
        testQuestions:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/SnapshotTestsDto'
        unavailable:
          description: >-
            Sections left out (null above) because of the key scopes or the
            plan.
          type: array
          items:
            $ref: '#/components/schemas/UnavailableSectionDto'
        links:
          type: object
          additionalProperties:
            type: string
          description: Detail endpoints for the next steps.
      required:
        - generatedAt
        - agent
        - knowledge
        - gaps
        - answerStats
        - testQuestions
        - unavailable
        - links
    ApiErrorDto:
      type: object
      properties:
        status:
          type: string
          example: error
        error:
          $ref: '#/components/schemas/ApiErrorBodyDto'
        path:
          type: string
          example: /v1/agents/clx123
        timestamp:
          type: string
          example: '2026-11-24T10:00:00.000Z'
      required:
        - status
        - error
        - path
        - timestamp
    SnapshotAgentDto:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        language:
          type: string
          nullable: true
        model:
          $ref: '#/components/schemas/SnapshotModelDto'
        temperature:
          type: number
        instructions:
          type: string
          description: The agent's own instructions, up to 4000 characters.
        instructionsTruncated:
          type: boolean
        lastTrainedAt:
          type: string
          nullable: true
          format: date-time
        autoRetrainEnabled:
          type: boolean
      required:
        - id
        - name
        - language
        - model
        - temperature
        - instructions
        - instructionsTruncated
        - lastTrainedAt
        - autoRetrainEnabled
    SnapshotKnowledgeDto:
      type: object
      properties:
        totalSources:
          type: number
        byTypeAndStatus:
          type: array
          items:
            $ref: '#/components/schemas/SourceCountDto'
        failedTotal:
          type: number
        failed:
          description: Up to 25.
          type: array
          items:
            $ref: '#/components/schemas/FailedSourceDto'
      required:
        - totalSources
        - byTypeAndStatus
        - failedTotal
        - failed
    SnapshotGapsDto:
      type: object
      properties:
        pending:
          type: number
        resolved:
          type: number
        dismissed:
          type: number
        pendingByVerification:
          description: Pending gaps by verification label.
          type: array
          items:
            $ref: '#/components/schemas/LabelCountDto'
        top:
          description: Up to 5 pending gaps, in the dashboard order.
          type: array
          items:
            $ref: '#/components/schemas/GapSummaryItemDto'
      required:
        - pending
        - resolved
        - dismissed
        - pendingByVerification
        - top
    AnswerStatsDto:
      type: object
      properties:
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        retentionDays:
          type: number
          description: >-
            Playground (PREVIEW) conversations are left out. Retrieval data is
            kept for this many days.
          example: 90
        retrievalDataAvailable:
          type: boolean
          description: >-
            False when the range starts before the retention cutoff and no
            retrieval events remain for it. Search-derived fields are then null,
            not 0.
        retrievalDataFrom:
          type: string
          nullable: true
          format: date-time
          description: >-
            Start of the period the search metrics cover: `from`, or the
            retention cutoff when `from` is older. Null when
            retrievalDataAvailable is false.
        retrievalNote:
          type: string
          nullable: true
          description: >-
            Explains how retention limits the search metrics for this range;
            null when it does not.
        turns:
          $ref: '#/components/schemas/TurnCountsDto'
        searches:
          nullable: true
          description: Null when retrievalDataAvailable is false.
          allOf:
            - $ref: '#/components/schemas/SearchCountsDto'
        topSources:
          description: Most returned sources, up to 20.
          type: array
          items:
            $ref: '#/components/schemas/SourceUsageDto'
        neverReturnedSources:
          nullable: true
          description: >-
            Live sources (not product-synced) that no search returned in the
            range, oldest first, up to 50. Null when retrievalDataAvailable is
            false.
          allOf:
            - $ref: '#/components/schemas/UnusedSourcesDto'
      required:
        - from
        - to
        - retentionDays
        - retrievalDataAvailable
        - retrievalDataFrom
        - retrievalNote
        - turns
        - searches
        - topSources
        - neverReturnedSources
    SnapshotTestsDto:
      type: object
      properties:
        questions:
          type: number
        lastCompletedRun:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/SnapshotTestRunDto'
      required:
        - questions
        - lastCompletedRun
    UnavailableSectionDto:
      type: object
      properties:
        section:
          type: string
          example: testQuestions
        reason:
          type: string
          example: Needs the quality:read scope.
      required:
        - section
        - reason
    ApiErrorBodyDto:
      type: object
      properties:
        code:
          type: string
          example: NotFoundException
        message:
          type: string
          example: Agent not found
        details:
          type: object
          description: >-
            Extra fields, e.g. `missingScopes` on 403 or `secondsRemaining` on a
            training cooldown.
          additionalProperties: true
      required:
        - code
        - message
    SnapshotModelDto:
      type: object
      properties:
        name:
          type: string
          example: GPT 5 mini
        value:
          type: string
          example: gpt-5-mini
      required:
        - name
        - value
    SourceCountDto:
      type: object
      properties:
        type:
          allOf:
            - $ref: '#/components/schemas/KnowledgeSourceType'
        status:
          allOf:
            - $ref: '#/components/schemas/KnowledgeSourceStatus'
        count:
          type: number
        characters:
          type: number
      required:
        - type
        - status
        - count
        - characters
    FailedSourceDto:
      type: object
      properties:
        sourceId:
          type: string
        title:
          type: string
          nullable: true
        type:
          allOf:
            - $ref: '#/components/schemas/KnowledgeSourceType'
        processingError:
          type: string
          nullable: true
      required:
        - sourceId
        - title
        - type
        - processingError
    LabelCountDto:
      type: object
      properties:
        verification:
          type: string
          description: MISSING, PARTIAL, RETRIEVAL_MISS or UNVERIFIED.
        count:
          type: number
      required:
        - verification
        - count
    GapSummaryItemDto:
      type: object
      properties:
        id:
          type: string
        question:
          type: string
        occurrences:
          type: number
        verification:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/KnowledgeGapVerification'
        signals:
          type: array
          items:
            $ref: '#/components/schemas/KnowledgeGapSignal'
      required:
        - id
        - question
        - occurrences
        - verification
        - signals
    TurnCountsDto:
      type: object
      properties:
        customerMessages:
          type: number
        botReplies:
          type: number
        withRetrieval:
          type: number
          nullable: true
          description: >-
            Customer messages for which at least one knowledge search,
            pre-search or product search ran. Null when retrievalDataAvailable
            is false.
        withoutRetrieval:
          type: number
          nullable: true
          description: >-
            Customer messages since retrievalDataFrom without any search. Null
            when retrievalDataAvailable is false.
        retrievalShare:
          type: number
          nullable: true
          description: >-
            withRetrieval / customer messages since retrievalDataFrom. Null when
            there were none, or when retrievalDataAvailable is false.
      required:
        - customerMessages
        - botReplies
        - withRetrieval
        - withoutRetrieval
        - retrievalShare
    SearchCountsDto:
      type: object
      properties:
        total:
          type: number
        empty:
          type: number
        failed:
          type: number
        emptyShare:
          type: number
          nullable: true
        byOrigin:
          type: array
          items:
            $ref: '#/components/schemas/OriginCountsDto'
      required:
        - total
        - empty
        - failed
        - emptyShare
        - byOrigin
    SourceUsageDto:
      type: object
      properties:
        sourceId:
          type: string
        title:
          type: string
          nullable: true
        type:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/KnowledgeSourceType'
        timesReturned:
          type: number
          description: Searches that returned this source.
      required:
        - sourceId
        - title
        - type
        - timesReturned
    UnusedSourcesDto:
      type: object
      properties:
        total:
          type: number
        items:
          type: array
          items:
            $ref: '#/components/schemas/UnusedSourceDto'
      required:
        - total
        - items
    SnapshotTestRunDto:
      type: object
      properties:
        id:
          type: string
        passed:
          type: number
        total:
          type: number
        passRate:
          type: number
          nullable: true
        completedAt:
          type: string
          nullable: true
          format: date-time
      required:
        - id
        - passed
        - total
        - passRate
        - completedAt
    KnowledgeSourceType:
      type: string
      enum:
        - DOC
        - QA
        - LINK
        - TEXT
        - SITEMAP
        - NOTION
    KnowledgeSourceStatus:
      type: string
      enum:
        - PENDING
        - PROCESSING
        - COMPLETED
        - FAILED
        - PENDING_DELETE
        - OVERLIMIT
      description: >-
        PENDING: waiting for training. PROCESSING: being trained. COMPLETED:
        live. FAILED: see processingError. OVERLIMIT: over the plan knowledge
        limit. PENDING_DELETE: leaves on the next training.
    KnowledgeGapVerification:
      type: string
      enum:
        - MISSING
        - PARTIAL
        - RETRIEVAL_MISS
    KnowledgeGapSignal:
      type: string
      enum:
        - JUDGE
        - NEGATIVE_FEEDBACK
        - HANDOVER
    OriginCountsDto:
      type: object
      properties:
        origin:
          allOf:
            - $ref: '#/components/schemas/RetrievalOrigin'
        searches:
          type: number
        empty:
          type: number
        failed:
          type: number
      required:
        - origin
        - searches
        - empty
        - failed
    UnusedSourceDto:
      type: object
      properties:
        sourceId:
          type: string
        title:
          type: string
          nullable: true
        type:
          allOf:
            - $ref: '#/components/schemas/KnowledgeSourceType'
        createdAt:
          type: string
          format: date-time
      required:
        - sourceId
        - title
        - type
        - createdAt
    RetrievalOrigin:
      type: string
      enum:
        - TOOL
        - PREFETCH
        - PRODUCT_FINDER
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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