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

# Get 30-day usage histogram for a company

> Return a per-day breakdown of metered usage over the last 30 days (oldest first) for a given company, aggregated across all non-revoked API keys of every user in that company. Includes a `total_cost` field with the cumulative spend.

**Authorization:** the authenticated user must have instance-level company-view permission (SysAdmin, Account Manager, or DPO Admin).



## OpenAPI

````yaml /api-reference/openapi-v3-instance.yaml get /api/v3/instance/companies/{id}/usage
openapi: 3.1.0
info:
  title: LightOn API
  version: 3.15.0 (v3-instance)
  description: >-
    LightOn gives you an API to search, parse, and ingest documents at scale.
    Build knowledge-retrieval pipelines without managing vector databases or OCR
    models.
servers:
  - url: https://paradigm.lighton.ai
security: []
tags:
  - name: Models
    description: Operations about AI models
  - name: Workspaces
    description: Operations about workspaces
  - name: Users
    description: Operations about users
  - name: User Groups
    description: Operations about user groups
  - name: Companies
    description: Operations about companies
paths:
  /api/v3/instance/companies/{id}/usage:
    get:
      tags:
        - Usage
      summary: Get 30-day usage histogram for a company
      description: >-
        Return a per-day breakdown of metered usage over the last 30 days
        (oldest first) for a given company, aggregated across all non-revoked
        API keys of every user in that company. Includes a `total_cost` field
        with the cumulative spend.


        **Authorization:** the authenticated user must have instance-level
        company-view permission (SysAdmin, Account Manager, or DPO Admin).
      operationId: api_v3_instance_companies_usage_retrieve
      parameters:
        - in: query
          name: from_date
          schema:
            type: string
          description: >-
            Start date for the billing window (ISO yyyy-mm-dd). Scopes both
            `days` and `total_cost` to this window — without it, `days` covers
            the last 30 days.
        - in: path
          name: id
          schema:
            type: integer
          required: true
        - in: query
          name: to_date
          schema:
            type: string
          description: >-
            End date for the billing window (ISO yyyy-mm-dd, inclusive). Scopes
            both `days` and `total_cost`.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompanyUsageHistogramResponse'
          description: ''
        '401':
          description: Unauthenticated - missing or invalid API key.
        '403':
          description: Forbidden - instance company-view permission required.
        '404':
          description: Not Found - company does not exist.
        '503':
          description: >-
            API is under maintenance. Check `GET /api/v3/system/status` for
            active periods and retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceMaintenance503'
      security:
        - bearerAuth: []
components:
  schemas:
    CompanyUsageHistogramResponse:
      type: object
      properties:
        currency:
          type: string
          description: ISO 4217 code applied to all `price` values in the response
        days:
          type: array
          items:
            $ref: '#/components/schemas/DailyUsageResponse'
          description: One entry per day in the requested window, oldest first
        total_cost:
          type: string
          format: decimal
          description: Cumulative cost across all days in the response currency
      required:
        - currency
        - days
        - total_cost
    ServiceMaintenance503:
      type: object
      description: >-
        Returned by the maintenance middleware when the requested endpoint is
        blocked.
      required:
        - detail
        - error
        - mode
      properties:
        detail:
          type: string
          example: System is under maintenance.
        error:
          type: string
          example: service_maintenance
        mode:
          type: string
          enum:
            - full_shutdown
            - warning_banner
          description: >-
            `full_shutdown` blocks all traffic; `warning_banner` also blocks and
            shows a dismissible toast.
        reason:
          type: string
          description: Operator-supplied maintenance reason, if any.
        started_at:
          type: string
          format: date-time
        endpoint_category_names:
          type: array
          items:
            type: string
          description: >-
            Non-empty only for category-scoped periods. Empty means all
            endpoints are affected.
    DailyUsageResponse:
      type: object
      properties:
        date:
          type: string
          format: date
        usage:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FeatureDailyUsageResponse'
          description: >-
            Per-feature usage for the day. Keys are feature slugs (parsing,
            ingestion, search, ...).
      required:
        - date
        - usage
    FeatureDailyUsageResponse:
      type: object
      properties:
        price:
          type: string
          format: decimal
          description: Cost at list price for this feature/day, in the response currency
        metric:
          $ref: '#/components/schemas/FeatureMetricResponse'
      required:
        - metric
        - price
    FeatureMetricResponse:
      type: object
      properties:
        unit:
          type: string
          description: Unit of measurement, e.g. 'page' or 'query'
        count:
          type: number
          format: double
          description: Total quantity recorded for the feature on the day
      required:
        - count
        - unit
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````