---
title: Get an SLO's history
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Service Level Objectives
---

# Get an SLO's history{% #get-an-slos-history %}
Copy pageCopied
{% tab title="v1" %}

| Datadog site      | API endpoint                                                  |
| ----------------- | ------------------------------------------------------------- |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v1/slo/{slo_id}/history |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v1/slo/{slo_id}/history |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v1/slo/{slo_id}/history      |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v1/slo/{slo_id}/history      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v1/slo/{slo_id}/history  |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v1/slo/{slo_id}/history     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v1/slo/{slo_id}/history |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v1/slo/{slo_id}/history |

### Overview



Get a specific SLO's history, regardless of its SLO type.

The detailed history data is structured according to the source data type. For example, metric data is included for event SLOs that use the metric source, and monitor SLO types include the monitor transition history.

**Note:** There are different response formats for event based and time based SLOs. Examples of both are shown.
This endpoint requires the `slos_read` permission.
OAuth apps require the `slos_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#service-level-objectives) to access this endpoint.



### Arguments

#### Path Parameters

| Name                     | Type   | Description                                   |
| ------------------------ | ------ | --------------------------------------------- |
| slo_id [*required*] | string | The ID of the service level objective object. |

#### Query Strings

| Name                      | Type    | Description                                                                                                                                                                    |
| ------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| from_ts [*required*] | integer | The `from` timestamp for the query window in epoch seconds.                                                                                                                    |
| to_ts [*required*]   | integer | The `to` timestamp for the query window in epoch seconds.                                                                                                                      |
| target                    | number  | The SLO target. If `target` is passed in, the response will include the remaining error budget and a timeframe value of `custom`.                                              |
| apply_correction          | boolean | Defaults to `true`. If any SLO corrections are applied and this parameter is set to `false`, then the corrections will not be applied and the SLI values will not be affected. |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
A service level objective history response.

| Parent field         | Field                           | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                      | data                            | object   | An array of service level objective objects.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| data                 | from_ts                         | int64    | The `from` timestamp in epoch seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| data                 | group_by                        | [string] | For `metric` based SLOs where the query includes a group-by clause, this represents the list of grouping parameters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | This is not included in responses for `monitor` based SLOs.                                                  |
| data                 | groups                          | [object] | For grouped SLOs, this represents SLI data for specific groups.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | This is not included in the responses for `metric` based SLOs.                                               |
| groups               | error_budget_remaining          | object   | A mapping of threshold `timeframe` to the remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| additionalProperties | <any-key>                       | double   | Remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| groups               | errors                          | [object] | An array of error objects returned while querying the history data for the service level objective.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| errors               | error_message [*required*] | string   | A message with more details about the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| errors               | error_type [*required*]    | string   | Type of the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| groups               | group                           | string   | For groups in a grouped SLO, this is the group name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| groups               | history                         | [array]  | The state transition history for the monitor. It is represented as an array of pairs. Each pair is an array containing the timestamp of the transition as an integer in Unix epoch format in the first element, and the state as an integer in the second element. An integer value of `0` for state means uptime, `1` means downtime, and `2` means no data. Periods of no data are counted either as uptime or downtime depending on monitor settings. See [SLO documentation](https://docs.datadoghq.com/service_management/service_level_objectives/monitor.md#missing-data) for detailed information.                                                                                       |
| groups               | monitor_modified                | int64    | For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| groups               | monitor_type                    | string   | For `monitor` based SLOs, this describes the type of monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| groups               | name                            | string   | For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| groups               | precision                       | double   | **DEPRECATED**: The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. Use `span_precision` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| groups               | preview                         | boolean  | For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime calculation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| groups               | sli_value                       | double   | The current SLI value of the SLO over the history window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| groups               | span_precision                  | double   | The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| groups               | uptime                          | double   | **DEPRECATED**: Use `sli_value` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| data                 | monitors                        | [object] | For multi-monitor SLOs, this represents SLI data for specific monitors.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | This is not included in the responses for `metric` based SLOs.                                               |
| monitors             | error_budget_remaining          | object   | A mapping of threshold `timeframe` to the remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| additionalProperties | <any-key>                       | double   | Remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| monitors             | errors                          | [object] | An array of error objects returned while querying the history data for the service level objective.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| errors               | error_message [*required*] | string   | A message with more details about the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| errors               | error_type [*required*]    | string   | Type of the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| monitors             | group                           | string   | For groups in a grouped SLO, this is the group name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| monitors             | history                         | [array]  | The state transition history for the monitor. It is represented as an array of pairs. Each pair is an array containing the timestamp of the transition as an integer in Unix epoch format in the first element, and the state as an integer in the second element. An integer value of `0` for state means uptime, `1` means downtime, and `2` means no data. Periods of no data are counted either as uptime or downtime depending on monitor settings. See [SLO documentation](https://docs.datadoghq.com/service_management/service_level_objectives/monitor.md#missing-data) for detailed information.                                                                                       |
| monitors             | monitor_modified                | int64    | For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| monitors             | monitor_type                    | string   | For `monitor` based SLOs, this describes the type of monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| monitors             | name                            | string   | For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| monitors             | precision                       | double   | **DEPRECATED**: The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp. Use `span_precision` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| monitors             | preview                         | boolean  | For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime calculation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| monitors             | sli_value                       | double   | The current SLI value of the SLO over the history window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| monitors             | span_precision                  | double   | The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| monitors             | uptime                          | double   | **DEPRECATED**: Use `sli_value` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| data                 | overall                         | object   | An object that holds an SLI value and its associated data. It can represent an SLO's overall SLI value. This can also represent the SLI value for a specific monitor in multi-monitor SLOs, or a group in grouped SLOs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| overall              | error_budget_remaining          | object   | A mapping of threshold `timeframe` to the remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| additionalProperties | <any-key>                       | double   | Remaining error budget.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| overall              | errors                          | [object] | An array of error objects returned while querying the history data for the service level objective.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| errors               | error_message [*required*] | string   | A message with more details about the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| errors               | error_type [*required*]    | string   | Type of the error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| overall              | group                           | string   | For groups in a grouped SLO, this is the group name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| overall              | history                         | [array]  | The state transition history for `monitor` or `time-slice` SLOs. It is represented as an array of pairs. Each pair is an array containing the timestamp of the transition as an integer in Unix epoch format in the first element, and the state as an integer in the second element. An integer value of `0` for state means uptime, `1` means downtime, and `2` means no data. Periods of no data count as uptime in time-slice SLOs, while for monitor SLOs, no data is counted either as uptime or downtime depending on monitor settings. See [SLO documentation](https://docs.datadoghq.com/service_management/service_level_objectives/monitor.md#missing-data) for detailed information. |
| overall              | monitor_modified                | int64    | For `monitor` based SLOs, this is the last modified timestamp in epoch seconds of the monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| overall              | monitor_type                    | string   | For `monitor` based SLOs, this describes the type of monitor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| overall              | name                            | string   | For groups in a grouped SLO, this is the group name. For monitors in a multi-monitor SLO, this is the monitor name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| overall              | precision                       | object   | A mapping of threshold `timeframe` to number of accurate decimals, regardless of the from && to timestamp.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| additionalProperties | <any-key>                       | double   | The number of accurate decimals.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| overall              | preview                         | boolean  | For `monitor` based SLOs, when `true` this indicates that a replay is in progress to give an accurate uptime calculation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| overall              | sli_value                       | double   | The current SLI value of the SLO over the history window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| overall              | span_precision                  | double   | The amount of decimal places the SLI value is accurate to for the given from `&&` to timestamp.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| overall              | uptime                          | double   | **DEPRECATED**: Use `sli_value` instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| data                 | series                          | object   | A `metric` based SLO history response.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | This is not included in responses for `monitor` based SLOs.                                                  |
| series               | denominator [*required*]   | object   | A representation of `metric` based SLO timeseries for the provided queries. This is the same response type from `batch_query` endpoint.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| denominator          | count [*required*]         | int64    | Count of submitted metrics.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| denominator          | metadata                        | object   | Query metadata.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| metadata             | aggr                            | string   | **DEPRECATED**: Query aggregator function.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| metadata             | expression                      | string   | **DEPRECATED**: Query expression.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| metadata             | metric                          | string   | **DEPRECATED**: Query metric used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| metadata             | query_index                     | int64    | **DEPRECATED**: Query index from original combined query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| metadata             | scope                           | string   | **DEPRECATED**: Query scope.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| metadata             | unit                            | [object] | An array of metric units that contains up to two unit objects. For example, bytes represents one unit object and bytes per second represents two unit objects. If a metric query only has one unit object, the second array element is null.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unit                 | family                          | string   | The family of metric unit, for example `bytes` is the family for `kibibyte`, `byte`, and `bit` units.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| unit                 | id                              | int64    | The ID of the metric unit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| unit                 | name                            | string   | The unit of the metric, for instance `byte`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unit                 | plural                          | string   | The plural Unit of metric, for instance `bytes`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| unit                 | scale_factor                    | double   | The scale factor of metric unit, for instance `1.0`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| unit                 | short_name                      | string   | A shorter and abbreviated version of the metric unit, for instance `B`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| denominator          | sum [*required*]           | double   | Total sum of the query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| denominator          | values [*required*]        | [number] | The query values for each metric.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| series               | interval [*required*]      | int64    | The aggregated query interval for the series data. It's implicit based on the query time window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| series               | message                         | string   | Optional message if there are specific query issues/warnings.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| series               | numerator [*required*]     | object   | A representation of `metric` based SLO timeseries for the provided queries. This is the same response type from `batch_query` endpoint.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| numerator            | count [*required*]         | int64    | Count of submitted metrics.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| numerator            | metadata                        | object   | Query metadata.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| metadata             | aggr                            | string   | **DEPRECATED**: Query aggregator function.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| metadata             | expression                      | string   | **DEPRECATED**: Query expression.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| metadata             | metric                          | string   | **DEPRECATED**: Query metric used.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| metadata             | query_index                     | int64    | **DEPRECATED**: Query index from original combined query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| metadata             | scope                           | string   | **DEPRECATED**: Query scope.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| metadata             | unit                            | [object] | An array of metric units that contains up to two unit objects. For example, bytes represents one unit object and bytes per second represents two unit objects. If a metric query only has one unit object, the second array element is null.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unit                 | family                          | string   | The family of metric unit, for example `bytes` is the family for `kibibyte`, `byte`, and `bit` units.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| unit                 | id                              | int64    | The ID of the metric unit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| unit                 | name                            | string   | The unit of the metric, for instance `byte`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| unit                 | plural                          | string   | The plural Unit of metric, for instance `bytes`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| unit                 | scale_factor                    | double   | The scale factor of metric unit, for instance `1.0`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| unit                 | short_name                      | string   | A shorter and abbreviated version of the metric unit, for instance `B`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| numerator            | sum [*required*]           | double   | Total sum of the query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| numerator            | values [*required*]        | [number] | The query values for each metric.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| series               | query [*required*]         | string   | The combined numerator and denominator query CSV.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| series               | res_type [*required*]      | string   | The series result type. This mimics `batch_query` response type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| series               | resp_version [*required*]  | int64    | The series response version type. This mimics `batch_query` response type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| series               | times [*required*]         | [number] | An array of query timestamps in EPOCH milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| data                 | thresholds                      | object   | mapping of string timeframe to the SLO threshold.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| additionalProperties | <any-key>                       | object   | SLO thresholds (target and optionally warning) for a single time window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| <any-key>            | target [*required*]        | double   | The target value for the service level indicator within the corresponding timeframe.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <any-key>            | target_display                  | string   | A string representation of the target that indicates its precision. It uses trailing zeros to show significant decimal places (for example `98.00`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Always included in service level objective responses. Ignored in create/update requests.                     |
| <any-key>            | timeframe [*required*]     | enum     | The SLO time window options. Note that "custom" is not a valid option for creating or updating SLOs. It is only used when querying SLO history over custom timeframes. Allowed enum values: `7d,30d,90d,custom`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| <any-key>            | warning                         | double   | The warning value for the service level objective.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| <any-key>            | warning_display                 | string   | A string representation of the warning target (see the description of the `target_display` field for details).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Included in service level objective responses if a warning target exists. Ignored in create/update requests. |
| data                 | to_ts                           | int64    | The `to` timestamp in epoch seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| data                 | type                            | enum     | The type of the service level objective. Allowed enum values: `metric,monitor,time_slice`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| data                 | type_id                         | enum     | A numeric representation of the type of the service level objective (`0` for monitor, `1` for metric). Always included in service level objective responses. Ignored in create/update requests. Allowed enum values: `0,1,2`                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|                      | errors                          | [object] | A list of errors while querying the history data for the service level objective.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| errors               | error                           | string   | Human readable error.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "from_ts": 1615323990,
    "group_by": [],
    "groups": [
      {
        "error_budget_remaining": {
          "<any-key>": "number"
        },
        "errors": [
          {
            "error_message": "",
            "error_type": ""
          }
        ],
        "group": "name",
        "history": [
          [
            1579212382,
            0
          ]
        ],
        "monitor_modified": 1615867200,
        "monitor_type": "string",
        "name": "string",
        "precision": 2,
        "preview": true,
        "sli_value": 99.99,
        "span_precision": 2,
        "uptime": 99.99
      }
    ],
    "monitors": [
      {
        "error_budget_remaining": {
          "<any-key>": "number"
        },
        "errors": [
          {
            "error_message": "",
            "error_type": ""
          }
        ],
        "group": "name",
        "history": [
          [
            1579212382,
            0
          ]
        ],
        "monitor_modified": 1615867200,
        "monitor_type": "string",
        "name": "string",
        "precision": 2,
        "preview": true,
        "sli_value": 99.99,
        "span_precision": 2,
        "uptime": 99.99
      }
    ],
    "overall": {
      "error_budget_remaining": {
        "<any-key>": "number"
      },
      "errors": [
        {
          "error_message": "",
          "error_type": ""
        }
      ],
      "group": "name",
      "history": [
        [
          1579212382,
          0
        ]
      ],
      "monitor_modified": 1615867200,
      "monitor_type": "string",
      "name": "string",
      "precision": {
        "<any-key>": "number"
      },
      "preview": true,
      "sli_value": 99.99,
      "span_precision": 2,
      "uptime": 99.99
    },
    "series": {
      "denominator": {
        "count": 0,
        "metadata": {
          "aggr": "string",
          "expression": "string",
          "metric": "string",
          "query_index": "integer",
          "scope": "string",
          "unit": [
            {
              "family": "bytes",
              "id": 2,
              "name": "byte",
              "plural": "bytes",
              "scale_factor": 1,
              "short_name": "B"
            }
          ]
        },
        "sum": 0,
        "values": [
          []
        ]
      },
      "interval": 0,
      "message": "",
      "numerator": {
        "count": 0,
        "metadata": {
          "aggr": "string",
          "expression": "string",
          "metric": "string",
          "query_index": "integer",
          "scope": "string",
          "unit": [
            {
              "family": "bytes",
              "id": 2,
              "name": "byte",
              "plural": "bytes",
              "scale_factor": 1,
              "short_name": "B"
            }
          ]
        },
        "sum": 0,
        "values": [
          []
        ]
      },
      "query": "",
      "res_type": "",
      "resp_version": 0,
      "times": [
        []
      ]
    },
    "thresholds": {
      "<any-key>": {
        "target": 99.9,
        "target_display": "99.9",
        "timeframe": "30d",
        "warning": 90,
        "warning_display": "90.0"
      }
    },
    "to_ts": 1615928790,
    "type": "metric",
    "type_id": 0
  },
  "errors": [
    {
      "error": "string"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \# Path parameters export slo_id="CHANGE_ME" \# Required query arguments export from_ts="CHANGE_ME" export to_ts="CHANGE_ME" \# Curl command curl -X GET "https://api.datadoghq.com/api/v1/slo/${slo_id}/history?from_ts=${from_ts}&to_ts=${to_ts}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Get an SLO's history returns "OK" response
"""

from datetime import datetime
from dateutil.relativedelta import relativedelta
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.service_level_objectives_api import ServiceLevelObjectivesApi

# there is a valid "slo" in the system
SLO_DATA_0_ID = environ["SLO_DATA_0_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceLevelObjectivesApi(api_client)
    response = api_instance.get_slo_history(
        slo_id=SLO_DATA_0_ID,
        from_ts=int((datetime.now() + relativedelta(days=-1)).timestamp()),
        to_ts=int(datetime.now().timestamp()),
    )

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# Get an SLO's history returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::ServiceLevelObjectivesAPI.new

# there is a valid "slo" in the system
SLO_DATA_0_ID = ENV["SLO_DATA_0_ID"]
p api_instance.get_slo_history(SLO_DATA_0_ID, (Time.now + -1 * 86400).to_i, Time.now.to_i)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```ruby
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
slo_id  = '<YOUR_SLO_ID>'

dog = Dogapi::Client.new(api_key, app_key)

to_ts = 1_571_320_613
from_ts = to_ts - 60 * 60 * 24 * 30

dog.get_service_level_objective_history(slo_id, from_ts, to_ts)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby-legacy) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// Get an SLO's history returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	"time"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
)

func main() {
	// there is a valid "slo" in the system
	SloData0ID := os.Getenv("SLO_DATA_0_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewServiceLevelObjectivesApi(apiClient)
	resp, r, err := api.GetSLOHistory(ctx, SloData0ID, time.Now().AddDate(0, 0, -1).Unix(), time.Now().Unix(), *datadogV1.NewGetSLOHistoryOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `ServiceLevelObjectivesApi.GetSLOHistory`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ServiceLevelObjectivesApi.GetSLOHistory`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// Get an SLO's history returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.ServiceLevelObjectivesApi;
import com.datadog.api.client.v1.model.SLOHistoryResponse;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    ServiceLevelObjectivesApi apiInstance = new ServiceLevelObjectivesApi(defaultClient);

    // there is a valid "slo" in the system
    String SLO_DATA_0_ID = System.getenv("SLO_DATA_0_ID");

    try {
      SLOHistoryResponse result =
          apiInstance.getSLOHistory(
              SLO_DATA_0_ID,
              OffsetDateTime.now().plusDays(-1).toInstant().getEpochSecond(),
              OffsetDateTime.now().toInstant().getEpochSecond());
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ServiceLevelObjectivesApi#getSLOHistory");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```python
from datadog import initialize, api
import time

options = {
    'api_key': '<DATADOG_API_KEY>',
    'app_key': '<DATADOG_APPLICATION_KEY>'
}

slo_id = '<YOUR_SLO_ID>'

initialize(**options)

to_ts = int(time.time())
from_ts = to_ts - 60*60*24*30

api.ServiceLevelObjective.history(slo_id, from_ts=from_ts, to_ts=to_ts)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python-legacy) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python "example.py"
##### 

```rust
// Get an SLO's history returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_service_level_objectives::GetSLOHistoryOptionalParams;
use datadog_api_client::datadogV1::api_service_level_objectives::ServiceLevelObjectivesAPI;

#[tokio::main]
async fn main() {
    // there is a valid "slo" in the system
    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
    let configuration = datadog::Configuration::new();
    let api = ServiceLevelObjectivesAPI::with_config(configuration);
    let resp = api
        .get_slo_history(
            slo_data_0_id.clone(),
            1636542671,
            1636629071,
            GetSLOHistoryOptionalParams::default(),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * Get an SLO's history returns "OK" response
 */

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.ServiceLevelObjectivesApi(configuration);

// there is a valid "slo" in the system
const SLO_DATA_0_ID = process.env.SLO_DATA_0_ID as string;

const params: v1.ServiceLevelObjectivesApiGetSLOHistoryRequest = {
  sloId: SLO_DATA_0_ID,
  fromTs: Math.round(
    new Date(new Date().getTime() + -1 * 86400 * 1000).getTime() / 1000
  ),
  toTs: Math.round(new Date().getTime() / 1000),
};

apiInstance
  .getSLOHistory(params)
  .then((data: v1.SLOHistoryResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"
{% /tab %}
