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

# Get consolidated statistics

> Returns all agents with their call statistics and all call details in a single response.



## OpenAPI

````yaml https://originshq.b-cdn.net/openapi_sayna.json get /api/stats
openapi: 3.1.0
info:
  title: core
  version: 0.1.0
servers: []
security: []
paths:
  /api/stats:
    get:
      tags:
        - stats
      summary: Get consolidated statistics
      description: >-
        Returns all agents with their call statistics and all call details in a
        single response.
      operationId: get_stats_api_stats_get
      parameters:
        - name: agent_ids
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Agent Ids
        - name: enabled_only
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Enabled Only
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsolidatedStatsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ConsolidatedStatsResponse:
      properties:
        agents:
          items:
            $ref: '#/components/schemas/SlimAgent'
          type: array
          title: Agents
        call_details:
          items:
            $ref: '#/components/schemas/SlimCallStat'
          type: array
          title: Call Details
      type: object
      required:
        - agents
        - call_details
      title: ConsolidatedStatsResponse
      description: Slim response schema for the consolidated stats endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SlimAgent:
      properties:
        id:
          type: integer
          title: Id
        agent_name:
          type: string
          title: Agent Name
        enabled:
          type: boolean
          title: Enabled
        call_type:
          $ref: '#/components/schemas/CallType'
        call_stats:
          items:
            $ref: '#/components/schemas/SlimCallStat'
          type: array
          title: Call Stats
          default: []
      type: object
      required:
        - id
        - agent_name
        - enabled
        - call_type
      title: SlimAgent
      description: Agent fields needed by the dashboard.
    SlimCallStat:
      properties:
        call_status:
          $ref: '#/components/schemas/CallStatusOptions'
          default: QUEUED
        call_duration:
          anyOf:
            - type: number
            - type: 'null'
          title: Call Duration
        billed_duration:
          anyOf:
            - type: number
            - type: 'null'
          title: Billed Duration
        initiation_time:
          anyOf:
            - type: string
            - type: 'null'
          title: Initiation Time
        from_number:
          anyOf:
            - type: string
            - type: 'null'
          title: From Number
        call_direction:
          $ref: '#/components/schemas/CallDirectionOptions'
          default: inbound
        recording_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Recording Id
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
      type: object
      title: SlimCallStat
      description: Minimal call record fields needed by the dashboard.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    CallType:
      type: string
      enum:
        - INCOMING
        - OUTGOING
      title: CallType
    CallStatusOptions:
      type: string
      enum:
        - ANSWERED
        - FAILED
        - INITIATED
        - QUEUED
      title: CallStatusOptions
    CallDirectionOptions:
      type: string
      enum:
        - inbound
        - outbound
      title: CallDirectionOptions

````