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

# Get usage & cost

> Report billable usage and cost for the organization over a time window, broken down by project (highest spend first). Pass `from`/`to` as ISO 8601 timestamps; optionally pass `projectId` to scope the report to one project. Amounts are billable spend only (what we absorb is never included). Authenticated by an organization API key with the `usage:read` permission.



## OpenAPI

````yaml /api-reference/openapi.documented.json get /v1/usage
openapi: 3.1.0
info:
  title: Roark Analytics API
  description: >-
    The Roark Analytics API gives you access to the same API that powers the
    award winning Roark Analytics platform.
  version: 1.0.0
servers:
  - description: Production
    url: https://api.roark.ai
security:
  - Bearer: []
tags:
  - name: Agent
  - name: Agent Endpoint
  - name: Call
  - name: Chat
  - name: Metric
  - name: Metric Policy
  - name: Metric Collection Job
  - name: Customer Flow
  - name: Customer Flow Edge Case
  - name: Simulation
  - name: Simulation Persona
  - name: Simulation Environment
  - name: Simulation Scenario
  - name: Simulation Run Plan
  - name: Simulation Template
  - name: Simulation Run Plan Job
  - name: Simulation Job
  - name: HTTP Request Definition
  - name: Webhook
  - name: Issue
  - name: Autoimprove
  - name: Agent Config
  - name: Knowledge Base
  - name: Config
  - name: Organization Project
  - name: Organization Project Member
  - name: Organization Project API Key
  - name: Organization Config
  - name: CLI Auth
  - name: Me
  - name: Project
  - name: Usage
  - name: Benchmark
  - name: Health
  - name: Prospect Simulation
paths:
  /v1/usage:
    get:
      tags:
        - Usage
      summary: Get usage & cost
      description: >-
        Report billable usage and cost for the organization over a time window,
        broken down by project (highest spend first). Pass `from`/`to` as ISO
        8601 timestamps; optionally pass `projectId` to scope the report to one
        project. Amounts are billable spend only (what we absorb is never
        included). Authenticated by an organization API key with the
        `usage:read` permission.
      operationId: getV1Usage
      parameters:
        - in: query
          name: from
          schema:
            type: string
            format: date-time
            description: Start of the window (inclusive), ISO 8601.
            example: '2026-09-01T00:00:00Z'
          required: true
        - in: query
          name: to
          schema:
            type: string
            format: date-time
            description: >-
              End of the window (exclusive), ISO 8601. Must be after `from`, and
              the window may not exceed 366 days.
            example: '2026-10-01T00:00:00Z'
          required: true
        - in: query
          name: projectId
          schema:
            type: string
            format: uuid
            description: >-
              Limit the report to a single project. Omit for the whole
              organization.
          required: false
      responses:
        '200':
          description: The usage & cost report for the window
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/UsageReport'
                required:
                  - data
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Validation error
              example:
                type: validation
                code: invalid_parameter
                message: The request was invalid
                param: email
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Authentication error
              example:
                type: authentication
                code: unauthorized
                message: Authentication required
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Permission error
              example:
                type: forbidden
                code: permission_denied
                message: You do not have permission to access this resource
          description: Forbidden
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Server error
              example:
                type: internal
                code: internal_error
                message: Internal server error
          description: Internal Server Error
components:
  schemas:
    UsageReport:
      type: object
      properties:
        from:
          type: string
          description: The resolved window start, echoed back as ISO 8601.
        to:
          type: string
          description: The resolved window end, echoed back as ISO 8601.
        currency:
          type: string
          const: usd
        totalUsdMicros:
          type: integer
          description: >-
            Total billable spend across the organization (or the single project)
            in micro-dollars.
        totalUsd:
          type: number
          description: The same total in US dollars.
        projects:
          type: array
          items:
            $ref: '#/components/schemas/UsageProjectCost'
          description: >-
            Per-project billable spend, highest first. Only projects with spend
            in the window appear.
      required:
        - from
        - to
        - currency
        - totalUsdMicros
        - totalUsd
        - projects
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - validation
            - authentication
            - forbidden
            - not_found
            - conflict
            - payment_required
            - rate_limit
            - internal
          description: The error type category
          examples:
            - validation
            - authentication
        code:
          type: string
          description: Machine-readable error code identifier
          examples:
            - invalid_parameter
            - missing_required_field
            - unauthorized
        message:
          type: string
          description: Human-readable error message
          examples:
            - The request was invalid
            - Authentication required
        param:
          type: string
          description: The parameter that caused the error (if applicable)
          examples:
            - email
            - user_id
        details:
          description: Additional error context information
      required:
        - type
        - code
        - message
    UsageProjectCost:
      type: object
      properties:
        projectId:
          type: string
          format: uuid
        projectName:
          type:
            - string
            - 'null'
          description: Null only if the project no longer exists in this organization.
        amountUsdMicros:
          type: integer
          description: >-
            Billable spend in integer micro-dollars (1,000,000 = $1). The exact
            value.
        amountUsd:
          type: number
          description: >-
            The same billable spend in US dollars. For display; use
            amountUsdMicros to reconcile.
      required:
        - projectId
        - projectName
        - amountUsdMicros
        - amountUsd
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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