---
title: "Provision SLO resources using the HTTP API | Grafana Cloud documentation"
description: "Get started with and use the SLO API to create, manage, and maintain your SLOs."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Provision SLO resources using the HTTP API

Get started with and use the SLO API to create, manage, and maintain your SLOs.

To use the SLO API, complete the following steps.

1. Create a [Grafana service account token](/docs/grafana-cloud/security-and-account-management/authentication-and-permissions/service-accounts/) with Editor permissions.
2. Using any HTTP client like `curl` or HTTPie, make calls to the plugin’s resource API.
   
   - Make your API calls to the SLO resource API: `{stackURL}/api/plugins/grafana-slo-app/resources/v1/slo`
   - Use “Authorization: Bearer $APITOKEN” and “Accept application/json” as request headers.
   - The plugin uses GET to list all SLOs or read a specific one.
   - DELETE to delete an individual SLO.
   - POST to create an SLO.
   - PUT to update an SLO.
3. For a full definition of the API, download [this OpenAPIv3 specification.](./slo-api.yaml)

Here is an example request body to create an SLO. It runs the SLI query against the `prod-prometheus` data source and stores the generated recording rules in `grafanacloud-prom`.

`sourceDatasourceUid` is optional and is set inside the query block. It is supported on the `ratio` and `freeform` query types. When it is omitted, the SLI query runs against `destinationDatasource.uid`.

On stacks using legacy data source-managed recording rules, `sourceDatasourceUid` must be omitted or match `destinationDatasource.uid`.

The optional top-level `searchExpression` field holds a Knowledge Graph search expression, which scopes the SLO to a set of entities. Setting it adds an **Open RCA workbench** link to the SLO in Grafana, and a `workbench_troubleshoot_url` annotation to the generated burn-rate alert rules. Refer to [link the SLO to RCA workbench entities](/docs/grafana-cloud/alerting-and-irm/slo/create/#link-the-slo-to-rca-workbench-entities).

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "name": "HTTP Requests Kubelet Success Indicator",
  "description": "99.5% of Kubelet HTTP Requests are not 5xx errors",
  "destinationDatasource": {
    "uid": "grafanacloud-prom"
  },
  "objectives": [
    {
      "value": 0.995,
      "window": "28d"
    }
  ],
  "searchExpression": "kubelet connected services",
  "query": {
    "type": "ratio",
    "ratio": {
      "sourceDatasourceUid": "prod-prometheus",
      "successMetric": {
        "prometheusMetric": "kubelet_http_requests_total{status!~\"5..\"}"
      },
      "totalMetric": {
        "prometheusMetric": "kubelet_http_requests_total"
      },
      "groupByLabels": [
        "instance",
        "job"
      ]
    }
  },
  "alerting": {
    "fastBurn": {
      "annotations": [
        {
          "key": "name",
          "value": "SLO Burn Rate Very High"
        },
        {
          "key": "description",
          "value": "Error budget is burning too fast."
        }
      ]
    },
    "slowBurn": {
      "annotations": [
        {
          "key": "name",
          "value": "SLO Burn Rate High"
        },
        {
          "key": "description",
          "value": "Error budget is burning too fast."
        }
      ]
    }
  }
}
```
