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

# Get a usage time series

> Get your TokenChange inference usage as a time series in hourly or daily buckets, over 24 hours, 7 days or 30 days. Requires the usage:read scope.



## OpenAPI

````yaml api-reference/openapi.json GET /v1/usage/series
openapi: 3.1.0
info:
  title: TokenChange API
  description: >-
    Manage TokenChange resources with a gateway API token. Errors share one
    envelope: `{"error":{"type","code","message"}}`.
  license:
    name: ''
  version: '1'
servers:
  - url: https://api.tokenchange.io
security: []
tags:
  - name: models
    description: Catalog models and endpoints
  - name: keys
    description: Inference API keys
  - name: usage
    description: Usage analytics
  - name: billing
    description: Credit balance and history
  - name: provider
    description: Your provider account, endpoints, validations and earnings
paths:
  /v1/usage/series:
    get:
      tags:
        - usage
      operationId: usage_series
      parameters:
        - name: range
          in: query
          description: Defaults to `7d`.
          required: false
          schema:
            $ref: '#/components/schemas/UsageRange'
        - name: granularity
          in: query
          description: Defaults to `hour` for `24h` and `day` otherwise.
          required: false
          schema:
            $ref: '#/components/schemas/Granularity'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageSeries'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - bearer:
            - usage:read
components:
  schemas:
    UsageRange:
      type: string
      enum:
        - 24h
        - 7d
        - 30d
    Granularity:
      type: string
      enum:
        - hour
        - day
    UsageSeries:
      type: object
      required:
        - range
        - granularity
        - buckets
      properties:
        buckets:
          type: array
          items:
            $ref: '#/components/schemas/UsageBucket'
        granularity:
          $ref: '#/components/schemas/Granularity'
        range:
          $ref: '#/components/schemas/UsageRange'
    ErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
    UsageBucket:
      type: object
      required:
        - ts
        - requests
        - tokens_in
        - tokens_out
        - tokens_cached
        - avg_latency_ms
        - avg_ttft_ms
        - avg_tpot_ms
      properties:
        avg_latency_ms:
          type: number
          format: double
        avg_tpot_ms:
          type: number
          format: double
        avg_ttft_ms:
          type: number
          format: double
        requests:
          type: integer
          format: int64
        tokens_cached:
          type: integer
          format: int64
        tokens_in:
          type: integer
          format: int64
        tokens_out:
          type: integer
          format: int64
        ts:
          type: string
    ErrorDetail:
      type: object
      required:
        - type
        - code
        - message
      properties:
        code:
          type: string
        message:
          type: string
        resource_id:
          type:
            - string
            - 'null'
        type:
          type: string
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: A gateway API token (`tcg_…`) created in the dashboard

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.