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

# Get run telemetry

> Reads a run's telemetry, by `kind`: `usage` (token and cost snapshots for the run and
each phase), `spans` (the run's trace spans, for a timeline of what the agents did), or
`summary` (a rollup for an organization's dashboard over the last `window_days`).

Requires a realm member (or higher) with the `runs.view` permission on the realm that owns the run given by `run_id`.



## OpenAPI

````yaml /openapi/hub-by-tag/hub-runs.yaml post /v1/runs/get_telemetry
openapi: 3.0.3
info:
  title: 'CliqHub API: Runs'
  version: 1.0.0
  description: >-
    Runs of a team on a daemon. People start runs (Start a run), follow them
    (Get a run, Stream

    run activity, Search run logs, Get run telemetry), and control them (Cancel
    a run, Resume a

    run, Supply run inputs). CliqHub hands each control to the run's daemon,
    which must be

    online: when it is not, the call fails with a `run/daemon_offline` or
    `run/daemon_stranded`

    conflict (cancel instead marks the run cancelled on CliqHub).


    Daemons report what happens during a run through the other endpoints here,
    with their realm

    token: Record a new run, Update run status, Complete a run, and three
    separate channels for

    run activity (the live timeline), run telemetry (token usage and traces) and
    run logs (text).
servers:
  - url: https://{host}
    variables:
      host:
        default: cliqhub.io
        description: CliqHub host
security: []
tags:
  - name: Runs
    description: >-
      Runs of a team on a daemon. People start runs (Start a run), follow them
      (Get a run, Stream

      run activity, Search run logs, Get run telemetry), and control them
      (Cancel a run, Resume a

      run, Supply run inputs). CliqHub hands each control to the run's daemon,
      which must be

      online: when it is not, the call fails with a `run/daemon_offline` or
      `run/daemon_stranded`

      conflict (cancel instead marks the run cancelled on CliqHub).


      Daemons report what happens during a run through the other endpoints here,
      with their realm

      token: Record a new run, Update run status, Complete a run, and three
      separate channels for

      run activity (the live timeline), run telemetry (token usage and traces)
      and run logs (text).
paths:
  /v1/runs/get_telemetry:
    post:
      tags:
        - Runs
      summary: Get run telemetry
      description: >-
        Reads a run's telemetry, by `kind`: `usage` (token and cost snapshots
        for the run and

        each phase), `spans` (the run's trace spans, for a timeline of what the
        agents did), or

        `summary` (a rollup for an organization's dashboard over the last
        `window_days`).


        Requires a realm member (or higher) with the `runs.view` permission on
        the realm that owns the run given by `run_id`.
      operationId: POST_v1_runs_get_telemetry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - usage
                      description: Read run + phase usage snapshots
                    run_id:
                      type: string
                      minLength: 1
                      description: Run id
                  required:
                    - kind
                    - run_id
                  title: usage
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - spans
                      description: Read OTEL span tree for a run
                    run_id:
                      type: string
                      minLength: 1
                      description: Run id
                  required:
                    - kind
                    - run_id
                  title: spans
                - type: object
                  properties:
                    kind:
                      type: string
                      enum:
                        - summary
                      description: Fleet telemetry rollup for home dashboard
                    org_id:
                      type: string
                      format: uuid
                      description: >-
                        Organization UUID. Required for fleet summary — never
                        invent from X-Org-Id.
                    window_days:
                      type: integer
                      minimum: 1
                  required:
                    - kind
                    - org_id
                  title: summary
              discriminator:
                propertyName: kind
            examples:
              usage:
                summary: A run's usage
                value:
                  kind: usage
                  run_id: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
              summary:
                summary: Organization rollup for 7 days
                value:
                  kind: summary
                  org_id: 2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f
                  window_days: 7
      responses:
        '200':
          description: >-
            Depends on `kind`: `usage` → TelemetryUsageData, `spans` → a list of
            TelemetrySpanData, `summary` → TelemetrySummaryData.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                    description: Always `true` on success.
                  data:
                    oneOf:
                      - $ref: '#/components/schemas/TelemetryUsageData'
                      - type: array
                        items:
                          $ref: '#/components/schemas/TelemetrySpanData'
                      - $ref: '#/components/schemas/TelemetrySummaryData'
              examples:
                usage:
                  summary: kind usage
                  value:
                    ok: true
                    data:
                      run:
                        total_tokens_in: 48210
                        total_tokens_out: 6120
                        total_llm_calls: 14
                        total_duration_ms: 270000
                        cost_usd: 0.42
                      phases:
                        - phase: review
                          usage_snapshot:
                            total_tokens_in: 48210
                            total_tokens_out: 6120
                spans:
                  summary: kind spans
                  value:
                    ok: true
                    data:
                      - span_id: 9f8e7d6c5b4a3921
                        trace_id: 1a2b3c4d5e6f708192a3b4c5d6e7f809
                        parent_span_id: null
                        run_id: 0c8d7e6f-5a4b-4c3d-9e2f-1a0b9c8d7e6f
                        name: phase review
                        kind: internal
                        status_code: OK
                        status_message: null
                        start_unix_nano: '1759834210000000000'
                        end_unix_nano: '1759834480000000000'
                        duration_ms: 270000
                        attributes:
                          agent: claude-code
                        events: []
                        daemon_id: 7d1c2b3a-4e5f-4a6b-8c7d-9e0f1a2b3c4d
                        realm_id: 5b0c3a7e-2f4d-4b8e-9a51-7c1d2e3f4a5b
                        created_at: 1759834481000
        '401':
          description: >-
            `unauthorized`: No `Authorization` header, or the token is
            malformed, expired or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                unauthorized:
                  summary: unauthorized
                  value:
                    ok: false
                    error:
                      code: unauthorized
                      message: Authentication required
        '403':
          description: >-
            `forbidden`: You can see the record but your role in its realm is
            too low or lacks the required permission.


            `forbidden`: `kind: summary` and you are not a member of `org_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    ok: false
                    error:
                      code: forbidden
                      message: You do not have access to do this
                forbidden (endpoint):
                  summary: forbidden (endpoint)
                  value:
                    ok: false
                    error: You do not have access to do this
                    code: forbidden
        '404':
          description: >-
            `not_found`: The run does not exist or is in a realm you cannot see
            (404 rather than 403, so its existence is not revealed).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                not_found:
                  summary: not_found
                  value:
                    ok: false
                    error:
                      code: not_found
                      message: Not found
        '422':
          description: >-
            `invalid_params`: `kind` is missing or unknown, `run_id` is missing
            for `usage` / `spans`, `org_id` is missing or not a UUID for
            `summary`, or `window_days` is out of range.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                invalid_params:
                  summary: invalid_params
                  value:
                    ok: false
                    error: >-
                      kind: Invalid discriminator value. Expected 'usage' |
                      'spans' | 'summary'
                    code: invalid_params
        '500':
          description: >-
            `internal_error`: An unexpected server fault. Retry later; if it
            persists, report it with the time of the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubErr'
              examples:
                internal_error:
                  summary: internal_error
                  value:
                    ok: false
                    error: Internal server error
                    code: internal_error
      security:
        - BearerAuth: []
components:
  schemas:
    TelemetryUsageData:
      type: object
      properties:
        run:
          type: object
          additionalProperties: true
          nullable: true
          description: Run-level usage_snapshot JSONB, or null
        phases:
          type: array
          items:
            type: object
            properties:
              phase:
                type: string
                description: Phase name
              usage_snapshot:
                type: object
                additionalProperties: true
                nullable: true
                description: Phase usage_snapshot JSONB, or null
            required:
              - phase
              - usage_snapshot
          description: Per-phase usage rows in sequence order
      required:
        - run
        - phases
    TelemetrySpanData:
      type: object
      properties:
        span_id:
          type: string
          description: OTEL span id
        trace_id:
          type: string
          description: OTEL trace id
        parent_span_id:
          type: string
          nullable: true
          description: Parent span id, or null for roots
        run_id:
          type: string
          description: Hub run id
        name:
          type: string
          description: Span display name
        kind:
          type: string
          description: Span kind
        status_code:
          type: string
          description: OTEL status code
        status_message:
          type: string
          nullable: true
          description: Optional status message
        start_unix_nano:
          type: string
          description: Start time as unix nanoseconds string
        end_unix_nano:
          type: string
          description: End time as unix nanoseconds string
        duration_ms:
          type: number
          description: Derived duration in milliseconds
        attributes:
          type: object
          additionalProperties:
            type: object
            additionalProperties: true
          description: Span attributes map
        events:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: Event name
              time_unix_nano:
                type: string
                description: Event time as unix nanoseconds string
              attributes:
                type: object
                additionalProperties:
                  type: object
                  additionalProperties: true
                description: Event attributes
            required:
              - name
              - time_unix_nano
              - attributes
          description: Span events
        daemon_id:
          type: string
          nullable: true
          description: Reporting daemon id
        realm_id:
          type: string
          nullable: true
          description: Realm id when known
        created_at:
          type: number
          description: Insert time (unix ms)
      required:
        - span_id
        - trace_id
        - parent_span_id
        - run_id
        - name
        - kind
        - status_code
        - status_message
        - start_unix_nano
        - end_unix_nano
        - duration_ms
        - attributes
        - events
        - daemon_id
        - realm_id
        - created_at
    TelemetrySummaryData:
      type: object
      properties:
        window:
          type: object
          properties:
            from_ms:
              type: number
              description: Window start (unix ms, UTC)
            to_ms:
              type: number
              description: Window end (unix ms, UTC)
            days:
              type: integer
              minimum: 1
              description: Lookback days used for the rollup
          required:
            - from_ms
            - to_ms
            - days
          description: Rollup time window
        totals:
          type: object
          properties:
            runs:
              type: number
              description: Distinct runs in window
            agent_invocations:
              type: number
              description: Agent invocation count
            failures:
              type: number
              description: Failed agent invocations
            duration_ms:
              type: number
              description: Total duration ms
            cost_usd:
              type: number
              description: Total estimated cost USD
            tokens_in:
              type: number
              description: Total input tokens
            tokens_out:
              type: number
              description: Total output tokens
          required:
            - runs
            - agent_invocations
            - failures
            - duration_ms
            - cost_usd
            - tokens_in
            - tokens_out
          description: Aggregate totals across the window
        by_day:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                description: UTC calendar day YYYY-MM-DD
              runs:
                type: number
                description: Runs that day
              invocations:
                type: number
                description: Invocations that day
              duration_ms:
                type: number
                description: Duration ms that day
              cost_usd:
                type: number
                description: Cost USD that day
              failures:
                type: number
                description: Failures that day
            required:
              - date
              - runs
              - invocations
              - duration_ms
              - cost_usd
              - failures
          description: Per-day series
        by_hour:
          type: array
          items:
            type: object
            properties:
              hour:
                type: integer
                minimum: 0
                maximum: 23
                description: UTC hour 0–23
              runs:
                type: number
                description: Runs in that hour bucket
              invocations:
                type: number
                description: Invocations in that hour bucket
            required:
              - hour
              - runs
              - invocations
          minItems: 0
          maxItems: 23
          description: Fixed 24-length hour-of-day strip
        by_team:
          type: array
          items:
            type: object
            properties:
              team_label:
                type: string
                description: Canonical @scope/team label
              runs:
                type: number
                description: Runs for this team
              invocations:
                type: number
                description: Invocations for this team
              duration_ms:
                type: number
                description: Duration ms for this team
              cost_usd:
                type: number
                description: Cost USD for this team
              failures:
                type: number
                description: Failures for this team
            required:
              - team_label
              - runs
              - invocations
              - duration_ms
              - cost_usd
              - failures
          description: Top teams by activity
        by_agent_kind:
          type: array
          items:
            type: object
            properties:
              kind:
                type: string
                description: Agent kind (e.g. llm, shell)
              invocations:
                type: number
                description: Invocations for this kind
              duration_ms:
                type: number
                description: Duration ms for this kind
              cost_usd:
                type: number
                description: Cost USD for this kind
              failures:
                type: number
                description: Failures for this kind
            required:
              - kind
              - invocations
              - duration_ms
              - cost_usd
              - failures
          description: Rollup by agent kind
      required:
        - window
        - totals
        - by_day
        - by_hour
        - by_team
        - by_agent_kind
    HubErr:
      type: object
      required:
        - ok
        - error
      description: >-
        Every failure. Route-policy denials (401/403/404, and 400 when neither
        realm_id nor org_id was sent) answer `error` as `{ code, message }`;
        errors raised by the endpoint answer `error` as the message with the
        code beside it in `code`. Every error has a code. See
        [Errors](/hub-api/errors).
      properties:
        ok:
          type: boolean
          description: Always false on error
        error:
          description: The message, or `{ code, message }` for an access denial.
          oneOf:
            - type: string
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: string
                message:
                  type: string
        code:
          type: string
          description: Stable error code of an endpoint error.
        details:
          type: object
          additionalProperties: true
          description: Structured detail, when there is some.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: cliq_tok_* | cliq_dt_*
      description: >-
        User PAT (`cliq_tok_…`, including session-scoped) or realm token
        (`cliq_dt_…`).

````

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