---
title: "Get phone session metrics"
method: GET
path: "/sessions/metrics"
tags: ["Sessions"]
---

# Get phone session metrics

`GET /sessions/metrics`

## Request

- Base URL: `https://api.axilio.ai/api/v1`
- URL: `https://api.axilio.ai/api/v1/sessions/metrics`
- Auth: API key in header `X-Axilio-Api-Key`
- TypeScript: <https://skmtc.dev/axilioai/apis/axilio-api-2/docs/sessions/metrics/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns your organization's ended phone sessions over a window as points: one per hour or day in time_zone (and per group with group_by), each with the sessions, their phone time in seconds and what it cost. A session counts in the bucket it was billed in, as it ended, dedicated phones' at no cost; sessions 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.

## Query parameters

- `period_start_at` string, date-time: Start of the window (RFC 3339). Defaults to 7 days before period_end_at, and may be at most a year before now.
- `period_end_at` string, date-time: End of the window (RFC 3339). Defaults to now, and a later time is read as now.
- `granularity` 'hour' | 'day': Bucket size: hour or day. hour is allowed for windows of 7 days or less.
- `time_zone` string: 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.
- `group_by` 'allocated_by' | 'device_class' | 'platform': Split each bucket by allocated_by, device_class or platform. Omit for one point per bucket.

## Response `200`

OK

- PhoneSessionMetricsResponse: Ended phone sessions over the window, one point per bucket (and per group with group_by).
  - `points` PhoneSessionMetricsPoint[], nullable, required: One point per bucket, oldest first, and per group within a bucket when grouped. The first bucket starts at or before period_start_at.
    - `allocated_by` 'dashboard_run' | 'api_run' | 'interactive': How the sessions were started. Set only with group_by=allocated_by.
    - `device_class` 'phone': What the sessions drove. Set only with group_by=device_class.
    - `period_start_at` string, date-time, required: Start of the bucket (RFC 3339, UTC): a local hour or a local midnight in time_zone. A session counts in the bucket it was billed in, as it ended.
    - `platform` 'android': The phones' platform. Set only with group_by=platform.
    - `session_cost_microdollars` integer, required: What their phone time cost, in microdollars. A dedicated phone's sessions cost nothing.
    - `session_seconds` integer, required: Their phone time, in seconds, dedicated phones' included.
    - `sessions` integer, required: Sessions that ended in the bucket.

## Other responses

- `403`: Forbidden
- `422`: Unprocessable Entity
- `500`: Internal Server Error

## Changes

- **2026-11-02** `62aa324803a7`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/axilioai/apis/axilio-api-2/changes/sessions/metrics/get.md)

---

[API](https://skmtc.dev/axilioai/apis/axilio-api-2.md) - [All operations](https://skmtc.dev/axilioai/apis/axilio-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/axilioai/apis/axilio-api-2/revisions/62aa324803a7?raw)
