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

# Get subtenant usage history

> Read-only. Durable per-window usage snapshots for a subtenant.



## OpenAPI

````yaml GET /v1/tenant-usage/{tenantId}/subtenants/{subtenantId}/history
openapi: 3.0.0
info:
  title: Devic.ai Public API
  description: >-
    Devic.ai is an AI platform that allows you to create, manage, and use AI
    agents for various tasks.
  version: 1.0.0
  contact:
    name: Devic.ai Support
    url: https://devic.ai
  x-logo:
    url: https://devic.ai/logo.png
    altText: Devic.ai Logo
  x-summary: Public API for interacting with Devic.ai platform
servers:
  - url: https://api.devic.ai
    description: Production server
  - url: https://staging-api.devic.ai
    description: Staging server
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Group agents, assistants, documents and costs into projects
  - name: Documents
    description: >-
      Knowledge base documents: create, version, attach and index markdown
      content for RAG
  - name: Document Folders
    description: Organise knowledge base documents into folders and attach them in bulk
  - name: Files
    description: Upload files and obtain shareable download URLs to attach to messages
  - name: Agents
    description: Endpoints related to AI agents and their operations
  - name: Assistants
    description: Endpoints for interacting with assistants and their specializations
  - name: Tool Servers
    description: Endpoints for managing tool servers and their tool definitions
  - name: Health
    description: API health check endpoints
  - name: Documentation
    description: Endpoints for retrieving markdown documentation
paths:
  /v1/tenant-usage/{tenantId}/subtenants/{subtenantId}/history:
    get:
      tags:
        - Tenant Usage
      summary: Get subtenant usage history
      description: Read-only. Durable per-window usage snapshots for a subtenant.
      operationId: getSubtenantUsageHistory
      parameters:
        - name: tenantId
          in: path
          required: true
          description: tenantId
          schema:
            type: string
        - name: subtenantId
          in: path
          required: true
          description: subtenantId
          schema:
            type: string
        - name: metric
          in: query
          required: false
          description: Filter by metric
          schema:
            type: string
            enum:
              - tokens
              - cost
        - name: windowUnit
          in: query
          required: false
          description: Filter by window unit
          schema:
            type: string
            enum:
              - hour
              - day
              - week
              - month
        - name: from
          in: query
          required: false
          description: Range start (epoch ms)
          schema:
            type: integer
        - name: to
          in: query
          required: false
          description: Range end (epoch ms)
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: Max items
          schema:
            type: integer
        - name: skip
          in: query
          required: false
          description: Items to skip
          schema:
            type: integer
      responses:
        '200':
          description: Usage history rows
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TenantUsageHistoryRow'
        '401':
          description: Unauthorized - Invalid or missing token
        '404':
          description: Subtenant not found
        '500':
          description: Internal Server Error
      security:
        - bearerAuth: []
components:
  schemas:
    TenantUsageHistoryRow:
      type: object
      description: >-
        Durable snapshot of one closed usage window (the live counters are
        ephemeral).
      properties:
        tenantId:
          type: string
        subtenantId:
          type: string
          description: Empty string for tenant-scope
        scope:
          type: string
          enum:
            - tenant
            - subtenant
        metric:
          type: string
          enum:
            - tokens
            - cost
        windowUnit:
          type: string
          enum:
            - hour
            - day
            - week
            - month
        windowEvery:
          type: integer
        windowStart:
          type: integer
          description: Epoch ms
        windowEnd:
          type: integer
          description: Epoch ms
        consumption:
          type: number
          description: Amount counted toward the limit
        exemptConsumption:
          type: number
          description: Amount incurred by exempt entities (not counted toward the limit)
        limit:
          type: number
        percent:
          type: number
        tierId:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use JWT token for authentication

````