---
title: Search for SLOs
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Service Level Objectives
---

# Search for SLOs{% #search-for-slos %}
Copy pageCopied
{% tab title="v1" %}

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

### Overview

Get a list of service level objective objects for your organization. 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

#### Query Strings

| Name           | Type    | Description                                                                                                                        |
| -------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| query          | string  | The query string to filter results based on SLO names. Some examples of queries include `service:<service-name>` and `<slo-name>`. |
| page[size]     | integer | The number of files to return in the response `[default=10]`.                                                                      |
| page[number]   | integer | The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`.                       |
| include_facets | boolean | Whether or not to return facet information in the response `[default=false]`.                                                      |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
A search SLO response containing results from the search query.

| Parent field               | Field                       | Type      | Description                                                                                                                                                                                                                                    |
| -------------------------- | --------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                            | data                        | object    | Data from search SLO response.                                                                                                                                                                                                                 |
| data                       | attributes                  | object    | Attributes                                                                                                                                                                                                                                     |
| attributes                 | facets                      | object    | Facets                                                                                                                                                                                                                                         |
| facets                     | all_tags                    | [object]  | All tags associated with an SLO.                                                                                                                                                                                                               |
| all_tags                   | count                       | int64     | Count                                                                                                                                                                                                                                          |
| all_tags                   | name                        | string    | Facet                                                                                                                                                                                                                                          |
| facets                     | creator_name                | [object]  | Creator of an SLO.                                                                                                                                                                                                                             |
| creator_name               | count                       | int64     | Count                                                                                                                                                                                                                                          |
| creator_name               | name                        | string    | Facet                                                                                                                                                                                                                                          |
| facets                     | env_tags                    | [object]  | Tags with the `env` tag key.                                                                                                                                                                                                                   |
| env_tags                   | count                       | int64     | Count                                                                                                                                                                                                                                          |
| env_tags                   | name                        | string    | Facet                                                                                                                                                                                                                                          |
| facets                     | service_tags                | [object]  | Tags with the `service` tag key.                                                                                                                                                                                                               |
| service_tags               | count                       | int64     | Count                                                                                                                                                                                                                                          |
| service_tags               | name                        | string    | Facet                                                                                                                                                                                                                                          |
| facets                     | slo_type                    | [object]  | Type of SLO.                                                                                                                                                                                                                                   |
| slo_type                   | count                       | int64     | Count                                                                                                                                                                                                                                          |
| slo_type                   | name                        | double    | Facet                                                                                                                                                                                                                                          |
| facets                     | target                      | [object]  | SLO Target                                                                                                                                                                                                                                     |
| target                     | count                       | int64     | Count                                                                                                                                                                                                                                          |
| target                     | name                        | double    | Facet                                                                                                                                                                                                                                          |
| facets                     | team_tags                   | [object]  | Tags with the `team` tag key.                                                                                                                                                                                                                  |
| team_tags                  | count                       | int64     | Count                                                                                                                                                                                                                                          |
| team_tags                  | name                        | string    | Facet                                                                                                                                                                                                                                          |
| facets                     | timeframe                   | [object]  | Timeframes of SLOs.                                                                                                                                                                                                                            |
| timeframe                  | count                       | int64     | Count                                                                                                                                                                                                                                          |
| timeframe                  | name                        | string    | Facet                                                                                                                                                                                                                                          |
| attributes                 | slos                        | [object]  | SLOs                                                                                                                                                                                                                                           |
| slos                       | data                        | object    | A service level objective ID and attributes.                                                                                                                                                                                                   |
| data                       | attributes                  | object    | A service level objective object includes a service level indicator, thresholds for one or more timeframes, and metadata (`name`, `description`, and `tags`).                                                                                  |
| attributes                 | all_tags                    | [string]  | A list of tags associated with this service level objective. Always included in service level objective responses (but may be empty).                                                                                                          |
| attributes                 | created_at                  | int64     | Creation timestamp (UNIX time in seconds)                                                                                                                                                                                                      | Always included in service level objective responses.                                                         |
| attributes                 | creator                     | object    | The creator of the SLO                                                                                                                                                                                                                         |
| creator                    | email                       | string    | Email of the creator.                                                                                                                                                                                                                          |
| creator                    | id                          | int64     | User ID of the creator.                                                                                                                                                                                                                        |
| creator                    | name                        | string    | Name of the creator.                                                                                                                                                                                                                           |
| attributes                 | description                 | string    | A user-defined description of the service level objective.                                                                                                                                                                                     | Always included in service level objective responses (but may be `null`). Optional in create/update requests. |
| attributes                 | env_tags                    | [string]  | Tags with the `env` tag key.                                                                                                                                                                                                                   |
| attributes                 | groups                      | [string]  | A list of (up to 100) monitor groups that narrow the scope of a monitor service level objective. Included in service level objective responses if it is not empty.                                                                             |
| attributes                 | modified_at                 | int64     | Modification timestamp (UNIX time in seconds)                                                                                                                                                                                                  | Always included in service level objective responses.                                                         |
| attributes                 | monitor_ids                 | [integer] | A list of monitor ids that defines the scope of a monitor service level objective.                                                                                                                                                             |
| attributes                 | name                        | string    | The name of the service level objective object.                                                                                                                                                                                                |
| attributes                 | overall_status              | [object]  | calculated status and error budget remaining.                                                                                                                                                                                                  |
| overall_status             | error                       | string    | Error message if SLO status or error budget could not be calculated.                                                                                                                                                                           |
| overall_status             | error_budget_remaining      | double    | Remaining error budget of the SLO in percentage.                                                                                                                                                                                               |
| overall_status             | indexed_at                  | int64     | timestamp (UNIX time in seconds) of when the SLO status and error budget were calculated.                                                                                                                                                      |
| overall_status             | raw_error_budget_remaining  | object    | Error budget remaining for an SLO.                                                                                                                                                                                                             |
| raw_error_budget_remaining | unit                        | string    | Error budget remaining unit.                                                                                                                                                                                                                   |
| raw_error_budget_remaining | value                       | double    | Error budget remaining value.                                                                                                                                                                                                                  |
| overall_status             | span_precision              | int64     | The amount of decimal places the SLI value is accurate to.                                                                                                                                                                                     |
| overall_status             | state                       | enum      | State of the SLO. Allowed enum values: `breached,warning,ok,no_data`                                                                                                                                                                           |
| overall_status             | status                      | double    | The status of the SLO.                                                                                                                                                                                                                         |
| overall_status             | target                      | double    | The target of the SLO.                                                                                                                                                                                                                         |
| overall_status             | timeframe                   | 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`                                |
| attributes                 | query                       | object    | A metric-based SLO. **Required if type is `metric`**. Note that Datadog only allows the sum by aggregator to be used because this will sum up all request counts instead of averaging them, or taking the max or min of all of those requests. |
| query                      | denominator                 | string    | A Datadog metric query for total (valid) events.                                                                                                                                                                                               |
| query                      | metrics                     | [string]  | Metric names used in the query's numerator and denominator. This field will return null and will be implemented in the next version of this endpoint.                                                                                          |
| query                      | numerator                   | string    | A Datadog metric query for good events.                                                                                                                                                                                                        |
| attributes                 | service_tags                | [string]  | Tags with the `service` tag key.                                                                                                                                                                                                               |
| attributes                 | slo_type                    | enum      | The type of the service level objective. Allowed enum values: `metric,monitor,time_slice`                                                                                                                                                      |
| attributes                 | status                      | object    | Status of the SLO's primary timeframe.                                                                                                                                                                                                         |
| status                     | calculation_error           | string    | Error message if SLO status or error budget could not be calculated.                                                                                                                                                                           |
| status                     | error_budget_remaining      | double    | Remaining error budget of the SLO in percentage.                                                                                                                                                                                               |
| status                     | indexed_at                  | int64     | timestamp (UNIX time in seconds) of when the SLO status and error budget were calculated.                                                                                                                                                      |
| status                     | raw_error_budget_remaining  | object    | Error budget remaining for an SLO.                                                                                                                                                                                                             |
| raw_error_budget_remaining | unit                        | string    | Error budget remaining unit.                                                                                                                                                                                                                   |
| raw_error_budget_remaining | value                       | double    | Error budget remaining value.                                                                                                                                                                                                                  |
| status                     | sli                         | double    | The current service level indicator (SLI) of the SLO, also known as 'status'. This is a percentage value from 0-100 (inclusive).                                                                                                               |
| status                     | span_precision              | int64     | The number of decimal places the SLI value is accurate to.                                                                                                                                                                                     |
| status                     | state                       | enum      | State of the SLO. Allowed enum values: `breached,warning,ok,no_data`                                                                                                                                                                           |
| attributes                 | team_tags                   | [string]  | Tags with the `team` tag key.                                                                                                                                                                                                                  |
| attributes                 | thresholds                  | [object]  | The thresholds (timeframes and associated targets) for this service level objective object.                                                                                                                                                    |
| thresholds                 | target [*required*]    | double    | The target value for the service level indicator within the corresponding timeframe.                                                                                                                                                           |
| thresholds                 | 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.                      |
| thresholds                 | timeframe [*required*] | enum      | The SLO time window options. Allowed enum values: `7d,30d,90d`                                                                                                                                                                                 |
| thresholds                 | warning                     | double    | The warning value for the service level objective.                                                                                                                                                                                             |
| thresholds                 | 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                       | id                          | string    | A unique identifier for the service level objective object.                                                                                                                                                                                    | Always included in service level objective responses.                                                         |
| data                       | type                        | string    | The type of the object, must be `slo`.                                                                                                                                                                                                         |
| data                       | type                        | string    | Type of service level objective result.                                                                                                                                                                                                        |
|                            | links                       | object    | Pagination links.                                                                                                                                                                                                                              |
| links                      | first                       | string    | Link to last page.                                                                                                                                                                                                                             |
| links                      | last                        | string    | Link to first page.                                                                                                                                                                                                                            |
| links                      | next                        | string    | Link to the next page.                                                                                                                                                                                                                         |
| links                      | prev                        | string    | Link to previous page.                                                                                                                                                                                                                         |
| links                      | self                        | string    | Link to current page.                                                                                                                                                                                                                          |
|                            | meta                        | object    | Searches metadata returned by the API.                                                                                                                                                                                                         |
| meta                       | pagination                  | object    | Pagination metadata returned by the API.                                                                                                                                                                                                       |
| pagination                 | first_number                | int64     | The first number.                                                                                                                                                                                                                              |
| pagination                 | last_number                 | int64     | The last number.                                                                                                                                                                                                                               |
| pagination                 | next_number                 | int64     | The next number.                                                                                                                                                                                                                               |
| pagination                 | number                      | int64     | The page number.                                                                                                                                                                                                                               |
| pagination                 | prev_number                 | int64     | The previous page number.                                                                                                                                                                                                                      |
| pagination                 | size                        | int64     | The size of the response.                                                                                                                                                                                                                      |
| pagination                 | total                       | int64     | The total number of SLOs in the response.                                                                                                                                                                                                      |
| pagination                 | type                        | string    | Type of pagination.                                                                                                                                                                                                                            |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "facets": {
        "all_tags": [
          {
            "count": "integer",
            "name": "string"
          }
        ],
        "creator_name": [
          {
            "count": "integer",
            "name": "string"
          }
        ],
        "env_tags": [
          {
            "count": "integer",
            "name": "string"
          }
        ],
        "service_tags": [
          {
            "count": "integer",
            "name": "string"
          }
        ],
        "slo_type": [
          {
            "count": "integer",
            "name": "number"
          }
        ],
        "target": [
          {
            "count": "integer",
            "name": "number"
          }
        ],
        "team_tags": [
          {
            "count": "integer",
            "name": "string"
          }
        ],
        "timeframe": [
          {
            "count": "integer",
            "name": "string"
          }
        ]
      },
      "slos": [
        {
          "data": {
            "attributes": {
              "all_tags": [
                "env:prod",
                "app:core"
              ],
              "created_at": "integer",
              "creator": {
                "email": "string",
                "id": "integer",
                "name": "string"
              },
              "description": "string",
              "env_tags": [],
              "groups": [
                "env:prod",
                "role:mysql"
              ],
              "modified_at": "integer",
              "monitor_ids": [],
              "name": "Custom Metric SLO",
              "overall_status": [
                {
                  "error": "string",
                  "error_budget_remaining": 100,
                  "indexed_at": 1662496260,
                  "raw_error_budget_remaining": {
                    "unit": "requests",
                    "value": 60
                  },
                  "span_precision": 2,
                  "state": "ok",
                  "status": 100,
                  "target": 99,
                  "timeframe": "30d"
                }
              ],
              "query": {
                "denominator": "sum:my.custom.metric{*}.as_count()",
                "metrics": [
                  "my.custom.metric",
                  "my.other.custom.metric"
                ],
                "numerator": "sum:my.custom.metric{type:good}.as_count()"
              },
              "service_tags": [],
              "slo_type": "metric",
              "status": {
                "calculation_error": "string",
                "error_budget_remaining": 100,
                "indexed_at": 1662496260,
                "raw_error_budget_remaining": {
                  "unit": "requests",
                  "value": 60
                },
                "sli": 100,
                "span_precision": 2,
                "state": "ok"
              },
              "team_tags": [],
              "thresholds": [
                {
                  "target": 99.9,
                  "target_display": "99.9",
                  "timeframe": "30d",
                  "warning": 90,
                  "warning_display": "90.0"
                }
              ]
            },
            "id": "string",
            "type": "string"
          }
        }
      ]
    },
    "type": ""
  },
  "links": {
    "first": "string",
    "last": "string",
    "next": "string",
    "prev": "string",
    "self": "string"
  },
  "meta": {
    "pagination": {
      "first_number": "integer",
      "last_number": "integer",
      "next_number": "integer",
      "number": "integer",
      "prev_number": "integer",
      "size": "integer",
      "total": "integer",
      "type": "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="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

##### 
                  \# Curl command curl -X GET "https://api.datadoghq.com/api/v1/slo/search" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Search for SLOs returns "OK" response
"""

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_NAME = environ["SLO_DATA_0_NAME"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ServiceLevelObjectivesApi(api_client)
    response = api_instance.search_slo(
        query=SLO_DATA_0_NAME,
        page_size=20,
        page_number=0,
    )

    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
# Search for SLOs returns "OK" response

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

# there is a valid "slo" in the system
SLO_DATA_0_NAME = ENV["SLO_DATA_0_NAME"]
opts = {
  query: SLO_DATA_0_NAME,
  page_size: 20,
  page_number: 0,
}
p api_instance.search_slo(opts)
```

#### 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"
##### 

```go
// Search for SLOs returns "OK" response

package main

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

	"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
	SloData0Name := os.Getenv("SLO_DATA_0_NAME")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewServiceLevelObjectivesApi(apiClient)
	resp, r, err := api.SearchSLO(ctx, *datadogV1.NewSearchSLOOptionalParameters().WithQuery(SloData0Name).WithPageSize(20).WithPageNumber(0))

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ServiceLevelObjectivesApi.SearchSLO`:\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
// Search for SLOs 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.api.ServiceLevelObjectivesApi.SearchSLOOptionalParameters;
import com.datadog.api.client.v1.model.SearchSLOResponse;

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_NAME = System.getenv("SLO_DATA_0_NAME");

    try {
      SearchSLOResponse result =
          apiInstance.searchSLO(
              new SearchSLOOptionalParameters()
                  .query(SLO_DATA_0_NAME)
                  .pageSize(20L)
                  .pageNumber(0L));
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ServiceLevelObjectivesApi#searchSLO");
      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"
##### 

```rust
// Search for SLOs returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_service_level_objectives::SearchSLOOptionalParams;
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_name = std::env::var("SLO_DATA_0_NAME").unwrap();
    let configuration = datadog::Configuration::new();
    let api = ServiceLevelObjectivesAPI::with_config(configuration);
    let resp = api
        .search_slo(
            SearchSLOOptionalParams::default()
                .query(slo_data_0_name.clone())
                .page_size(20)
                .page_number(0),
        )
        .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
/**
 * Search for SLOs 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_NAME = process.env.SLO_DATA_0_NAME as string;

const params: v1.ServiceLevelObjectivesApiSearchSLORequest = {
  query: SLO_DATA_0_NAME,
  pageSize: 20,
  pageNumber: 0,
};

apiInstance
  .searchSLO(params)
  .then((data: v1.SearchSLOResponse) => {
    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 %}
