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

# Time-series analytics

> Bucketed analytics (message volume, runs, conversations, response times, cost-over-time).



## OpenAPI

````yaml /api-reference/openapi.json get /api/metrics/analytics
openapi: 3.1.0
info:
  title: Tedro API
  version: 1.0.0
  description: REST API for the Tedro communication operations platform.
servers:
  - url: https://api.tedro.io
    description: Production
security:
  - sessionCookie: []
    workspaceId: []
paths:
  /api/metrics/analytics:
    get:
      tags:
        - Metrics
      summary: Time-series analytics
      description: >-
        Bucketed analytics (message volume, runs, conversations, response times,
        cost-over-time).
      parameters:
        - schema:
            type: string
            enum:
              - 24h
              - 7d
              - 30d
              - custom
            description: Preset range. Use "custom" with from/to for explicit windows.
          required: false
          description: Preset range. Use "custom" with from/to for explicit windows.
          name: range
          in: query
        - schema:
            type: string
            description: ISO 8601 datetime (required when range=custom)
          required: false
          description: ISO 8601 datetime (required when range=custom)
          name: from
          in: query
        - schema:
            type: string
            description: ISO 8601 datetime (required when range=custom)
          required: false
          description: ISO 8601 datetime (required when range=custom)
          name: to
          in: query
      responses:
        '200':
          description: Bucketed analytics payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsAnalyticsResponse'
        '400':
          description: Bad Request - invalid or missing parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized - missing or invalid session cookie
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - insufficient role (admin required)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - sessionCookie: []
          workspaceId: []
components:
  schemas:
    MetricsAnalyticsResponse:
      type: object
      properties:
        messageVolume:
          type: array
          items:
            type: object
            properties:
              bucket:
                type: string
              inbound:
                type: number
              outbound:
                type: number
            required:
              - bucket
              - inbound
              - outbound
        workflowRuns:
          type: array
          items:
            type: object
            properties:
              bucket:
                type: string
              succeeded:
                type: number
              failed:
                type: number
              running:
                type: number
            required:
              - bucket
              - succeeded
              - failed
              - running
        conversationTrends:
          type: array
          items:
            type: object
            properties:
              bucket:
                type: string
              newConversations:
                type: number
            required:
              - bucket
              - newConversations
        responseTimes:
          type: array
          items:
            type: object
            properties:
              bucket:
                type: string
              avgMs:
                type: number
            required:
              - bucket
              - avgMs
        costOverTime:
          type: array
          items:
            type: object
            properties:
              bucket:
                type: string
              totalUsd:
                type: number
            required:
              - bucket
              - totalUsd
      required:
        - messageVolume
        - workflowRuns
        - conversationTrends
        - responseTimes
        - costOverTime
      additionalProperties: {}
      description: >-
        Time-series analytics bucketed by hour/day (shape may include summary
        totals)
    ValidationErrorResponse:
      type: object
      properties:
        error:
          type: string
        details:
          type: array
          items:
            type: object
            properties:
              path:
                type: string
              message:
                type: string
            required:
              - path
              - message
      required:
        - error
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    sessionCookie:
      type: apiKey
      in: cookie
      name: better-auth.session_token
      description: Session cookie set by Better Auth on sign-in.
    workspaceId:
      type: apiKey
      in: header
      name: x-workspace-id
      description: Workspace UUID. Required on all /api/* endpoints.

````