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

# Get a time series metric

> Fetch a metric as one value per hour, day, week, or longer bucket with threadTimeSeriesMetric.

`threadTimeSeriesMetric` returns a metric as one value per time bucket, such as threads created per day or median first response time per week. Use it for line and bar charts.

<Snippet file="graphql/sdk-note.mdx" />

This query requires the `metrics:read` permission, or `metricsAgent:read` for `agent_` metrics. See [Permissions](/docs/graphql/reporting#permissions).

## Get a time series

`input` takes these fields:

* **`metricName`**: any time series metric from the [metrics reference](/docs/graphql/reporting/metrics)
* **`from`** and **`to`**: the date range, in UTC. See [Dates and time zones](/docs/graphql/reporting#dates-and-time-zones)
* **`interval`**: the bucket size, with `unit` set to `HOUR`, `DAY`, `WEEK`, `MONTH`, `QUARTER`, or `YEAR`
* **`mode`**: `METRIC` for values, or `THREAD_IDS` for the threads behind them
* **`percentile`**: for duration metrics, an integer from 1 to 99. Defaults to 50
* **`filters`** and **`groupBy`**: see [Filter and group reporting queries](/docs/graphql/reporting/filters)

This query returns the daily 90th percentile first response time for email and Slack threads in September, split into the 5 slowest tiers plus `__OTHER__`:

<Snippet file="graphql/get-thread-time-series-metric.mdx" />

## Read the response

`timestamps` lists the start of every bucket in the range, in order. Each entry in `series` has a `values` list that lines up with `timestamps` index by index, and a `group` that says which group the series belongs to. Without `groupBy`, `series` has one entry and its `group` is `null`.

A `null` in `values` means there was no data in that bucket. Buckets are never dropped, so the list always covers the whole range. Threads in Todo, Snoozed, and Done (`threads_status_count__*`) carry the last known count forward instead.

## Get the threads behind a bucket

Set `mode` to `THREAD_IDS` to get the distinct IDs of the threads behind the value. The IDs cover the whole range, so narrow `from` and `to` to one bucket to get its threads. To get one group's threads, add the group as a filter instead of using `groupBy`, which isn't allowed in this mode.

This query returns the Enterprise tier threads that moved to Done on September 14:

<Snippet file="graphql/get-thread-time-series-metric-thread-ids.mdx" />

`timestamps` and `series` are `null` in this mode.


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