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

# Get run metrics

> Returns your organization's finished runs over a window as points: one per hour or day in time_zone (and per group with group_by), each with the runs by how they ended, the success rate, the median and 95th percentile duration, what they cost and the model steps they took. A run counts in the bucket it finished in; runs still going are not counted. The window defaults to the last 7 days and may start at most a year back; hour buckets need a window of 7 days or less.

Minimum role required: Viewer


## OpenAPI

````yaml /api-reference/openapi-backend.json get /runs/metrics
openapi: 3.1.0
info:
  description: Axilio backend HTTP API.
  title: Axilio API
  version: 0.155.0
servers:
  - url: https://api.axilio.ai/api/v1
    description: Production
security: []
tags:
  - name: Agents
  - name: API Keys
  - name: Billing
  - name: Conversations
  - name: Files
  - name: Messages
  - name: Models
  - name: Organization
  - name: Phones
  - name: Runs
  - name: Sessions
  - name: Skill
  - name: Usage
  - name: Webhooks
paths:
  /runs/metrics:
    get:
      tags:
        - Runs
      summary: Get run metrics
      description: >-
        Returns your organization's finished runs over a window as points: one
        per hour or day in time_zone (and per group with group_by), each with
        the runs by how they ended, the success rate, the median and 95th
        percentile duration, what they cost and the model steps they took. A run
        counts in the bucket it finished in; runs still going are not counted.
        The window defaults to the last 7 days and may start at most a year
        back; hour buckets need a window of 7 days or less.
      operationId: runs_get_metrics
      parameters:
        - description: >-
            Start of the window (RFC 3339). Defaults to 7 days before
            period_end_at, and may be at most a year before now.
          explode: false
          in: query
          name: period_start_at
          schema:
            description: >-
              Start of the window (RFC 3339). Defaults to 7 days before
              period_end_at, and may be at most a year before now.
            format: date-time
            type: string
        - description: >-
            End of the window (RFC 3339). Defaults to now, and a later time is
            read as now.
          explode: false
          in: query
          name: period_end_at
          schema:
            description: >-
              End of the window (RFC 3339). Defaults to now, and a later time is
              read as now.
            format: date-time
            type: string
        - description: >-
            Bucket size: hour or day. hour is allowed for windows of 7 days or
            less.
          explode: false
          in: query
          name: granularity
          schema:
            default: day
            description: >-
              Bucket size: hour or day. hour is allowed for windows of 7 days or
              less.
            enum:
              - hour
              - day
            type: string
        - description: >-
            IANA time zone the buckets follow, such as America/Los_Angeles: a
            day starts at local midnight and an hour on the local hour. An
            unknown name is an error.
          explode: false
          in: query
          name: time_zone
          schema:
            default: UTC
            description: >-
              IANA time zone the buckets follow, such as America/Los_Angeles: a
              day starts at local midnight and an hour on the local hour. An
              unknown name is an error.
            type: string
        - description: >-
            Split each bucket by agent, revision, status, trigger, mode,
            schedule or device_class. Omit for one point per bucket.
          explode: false
          in: query
          name: group_by
          schema:
            description: >-
              Split each bucket by agent, revision, status, trigger, mode,
              schedule or device_class. Omit for one point per bucket.
            enum:
              - agent
              - revision
              - status
              - trigger
              - mode
              - schedule
              - device_class
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunMetricsResponse'
          description: OK
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Forbidden
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Internal Server Error
      security:
        - apiKeyAuth: []
components:
  schemas:
    RunMetricsResponse:
      additionalProperties: false
      description: >-
        Finished runs over the window, one point per bucket (and per group with
        group_by).
      properties:
        points:
          description: >-
            One point per bucket, oldest first, and per group within a bucket
            when grouped. The first bucket starts at or before period_start_at.
          items:
            $ref: '#/components/schemas/RunMetricsPoint'
          type:
            - array
            - 'null'
      required:
        - points
      type: object
    V2ErrorModel:
      additionalProperties: false
      description: >-
        Error response, following RFC 9457 (Problem Details for HTTP APIs).
        Returned with a application/problem+json content type.
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/V2ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    RunMetricsPoint:
      additionalProperties: false
      description: One bucket of finished runs, and one group's when grouped.
      properties:
        agent:
          description: The agent's id. Set only with group_by=agent.
          type: string
        cancelled_runs:
          description: Of them, the runs that were cancelled.
          format: int64
          type: integer
        completed_runs:
          description: Of them, the runs that completed.
          format: int64
          type: integer
        device_class:
          description: What the runs drove. Set only with group_by=device_class.
          enum:
            - phone
          type: string
        duration_p50_ms:
          description: >-
            Median run duration, start to end, in milliseconds. Null when no run
            in the bucket has one (a run cancelled before it started).
          format: int64
          type:
            - integer
            - 'null'
        duration_p95_ms:
          description: >-
            95th percentile of the same duration, in milliseconds. Null when no
            run in the bucket has one.
          format: int64
          type:
            - integer
            - 'null'
        failed_runs:
          description: Of them, the runs that failed.
          format: int64
          type: integer
        mode:
          description: >-
            agent: the model drove; code: a script ran. Set only with
            group_by=mode.
          enum:
            - agent
            - code
          type: string
        model_steps:
          description: Model steps the runs took.
          format: int64
          type: integer
        period_start_at:
          description: >-
            Start of the bucket (RFC 3339, UTC): a local hour or a local
            midnight in time_zone. A run counts in the bucket it finished in.
          format: date-time
          type: string
        revision:
          description: >-
            The revision's id; empty for an ad hoc run. Set only with
            group_by=revision.
          type: string
        runs:
          description: Runs that finished in the bucket.
          format: int64
          type: integer
        schedule:
          description: >-
            The schedule's id; empty for a run no schedule started. Set only
            with group_by=schedule.
          type: string
        status:
          description: How the runs ended. Set only with group_by=status.
          enum:
            - completed
            - failed
            - cancelled
          type: string
        success_rate:
          description: >-
            Completed runs over finished runs, from 0 to 1; 0 when none
            finished.
          format: double
          maximum: 1
          minimum: 0
          type: number
        total_cost_microdollars:
          description: >-
            What the runs cost: their sessions' phone time plus the inference
            made under them, in microdollars. Phone time is billed when a
            session ends, so a run's cost can land after the run does.
          format: int64
          type: integer
        trigger:
          description: What started the runs. Set only with group_by=trigger.
          enum:
            - manual
            - scheduled
            - api
          type: string
      required:
        - period_start_at
        - runs
        - completed_runs
        - failed_runs
        - cancelled_runs
        - success_rate
        - duration_p50_ms
        - duration_p95_ms
        - total_cost_microdollars
        - model_steps
      type: object
    V2ErrorDetail:
      additionalProperties: false
      description: >-
        One specific problem within an error response, locating the offending
        part of the request.
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    apiKeyAuth:
      description: Customer API key (axl_ prefix).
      in: header
      name: X-Axilio-Api-Key
      type: apiKey

````

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