> ## 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 message metrics

> Returns your texting over a window (the last 7 days by default, starting at most a year back): texts sent and received, how the sent ones ended up (delivered, left the phone with no delivery report, unconfirmed, failed, still queued) and the delivery rate, how long they took to send and to be delivered, why they failed, your conversations and how many of the ones you texted wrote back within a day, and each phone's share with its busiest 30 minutes, to compare with the send_limit the response carries. The points chart it by the hour or the day (granularity) in time_zone; hour buckets need a window of 7 days or less. Scope it to one phone with phone_id or one conversation with conversation_id. A text counts at the time the platform stored it when sent, and when the phone received it when received.

Minimum role required: Viewer


## OpenAPI

````yaml /api-reference/openapi-backend.json get /messages/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:
  /messages/metrics:
    get:
      tags:
        - Messages
      summary: Get message metrics
      description: >-
        Returns your texting over a window (the last 7 days by default, starting
        at most a year back): texts sent and received, how the sent ones ended
        up (delivered, left the phone with no delivery report, unconfirmed,
        failed, still queued) and the delivery rate, how long they took to send
        and to be delivered, why they failed, your conversations and how many of
        the ones you texted wrote back within a day, and each phone's share with
        its busiest 30 minutes, to compare with the send_limit the response
        carries. The points chart it by the hour or the day (granularity) in
        time_zone; hour buckets need a window of 7 days or less. Scope it to one
        phone with phone_id or one conversation with conversation_id. A text
        counts at the time the platform stored it when sent, and when the phone
        received it when received.
      operationId: messages_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: >-
            Only this phone's texts. A phone your organization doesn't rent is
            not found.
          explode: false
          in: query
          name: phone_id
          schema:
            description: >-
              Only this phone's texts. A phone your organization doesn't rent is
              not found.
            maxLength: 64
            type: string
        - description: >-
            Only this conversation's texts, and only its phone. Another
            organization's conversation is not found. When phone_id is also
            given, it is ignored: the conversation names the phone.
          explode: false
          in: query
          name: conversation_id
          schema:
            description: >-
              Only this conversation's texts, and only its phone. Another
              organization's conversation is not found. When phone_id is also
              given, it is ignored: the conversation names the phone.
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PhoneMessageMetrics'
          description: OK
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/V2ErrorModel'
          description: Not Found
        '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:
    PhoneMessageMetrics:
      additionalProperties: false
      description: >-
        Your texting over a window: volume, how the texts ended up, how long
        they took, why they failed, your conversations, and each phone's share.
      properties:
        conversations:
          $ref: '#/components/schemas/PhoneMessageConversationMetrics'
          description: The window's conversations.
        delivery_latency_ms:
          $ref: '#/components/schemas/PhoneMessageLatency'
          description: >-
            From a text being sent to its delivery report, over texts that have
            one. Null when none does.
        delivery_rate:
          description: >-
            Delivered over sent, not counting texts still queued, from 0 to 1.
            Null when nothing settled.
          format: double
          maximum: 1
          minimum: 0
          type:
            - number
            - 'null'
        failures:
          description: Why texts failed, most failures first.
          items:
            $ref: '#/components/schemas/PhoneMessageFailure'
          type:
            - array
            - 'null'
        period_end_at:
          description: 'End of the window, as resolved: never later than now.'
          format: date-time
          type: string
        period_start_at:
          description: Start of the window, as resolved.
          format: date-time
          type: string
        phones:
          description: >-
            One entry per phone in scope, most texts sent first: every phone
            your organization rents, even one with no texts, or the one phone or
            conversation asked for.
          items:
            $ref: '#/components/schemas/PhoneMessagePhoneMetrics'
          type:
            - array
            - 'null'
        points:
          description: >-
            One point per bucket (granularity, in time_zone), oldest first,
            every measure present. The first bucket starts at or before the
            window's start.
          items:
            $ref: '#/components/schemas/PhoneMessageMetricsPoint'
          type:
            - array
            - 'null'
        send_latency_ms:
          $ref: '#/components/schemas/PhoneMessageLatency'
          description: >-
            From the platform storing a text to the phone sending it, over texts
            that were sent. Null when none was.
        send_limit:
          $ref: '#/components/schemas/PhoneMessageSendLimit'
          description: >-
            The send limit each phone is held to: compare it with a phone's
            peak_sent_30m for its headroom.
        totals:
          $ref: '#/components/schemas/PhoneMessageMetricsTotals'
          description: The window's texts in all.
      required:
        - period_start_at
        - period_end_at
        - send_limit
        - totals
        - delivery_rate
        - send_latency_ms
        - delivery_latency_ms
        - failures
        - conversations
        - points
        - phones
      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
    PhoneMessageConversationMetrics:
      additionalProperties: false
      description: >-
        The window's conversations and how many of the ones you texted wrote
        back.
      properties:
        active:
          description: Conversations with a text in the window, in either direction.
          format: int64
          type: integer
        by_outcome:
          $ref: '#/components/schemas/PhoneMessageOutcomes'
          description: >-
            Of the conversations you texted, how many had at least one text of
            yours in the window that ended in each outcome (a conversation with
            texts of several outcomes counts under each). This is what GET
            /conversations?status= lists for the same period and scope; the
            outcome counts in totals count texts instead.
        replied:
          description: >-
            Of the conversations you texted, those where they wrote back within
            24 hours of one of your texts in the window. The reply may land
            after the window ends. GET /conversations?replied=false lists the
            rest.
          format: int64
          type: integer
        reply_latency_ms:
          $ref: '#/components/schemas/PhoneMessageLatency'
          description: >-
            From your latest text to their reply, over replies within 24 hours.
            Null when there were none.
        reply_rate:
          description: >-
            Replied over texted, from 0 to 1. Null when you texted no
            conversation.
          format: double
          maximum: 1
          minimum: 0
          type:
            - number
            - 'null'
        response_latency_ms:
          $ref: '#/components/schemas/PhoneMessageLatency'
          description: >-
            From their text to your answer, over answers within 24 hours. Null
            when there were none.
        started:
          description: >-
            Conversations whose first text ever, in either direction, falls in
            the window.
          format: int64
          type: integer
        texted:
          description: Conversations in which you sent a text in the window.
          format: int64
          type: integer
      required:
        - active
        - started
        - texted
        - replied
        - by_outcome
        - reply_rate
        - reply_latency_ms
        - response_latency_ms
      type: object
    PhoneMessageLatency:
      additionalProperties: false
      description: >-
        A time distribution in milliseconds: the median and the 95th percentile,
        each interpolated between the two nearest texts.
      properties:
        p50:
          description: Median, in milliseconds.
          format: int64
          type: integer
        p95:
          description: 95th percentile, in milliseconds.
          format: int64
          type: integer
      required:
        - p50
        - p95
      type: object
    PhoneMessageFailure:
      additionalProperties: false
      description: One reason texts failed, with how many and where.
      properties:
        conversations:
          description: >-
            Different conversations these texts were in: what GET
            /conversations?error_code= lists for the same period and scope.
          format: int64
          type: integer
        count:
          description: Texts that failed for this reason in the window.
          format: int64
          type: integer
        error_code:
          description: >-
            Why the texts failed: the same codes as a message's error_code. A
            failure reported without a code reads as send_failed. More codes may
            be added; treat one you don't know as a failure you don't handle.
          enum:
            - phone_unreachable
            - no_result
            - policy_off
            - expired
            - no_subscription
            - no_service
            - radio_off
            - carrier_rejected
            - phone_rate_limited
            - media_fetch_failed
            - connection_lost
            - queue_full
            - send_failed
          type: string
        numbers:
          description: Different numbers these texts were to.
          format: int64
          type: integer
        phones:
          description: The count by phone, most first.
          items:
            $ref: '#/components/schemas/PhoneMessageFailurePhone'
          type:
            - array
            - 'null'
      required:
        - error_code
        - count
        - numbers
        - conversations
        - phones
      type: object
    PhoneMessagePhoneMetrics:
      additionalProperties: false
      description: One phone's texting over the window.
      properties:
        conversations:
          description: Conversations on this phone with a text in the window.
          format: int64
          type: integer
        delivered:
          description: Texts delivered (status delivered).
          format: int64
          type: integer
        delivery_rate:
          description: >-
            Delivered over sent, not counting texts still queued, from 0 to 1.
            Null when nothing settled.
          format: double
          maximum: 1
          minimum: 0
          type:
            - number
            - 'null'
        failed:
          description: Texts that failed (status failed); the failures list says why.
          format: int64
          type: integer
        no_report:
          description: >-
            Texts that left the phone but never got a delivery report (status
            sent). Some carriers return none, so this is not a failure.
          format: int64
          type: integer
        peak_at:
          description: >-
            Start of the busiest slot (the latest, if several tie). Null when
            the phone sent nothing.
          format: date-time
          type:
            - string
            - 'null'
        peak_sent_30m:
          description: >-
            The most texts the phone sent in any 30-minute slot of the window,
            to compare with send_limit. Slots start on the hour and half hour,
            in UTC.
          format: int64
          type: integer
        phone_id:
          description: The phone.
          type: string
        queued:
          description: >-
            Texts still on their way to the phone, or in any status that is not
            final yet (status queued).
          format: int64
          type: integer
        received:
          description: Texts the phone received in the window.
          format: int64
          type: integer
        sent:
          description: Texts the phone sent in the window.
          format: int64
          type: integer
        unconfirmed:
          description: >-
            Texts the phone had but never said whether it sent (status
            unconfirmed). Not counted as failed.
          format: int64
          type: integer
      required:
        - phone_id
        - conversations
        - sent
        - received
        - delivery_rate
        - peak_sent_30m
        - peak_at
        - delivered
        - no_report
        - unconfirmed
        - failed
        - queued
      type: object
    PhoneMessageMetricsPoint:
      additionalProperties: false
      description: >-
        One bucket of the window: a local hour or day in time_zone, as
        granularity asks.
      properties:
        delivered:
          description: Texts delivered (status delivered).
          format: int64
          type: integer
        failed:
          description: Texts that failed (status failed); the failures list says why.
          format: int64
          type: integer
        no_report:
          description: >-
            Texts that left the phone but never got a delivery report (status
            sent). Some carriers return none, so this is not a failure.
          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.
          format: date-time
          type: string
        queued:
          description: >-
            Texts still on their way to the phone, or in any status that is not
            final yet (status queued).
          format: int64
          type: integer
        received:
          description: Texts your phones received in the bucket.
          format: int64
          type: integer
        send_p50_ms:
          description: >-
            Median time from storing a text to the phone sending it, in
            milliseconds, over the bucket's texts. Null when none was sent.
          format: int64
          type:
            - integer
            - 'null'
        send_p95_ms:
          description: >-
            95th percentile of the same time, in milliseconds. Null when none
            was sent.
          format: int64
          type:
            - integer
            - 'null'
        sent:
          description: Texts you sent in the bucket.
          format: int64
          type: integer
        unconfirmed:
          description: >-
            Texts the phone had but never said whether it sent (status
            unconfirmed). Not counted as failed.
          format: int64
          type: integer
      required:
        - period_start_at
        - sent
        - received
        - send_p50_ms
        - send_p95_ms
        - delivered
        - no_report
        - unconfirmed
        - failed
        - queued
      type: object
    PhoneMessageSendLimit:
      additionalProperties: false
      description: The most texts one phone may send in a stretch of time.
      properties:
        count:
          description: Texts one phone may send per window.
          format: int64
          type: integer
        window_seconds:
          description: The length of the window, in seconds.
          format: int64
          type: integer
      required:
        - count
        - window_seconds
      type: object
    PhoneMessageMetricsTotals:
      additionalProperties: false
      description: The window's texts in all.
      properties:
        delivered:
          description: Texts delivered (status delivered).
          format: int64
          type: integer
        failed:
          description: Texts that failed (status failed); the failures list says why.
          format: int64
          type: integer
        no_report:
          description: >-
            Texts that left the phone but never got a delivery report (status
            sent). Some carriers return none, so this is not a failure.
          format: int64
          type: integer
        numbers_received_from:
          description: Different numbers that texted you in the window.
          format: int64
          type: integer
        numbers_texted:
          description: Different numbers you texted in the window.
          format: int64
          type: integer
        phones_sending:
          description: Phones that sent at least one text in the window.
          format: int64
          type: integer
        queued:
          description: >-
            Texts still on their way to the phone, or in any status that is not
            final yet (status queued).
          format: int64
          type: integer
        received:
          description: >-
            Texts your phones received in the window, counted at the time the
            phone received them.
          format: int64
          type: integer
        sent:
          description: >-
            Texts you sent in the window, counted at the time the platform
            stored them. Equals delivered + no_report + unconfirmed + failed +
            queued.
          format: int64
          type: integer
        unconfirmed:
          description: >-
            Texts the phone had but never said whether it sent (status
            unconfirmed). Not counted as failed.
          format: int64
          type: integer
      required:
        - sent
        - received
        - phones_sending
        - numbers_texted
        - numbers_received_from
        - delivered
        - no_report
        - unconfirmed
        - failed
        - queued
      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
    PhoneMessageOutcomes:
      additionalProperties: false
      description: >-
        How the texts you sent ended up. The five outcomes add up to the texts
        sent.
      properties:
        delivered:
          description: Texts delivered (status delivered).
          format: int64
          type: integer
        failed:
          description: Texts that failed (status failed); the failures list says why.
          format: int64
          type: integer
        no_report:
          description: >-
            Texts that left the phone but never got a delivery report (status
            sent). Some carriers return none, so this is not a failure.
          format: int64
          type: integer
        queued:
          description: >-
            Texts still on their way to the phone, or in any status that is not
            final yet (status queued).
          format: int64
          type: integer
        unconfirmed:
          description: >-
            Texts the phone had but never said whether it sent (status
            unconfirmed). Not counted as failed.
          format: int64
          type: integer
      required:
        - delivered
        - no_report
        - unconfirmed
        - failed
        - queued
      type: object
    PhoneMessageFailurePhone:
      additionalProperties: false
      description: A phone's share of one failure reason.
      properties:
        count:
          description: Texts that failed on this phone for this reason.
          format: int64
          type: integer
        phone_id:
          description: The phone the texts failed on.
          type: string
      required:
        - phone_id
        - count
      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.