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

# Get Org Conversation Usage

> Get per-agent, per-task usage of an organization conversation.

Read-only and built from retained history only: it never starts, resumes
or contacts a runtime. The response is an allowlisted usage DTO without
titles, tags, prompts, task descriptions or tool inputs/outputs.

**Access Control**: Requires READ_CONVERSATION_USAGE_DETAIL permission
(Admin or Owner role) and the organization's
``enable_conversation_usage_detail`` opt-in, which is off by default.

Raises:
    HTTPException: 403 if the organization has not opted in (checked
        before any conversation lookup or history read)
    HTTPException: 404 if the conversation is missing, deleted or not in
        the organization (these cases are indistinguishable)



## OpenAPI

````yaml /openapi/openhands-cloud.json get /api/organizations/{org_id}/conversations/{conversation_id}/usage
openapi: 3.1.0
info:
  title: OpenHands
  description: 'OpenHands: Code Less, Make More'
  version: 0.0.1
servers: []
security: []
paths:
  /api/organizations/{org_id}/conversations/{conversation_id}/usage:
    get:
      tags:
        - Orgs
      summary: Get Org Conversation Usage
      description: |-
        Get per-agent, per-task usage of an organization conversation.

        Read-only and built from retained history only: it never starts, resumes
        or contacts a runtime. The response is an allowlisted usage DTO without
        titles, tags, prompts, task descriptions or tool inputs/outputs.

        **Access Control**: Requires READ_CONVERSATION_USAGE_DETAIL permission
        (Admin or Owner role) and the organization's
        ``enable_conversation_usage_detail`` opt-in, which is off by default.

        Raises:
            HTTPException: 403 if the organization has not opted in (checked
                before any conversation lookup or history read)
            HTTPException: 404 if the conversation is missing, deleted or not in
                the organization (these cases are indistinguishable)
      operationId: >-
        get_org_conversation_usage_api_organizations__org_id__conversations__conversation_id__usage_get
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Org Id
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
            title: Conversation Id
        - name: X-Org-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Org-Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrgConversationUsageResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    OrgConversationUsageResponse:
      properties:
        conversation_id:
          type: string
          title: Conversation Id
        totals:
          $ref: '#/components/schemas/ConversationUsageCounters'
        completeness:
          type: string
          enum:
            - full
            - partial
            - totals_only
          title: Completeness
        incomplete_reasons:
          items:
            type: string
            enum:
              - no_stats_snapshot
              - scan_limit_reached
              - unknown_counters
              - totals_ahead_of_snapshot
              - task_usage_pending
              - task_usage_missing
              - task_result_missing
              - task_calls_outside_history
              - inconsistent_task_timestamps
          type: array
          title: Incomplete Reasons
        latest_snapshot_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Latest Snapshot At
        buckets:
          items:
            $ref: '#/components/schemas/ConversationUsageBucket'
          type: array
          title: Buckets
        task_calls:
          items:
            $ref: '#/components/schemas/ConversationTaskCall'
          type: array
          title: Task Calls
      additionalProperties: false
      type: object
      required:
        - conversation_id
        - totals
        - completeness
      title: OrgConversationUsageResponse
      description: |-
        Allowlisted usage detail of an org conversation; no titles, tags,
        prompts, task descriptions, tool inputs/outputs, URLs or credentials.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConversationUsageCounters:
      properties:
        cost:
          anyOf:
            - type: number
            - type: 'null'
          title: Cost
        prompt_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Prompt Tokens
        completion_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Completion Tokens
        cache_read_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cache Read Tokens
        cache_write_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Cache Write Tokens
        reasoning_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reasoning Tokens
      additionalProperties: false
      type: object
      title: ConversationUsageCounters
      description: >-
        Cumulative usage. ``None`` means not observed; ``0`` means observed
        zero.


        ``reasoning_tokens`` may already be part of ``completion_tokens``.
    ConversationUsageBucket:
      properties:
        usage_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Usage Id
        kind:
          type: string
          enum:
            - main_agent
            - condenser
            - task
            - other
          title: Kind
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        usage:
          $ref: '#/components/schemas/ConversationUsageCounters'
      additionalProperties: false
      type: object
      required:
        - kind
        - usage
      title: ConversationUsageBucket
      description: One disjoint usage bucket of the latest retained stats snapshot.
    ConversationTaskCall:
      properties:
        task_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Id
        agent_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Type
        resumed:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Resumed
        status:
          type: string
          enum:
            - running
            - completed
            - error
            - unknown
          title: Status
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        ended_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ended At
        duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Duration Seconds
      additionalProperties: false
      type: object
      required:
        - status
      title: ConversationTaskCall
      description: 'One call of the task tool: a sub-agent start or resume.'
    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
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-Access-Token

````

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