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

# get aggregated session analytics

> Returns aggregated latency analytics across sessions — percentile distributions (p50/p90/p95/p99/max/avg) for each stage of the transcription → LLM → TTS → first-audio path, interruption and error rates, tool call outcomes, and a sample of the slowest turns. Only sessions where Anam runs the conversational pipeline (turnkey, custom LLM and ElevenLabs agent sessions) produce analytics reports; LiveKit and audio-passthrough sessions count toward `sessionCount` but never carry analytics. Defaults to the last 24 hours; the maximum range is 31 days. At most the 1000 most recent report-bearing sessions are aggregated per request (the `truncated` field reports when this cap was hit) — narrow the time range or filters to analyse busier periods exhaustively.



## OpenAPI

````yaml https://api.anam.ai/swagger.json get /v1/sessions/analytics
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
  - name: Engine
paths:
  /v1/sessions/analytics:
    get:
      tags:
        - Sessions
      summary: get aggregated session analytics
      description: >-
        Returns aggregated latency analytics across sessions — percentile
        distributions (p50/p90/p95/p99/max/avg) for each stage of the
        transcription → LLM → TTS → first-audio path, interruption and error
        rates, tool call outcomes, and a sample of the slowest turns. Only
        sessions where Anam runs the conversational pipeline (turnkey, custom
        LLM and ElevenLabs agent sessions) produce analytics reports; LiveKit
        and audio-passthrough sessions count toward `sessionCount` but never
        carry analytics. Defaults to the last 24 hours; the maximum range is 31
        days. At most the 1000 most recent report-bearing sessions are
        aggregated per request (the `truncated` field reports when this cap was
        hit) — narrow the time range or filters to analyse busier periods
        exhaustively.
      operationId: getAggregatedSessionAnalytics
      parameters:
        - in: query
          name: from
          schema:
            type: string
            format: date-time
          description: >-
            Start of the time range (ISO 8601). Defaults to 24 hours before
            `to`.
        - in: query
          name: to
          schema:
            type: string
            format: date-time
          description: End of the time range (ISO 8601). Defaults to now.
        - in: query
          name: personaId
          schema:
            type: string
            format: uuid
          description: Only include sessions for this persona.
        - in: query
          name: apiKeyId
          schema:
            type: string
            format: uuid
          description: Only include sessions minted by this API key.
        - in: query
          name: clientLabel
          schema:
            type: string
          description: Only include sessions whose client label matches exactly.
        - in: query
          name: sessionType
          schema:
            type: string
            enum:
              - turnkey
              - custom_llm_server
              - custom_llm_client
              - livekit
              - elevenlabs_agent
          description: Only include sessions of this type.
      responses:
        '200':
          description: Successfully computed aggregate analytics
          content:
            application/json:
              schema:
                type: object
                properties:
                  from:
                    type: string
                    format: date-time
                  to:
                    type: string
                    format: date-time
                  filters:
                    type: object
                    description: Echo of the applied filters.
                    properties:
                      personaId:
                        type:
                          - string
                          - 'null'
                      apiKeyId:
                        type:
                          - string
                          - 'null'
                      clientLabel:
                        type:
                          - string
                          - 'null'
                      sessionType:
                        type:
                          - string
                          - 'null'
                  sessionCount:
                    type: integer
                    description: >-
                      Total sessions matching the filters in the range, whether
                      or not they produced an analytics report.
                  sessionsWithReports:
                    type: integer
                    description: >-
                      Sessions whose analytics report was aggregated (capped at
                      the 1000 most recent).
                  truncated:
                    type: boolean
                    description: >-
                      True when more report-bearing sessions matched than the
                      scan cap; only the most recent 1000 were aggregated.
                  turnCount:
                    type: integer
                  latencies:
                    type: object
                    description: >-
                      Percentile distributions per latency stage, computed
                      across all turns.
                    properties:
                      transcriptionLatencySeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      llmTimeToFirstOutputSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      llmGenerationDurationSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      ttsGenerationDurationSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      ttsTimeToFirstAudioSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      firstAudioLatencySeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      speakingDurationSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                      userSpeechDurationSeconds:
                        $ref: '#/components/schemas/LatencyStats'
                  counts:
                    type: object
                    properties:
                      completedTurns:
                        type: integer
                      interruptedTurns:
                        type: integer
                      interruptedBeforeAudioTurns:
                        type: integer
                        description: Turns interrupted before the persona started speaking.
                      totalErrors:
                        type: integer
                      totalWarnings:
                        type: integer
                      sessionsWithErrors:
                        type: integer
                      sessionsWithWarnings:
                        type: integer
                      toolCalls:
                        type: object
                        properties:
                          total:
                            type: integer
                          succeeded:
                            type: integer
                          failed:
                            type: integer
                          byName:
                            type: object
                            additionalProperties:
                              type: integer
                  rates:
                    type: object
                    properties:
                      interruptionRate:
                        type:
                          - number
                          - 'null'
                      interruptedBeforeAudioRate:
                        type:
                          - number
                          - 'null'
                      errorSessionRate:
                        type:
                          - number
                          - 'null'
                      warningSessionRate:
                        type:
                          - number
                          - 'null'
                      toolCallFailureRate:
                        type:
                          - number
                          - 'null'
                  slowestTurns:
                    type: array
                    description: >-
                      The slowest turns per headline latency metric, for jumping
                      straight to problem sessions.
                    items:
                      type: object
                      properties:
                        sessionId:
                          type: string
                          format: uuid
                        correlationId:
                          type:
                            - string
                            - 'null'
                        metric:
                          type: string
                          enum:
                            - transcriptionLatencySeconds
                            - llmTimeToFirstOutputSeconds
                            - ttsTimeToFirstAudioSeconds
                            - firstAudioLatencySeconds
                        valueSeconds:
                          type: number
                        sessionStartTime:
                          type: string
                          format: date-time
                        personaId:
                          type:
                            - string
                            - 'null'
                        clientLabel:
                          type:
                            - string
                            - 'null'
              examples:
                default:
                  $ref: '#/components/examples/SessionAnalyticsAggregateResponse'
        '400':
          description: Bad request - Invalid query parameters or date range
        '401':
          description: Unauthorized - Invalid or missing API key
        '500':
          description: Server error
components:
  schemas:
    LatencyStats:
      type: object
      description: >-
        Percentile distribution of a per-turn latency metric, in seconds. Values
        are null when no turn produced a usable measurement.
      properties:
        count:
          type: integer
          description: Number of turns that produced a usable value.
        avg:
          type:
            - number
            - 'null'
        p50:
          type:
            - number
            - 'null'
        p90:
          type:
            - number
            - 'null'
        p95:
          type:
            - number
            - 'null'
        p99:
          type:
            - number
            - 'null'
        max:
          type:
            - number
            - 'null'
  examples:
    SessionAnalyticsAggregateResponse:
      summary: Aggregated latency percentiles across sessions
      value:
        from: '2026-04-19T09:00:00.000Z'
        to: '2026-04-20T09:00:00.000Z'
        filters:
          personaId: null
          apiKeyId: null
          clientLabel: null
          sessionType: null
        sessionCount: 128
        sessionsWithReports: 121
        truncated: false
        turnCount: 1874
        latencies:
          transcriptionLatencySeconds:
            count: 1702
            avg: 0.34
            p50: 0.29
            p90: 0.52
            p95: 0.61
            p99: 0.94
            max: 1.87
          llmTimeToFirstOutputSeconds:
            count: 1698
            avg: 0.61
            p50: 0.54
            p90: 0.92
            p95: 1.18
            p99: 2.04
            max: 4.31
          llmGenerationDurationSeconds:
            count: 1698
            avg: 1.42
            p50: 1.31
            p90: 2.12
            p95: 2.54
            p99: 3.87
            max: 7.02
          ttsGenerationDurationSeconds:
            count: 1671
            avg: 1.18
            p50: 1.09
            p90: 1.74
            p95: 2.02
            p99: 2.98
            max: 5.44
          ttsTimeToFirstAudioSeconds:
            count: 1671
            avg: 0.41
            p50: 0.37
            p90: 0.62
            p95: 0.74
            p99: 1.12
            max: 2.36
          firstAudioLatencySeconds:
            count: 1698
            avg: 1.31
            p50: 1.18
            p90: 1.86
            p95: 2.21
            p99: 3.42
            max: 6.75
          speakingDurationSeconds:
            count: 1698
            avg: 7.85
            p50: 6.92
            p90: 13.41
            p95: 16.08
            p99: 22.6
            max: 41.19
          userSpeechDurationSeconds:
            count: 1702
            avg: 3.62
            p50: 3.11
            p90: 6.4
            p95: 7.83
            p99: 11.9
            max: 19.75
        counts:
          completedTurns: 1512
          interruptedTurns: 186
          interruptedBeforeAudioTurns: 22
          totalErrors: 4
          totalWarnings: 19
          sessionsWithErrors: 3
          sessionsWithWarnings: 11
          toolCalls:
            total: 96
            succeeded: 91
            failed: 5
            byName:
              lookup_order: 96
        rates:
          interruptionRate: 0.1095
          interruptedBeforeAudioRate: 0.013
          errorSessionRate: 0.0248
          warningSessionRate: 0.0909
          toolCallFailureRate: 0.0521
        slowestTurns:
          - sessionId: 00000000-0000-0000-0000-000000000000
            correlationId: corr-1042
            metric: firstAudioLatencySeconds
            valueSeconds: 6.75
            sessionStartTime: '2026-04-20T08:41:12.000Z'
            personaId: null
            clientLabel: js-sdk-api-key
          - sessionId: 00000000-0000-0000-0000-000000000000
            correlationId: corr-0311
            metric: llmTimeToFirstOutputSeconds
            valueSeconds: 4.31
            sessionStartTime: '2026-04-20T07:02:44.000Z'
            personaId: null
            clientLabel: js-sdk-api-key
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````