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

# Get Usage Aggregate

> Aggregate usage (agentic and cached steps) for a given date range.

Two modes are supported:
- **simulated** (default): Uses total_agentic_steps and total_cached_steps from usage_metadata,
  but excludes runs where billing_outcome is 'infra_failure' (these would have been free).
  Use this for customers not yet on Stripe billing.
- **billed**: Uses total_agentic_steps_billed and total_cached_steps_billed.
  Use this for customers on active Stripe billing.



## OpenAPI

````yaml /openapi.json get /v1/usage/aggregate
openapi: 3.1.0
info:
  title: Cyberdesk Cloud
  description: >-
    The Cyberdesk API provides programmatic access to all platform features,
    enabling you to automate desktop tasks at scale.
  version: 1.0.0
servers:
  - url: https://api.cyberdesk.io
    description: Production server
  - url: https://cyberdesk-api-dev.fly.dev
    description: Development server
security: []
paths:
  /v1/usage/aggregate:
    get:
      tags:
        - usage
      summary: Get Usage Aggregate
      description: >-
        Aggregate usage (agentic and cached steps) for a given date range.


        Two modes are supported:

        - **simulated** (default): Uses total_agentic_steps and
        total_cached_steps from usage_metadata,
          but excludes runs where billing_outcome is 'infra_failure' (these would have been free).
          Use this for customers not yet on Stripe billing.
        - **billed**: Uses total_agentic_steps_billed and
        total_cached_steps_billed.
          Use this for customers on active Stripe billing.
      operationId: get_usage_aggregate_v1_usage_aggregate_get
      parameters:
        - name: from_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
            description: Start of period (inclusive, ISO format)
            title: From Date
          description: Start of period (inclusive, ISO format)
        - name: to_date
          in: query
          required: true
          schema:
            type: string
            format: date-time
            description: End of period (exclusive, ISO format)
            title: To Date
          description: End of period (exclusive, ISO format)
        - name: mode
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/UsageMode'
            description: 'Usage counting mode: ''simulated'' or ''billed'''
            default: simulated
          description: 'Usage counting mode: ''simulated'' or ''billed'''
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageAggregateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    UsageMode:
      type: string
      enum:
        - simulated
        - billed
      title: UsageMode
      description: Mode for counting usage steps.
    UsageAggregateResponse:
      properties:
        total_agentic_steps:
          type: integer
          title: Total Agentic Steps
        total_cached_steps:
          type: integer
          title: Total Cached Steps
        period_start:
          type: string
          format: date-time
          title: Period Start
        period_end:
          type: string
          format: date-time
          title: Period End
        mode:
          $ref: '#/components/schemas/UsageMode'
        runs_counted:
          type: integer
          title: Runs Counted
      type: object
      required:
        - total_agentic_steps
        - total_cached_steps
        - period_start
        - period_end
        - mode
        - runs_counted
      title: UsageAggregateResponse
      description: Response schema for usage aggregation.
    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
          additionalProperties: true
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````