---
title: "POST /metrics/historical/{InstanceId}"
method: POST
path: "/metrics/historical/{InstanceId}"
---

# POST /metrics/historical/{InstanceId}

`POST /metrics/historical/{InstanceId}`

Gets historical metric data from the specified Amazon Connect instance.

For a description of each historical metric, see [Historical Metrics Definitions](https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html) in the _Amazon Connect Administrator Guide_.

## Path parameters

- `InstanceId` string, required

## Query parameters

- `MaxResults` string
- `NextToken` string

## Request body

- object
  - `StartTime` string, date-time, required — <p>The timestamp, in UNIX Epoch time format, at which to start the reporting interval for the retrieval of historical metrics data. The time must be specified using a multiple of 5 minutes, such as 10:05, 10:10, 10:15.</p> <p>The start time cannot be earlier than 24 hours before the time of the request. Historical metrics are available only for 24 hours.</p>
  - `EndTime` string, date-time, required — <p>The timestamp, in UNIX Epoch time format, at which to end the reporting interval for the retrieval of historical metrics data. The time must be specified using an interval of 5 minutes, such as 11:00, 11:05, 11:10, and must be later than the start time timestamp.</p> <p>The time range between the start and end time must be less than 24 hours.</p>
  - `Filters` object, required — Contains the filter to apply when retrieving metrics.
    - `Queues` QueueId[] — The queues to use to filter the metrics. You should specify at least one queue, and can specify up to 100 queues per request. The <code>GetCurrentMetricsData</code> API in particular requires a queue when you include a <code>Filter</code> in your request.
    - `Channels` Channel[] — The channel to use to filter the metrics.
    - `RoutingProfiles` RoutingProfileId[] — A list of up to 100 routing profile IDs or ARNs.
  - `Groupings` Grouping[] — <p>The grouping applied to the metrics returned. For example, when results are grouped by queue, the metrics returned are grouped by queue. The values returned apply to the metrics for each queue rather than aggregated for all queues.</p> <p>If no grouping is specified, a summary of metrics for all queues is returned.</p>
  - `HistoricalMetrics` HistoricalMetric[], required — <p>The metrics to retrieve. Specify the name, unit, and statistic for each metric. The following historical metrics are available. For a description of each metric, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/historical-metrics-definitions.html">Historical Metrics Definitions</a> in the <i>Amazon Connect Administrator Guide</i>.</p> <note> <p>This API does not support a contacts incoming metric (there's no CONTACTS_INCOMING metric missing from the documented list). </p> </note> <dl> <dt>ABANDON_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>AFTER_CONTACT_WORK_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>API_CONTACTS_HANDLED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CALLBACK_CONTACTS_HANDLED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_ABANDONED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_AGENT_HUNG_UP_FIRST</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_CONSULTED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_HANDLED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_HANDLED_INCOMING</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_HANDLED_OUTBOUND</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_HOLD_ABANDONS</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_MISSED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_QUEUED</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_TRANSFERRED_IN</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_TRANSFERRED_IN_FROM_QUEUE</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_TRANSFERRED_OUT</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>CONTACTS_TRANSFERRED_OUT_FROM_QUEUE</dt> <dd> <p>Unit: COUNT</p> <p>Statistic: SUM</p> </dd> <dt>HANDLE_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>HOLD_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>INTERACTION_AND_HOLD_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>INTERACTION_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>OCCUPANCY</dt> <dd> <p>Unit: PERCENT</p> <p>Statistic: AVG</p> </dd> <dt>QUEUE_ANSWER_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: AVG</p> </dd> <dt>QUEUED_TIME</dt> <dd> <p>Unit: SECONDS</p> <p>Statistic: MAX</p> </dd> <dt>SERVICE_LEVEL</dt> <dd> <p>You can include up to 20 SERVICE_LEVEL metrics in a request.</p> <p>Unit: PERCENT</p> <p>Statistic: AVG</p> <p>Threshold: For <code>ThresholdValue</code>, enter any whole number from 1 to 604800 (inclusive), in seconds. For <code>Comparison</code>, you must enter <code>LT</code> (for "Less than"). </p> </dd> </dl>
    - `Name` 'CONTACTS_QUEUED' | 'CONTACTS_HANDLED' | 'CONTACTS_ABANDONED' | 'CONTACTS_CONSULTED' | 'CONTACTS_AGENT_HUNG_UP_FIRST' | 'CONTACTS_HANDLED_INCOMING' | 'CONTACTS_HANDLED_OUTBOUND' | 'CONTACTS_HOLD_ABANDONS' | 'CONTACTS_TRANSFERRED_IN' | 'CONTACTS_TRANSFERRED_OUT' | 'CONTACTS_TRANSFERRED_IN_FROM_QUEUE' | 'CONTACTS_TRANSFERRED_OUT_FROM_QUEUE' | 'CONTACTS_MISSED' | 'CALLBACK_CONTACTS_HANDLED' | 'API_CONTACTS_HANDLED' | 'OCCUPANCY' | 'HANDLE_TIME' | 'AFTER_CONTACT_WORK_TIME' | 'QUEUED_TIME' | 'ABANDON_TIME' | 'QUEUE_ANSWER_TIME' | 'HOLD_TIME' | 'INTERACTION_TIME' | 'INTERACTION_AND_HOLD_TIME' | 'SERVICE_LEVEL' — The name of the metric.
    - `Threshold` object — The threshold for the metric, used with service level metrics.
      - `Comparison` 'LT' — The type of comparison. Only "less than" (LT) comparisons are supported.
      - `ThresholdValue` number, double — The threshold value to compare.
    - `Statistic` 'SUM' | 'MAX' | 'AVG' — The statistic for the metric.
    - `Unit` 'SECONDS' | 'COUNT' | 'PERCENT' — The unit for the metric.
  - `NextToken` string — The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
  - `MaxResults` integer — The maximum number of results to return per page.

## Response `200`

Success

- GetMetricDataResponse
  - `NextToken` string — <p>If there are additional results, this is the token for the next set of results.</p> <p>The token expires after 5 minutes from the time it is created. Subsequent requests that use the token must use the same request parameters as the request that generated the token.</p>
  - `MetricResults` HistoricalMetricResult[] — <p>Information about the historical metrics.</p> <p>If no grouping is specified, a summary of metric data is returned.</p>
    - `Dimensions` object — The dimension for the metrics.
      - `Queue` object — Information about the queue for which metrics are returned.
        - `Id` string — The identifier of the queue.
        - `Arn` string — The Amazon Resource Name (ARN) of the queue.
      - `Channel` 'VOICE' | 'CHAT' | 'TASK' — The channel used for grouping and filters.
      - `RoutingProfile` RoutingProfileReference — Information about the routing profile assigned to the user.
        - `Id` string — The identifier of the routing profile.
        - `Arn` string — The Amazon Resource Name (ARN) of the routing profile.
    - `Collections` HistoricalMetricData[] — The set of metrics.
      - `Metric` object — Information about the metric.
        - `Name` 'CONTACTS_QUEUED' | 'CONTACTS_HANDLED' | 'CONTACTS_ABANDONED' | 'CONTACTS_CONSULTED' | 'CONTACTS_AGENT_HUNG_UP_FIRST' | 'CONTACTS_HANDLED_INCOMING' | 'CONTACTS_HANDLED_OUTBOUND' | 'CONTACTS_HOLD_ABANDONS' | 'CONTACTS_TRANSFERRED_IN' | 'CONTACTS_TRANSFERRED_OUT' | 'CONTACTS_TRANSFERRED_IN_FROM_QUEUE' | 'CONTACTS_TRANSFERRED_OUT_FROM_QUEUE' | 'CONTACTS_MISSED' | 'CALLBACK_CONTACTS_HANDLED' | 'API_CONTACTS_HANDLED' | 'OCCUPANCY' | 'HANDLE_TIME' | 'AFTER_CONTACT_WORK_TIME' | 'QUEUED_TIME' | 'ABANDON_TIME' | 'QUEUE_ANSWER_TIME' | 'HOLD_TIME' | 'INTERACTION_TIME' | 'INTERACTION_AND_HOLD_TIME' | 'SERVICE_LEVEL' — The name of the metric.
        - `Threshold` object — The threshold for the metric, used with service level metrics.
          - `Comparison` 'LT' — The type of comparison. Only "less than" (LT) comparisons are supported.
          - `ThresholdValue` number, double — The threshold value to compare.
        - `Statistic` 'SUM' | 'MAX' | 'AVG' — The statistic for the metric.
        - `Unit` 'SECONDS' | 'COUNT' | 'PERCENT' — The unit for the metric.
      - `Value` number, double — The value of the metric.

## Other responses

- `480` — InvalidRequestException
- `481` — InvalidParameterException
- `482` — InternalServiceException
- `483` — ThrottlingException
- `484` — ResourceNotFoundException

---

[API](https://skmtc.net/aws/apis/connect.md) · [All operations](https://skmtc.net/aws/apis/connect/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/connect/versions/fbcf0a4faed2/schema)
