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

# Get trace stats

> **Auth:** organization API key (`read` scope or higher) or a signed-in user.

Aggregate calls, tokens, latency and policy/guardrail counts for `proxy_id`, `from`, `to`.



## OpenAPI

````yaml https://cp.xenovia.io/openapi.json get /api/v1/traces/stats
openapi: 3.1.0
info:
  title: Xenovia Control Plane API
  version: 1.0.0
  description: >-
    Management API for proxies, providers, policies, telemetry, alerts and
    organization settings.
servers:
  - url: https://cp.xenovia.io
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v1/traces/stats:
    get:
      tags:
        - sessions
      summary: Get trace stats
      description: >-
        **Auth:** organization API key (`read` scope or higher) or a signed-in
        user.


        Aggregate calls, tokens, latency and policy/guardrail counts for
        `proxy_id`, `from`, `to`.
      operationId: trace_stats_api_v1_traces_stats_get
      parameters:
        - name: proxy_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Proxy Id
        - name: from
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: From
        - name: to
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: To
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraceStatsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TraceStatsResponse:
      properties:
        total_calls:
          type: integer
          title: Total Calls
        total_tokens:
          type: integer
          title: Total Tokens
        avg_latency_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Latency Ms
        blocked_calls:
          type: integer
          title: Blocked Calls
        redacted_calls:
          type: integer
          title: Redacted Calls
        policy_evaluations:
          type: integer
          title: Policy Evaluations
          default: 0
        guardrail_evaluations:
          type: integer
          title: Guardrail Evaluations
          default: 0
      type: object
      required:
        - total_calls
        - total_tokens
        - avg_latency_ms
        - blocked_calls
        - redacted_calls
      title: TraceStatsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token: an organization API key (`ak_…`) created under Settings →
        API Keys, or a dashboard user session token. Proxy keys (`xe_…`) are not
        accepted here. Endpoints marked as user-only in their description reject
        organization keys with `403`.

````