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

# Stats Timeseries

> date_bin-bucketed counts/tokens/cost, optionally split by model or agent.
`agent_id` filters to one agent (composable with group_by=model).



## OpenAPI

````yaml /api-reference/openapi.json get /v1/workspaces/{workspace_id}/stats/timeseries
openapi: 3.1.0
info:
  title: Visceral Backend
  version: 0.2.0
  description: >-
    The Visceral backend HTTP API. SDK and ingestion endpoints authenticate with
    a workspace API key; dashboard and CLI endpoints authenticate with a user
    session token. Both are sent as `Authorization: Bearer <token>`.
servers:
  - url: https://api.visceralai.dev
security: []
paths:
  /v1/workspaces/{workspace_id}/stats/timeseries:
    get:
      tags:
        - stats
      summary: Stats Timeseries
      description: >-
        date_bin-bucketed counts/tokens/cost, optionally split by model or
        agent.

        `agent_id` filters to one agent (composable with group_by=model).
      operationId: stats_timeseries_v1_workspaces__workspace_id__stats_timeseries_get
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace 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
        - name: bucket
          in: query
          required: false
          schema:
            enum:
              - minute
              - hour
              - day
            type: string
            default: hour
            title: Bucket
        - name: group_by
          in: query
          required: false
          schema:
            enum:
              - none
              - model
              - agent_id
            type: string
            default: none
            title: Group By
        - name: agent_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Agent Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TimeseriesPoint'
                title: >-
                  Response Stats Timeseries V1 Workspaces  Workspace Id  Stats
                  Timeseries Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - sessionToken: []
components:
  schemas:
    TimeseriesPoint:
      properties:
        bucket:
          type: string
          format: date-time
          title: Bucket
        group:
          anyOf:
            - type: string
            - type: 'null'
          title: Group
        events:
          type: integer
          title: Events
        llm_calls:
          type: integer
          title: Llm Calls
        errors:
          type: integer
          title: Errors
        input_tokens:
          type: integer
          title: Input Tokens
        output_tokens:
          type: integer
          title: Output Tokens
        cost_usd:
          type: number
          title: Cost Usd
      type: object
      required:
        - bucket
        - group
        - events
        - llm_calls
        - errors
        - input_tokens
        - output_tokens
        - cost_usd
      title: TimeseriesPoint
    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:
    sessionToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Short-lived user access token (ES256 JWT) issued by `POST
        /v1/auth/login` or the CLI device flow.

````