Skip to main content
SLO & Service Quality/SLO
POSTSLOSince 1.0SynchronousAuth Required

CreateSLI

Create a new SLI definition with metric type and PromQL queries.

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • nameStringRequired

    Human-readable name for the new SLI.

    Example: api-availability

  • descriptionStringRequired

    Detailed description of what this SLI measures.

    Example: HTTP success rate for the public API

  • metricTypeStringRequired

    Metric category: availability | latency | throughput | error_rate.

    Example: availability

  • goodEventsQueryStringRequired

    PromQL query that counts good (successful) events.

    Example: sum(rate(http_requests_total{status=~"2.."}[5m]))

  • totalEventsQueryStringRequired

    PromQL query that counts all events (the denominator).

    Example: sum(rate(http_requests_total[5m]))

Responses

200 OK

On success, this API returns the following response structure.

  • idString

    Unique identifier of the SLI definition.

    Example: sli-abc123

  • nameString

    Human-readable name of the SLI.

    Example: api-availability

  • descriptionString

    Detailed description of what this SLI measures.

    Example: Ratio of successful HTTP requests to total requests

  • metricTypeString

    Metric category: availability | latency | throughput | error_rate.

    Example: availability

  • goodEventsQueryString

    PromQL expression counting good (successful) events.

    Example: sum(rate(http_requests_total{status=~"2.."}[5m]))

  • totalEventsQueryString

    PromQL expression counting all events (denominator).

    Example: sum(rate(http_requests_total[5m]))

  • unitString

    Unit of the measured metric (e.g., requests, ms).

    Example: requests

  • sourceProductString

    Product or service that owns this SLI.

    Example: zcf-api

  • createdAtString

    Timestamp when this SLI definition was created.

    Example: 2026-01-15T08:00:00Z

Endpoint

POST/api/v1/slo/slis

/api/v1/slo/slis

Operation ID

CreateSLI

Permalink

Request Example

curl -X POST '{host}/api/v1/slo/slis' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"name":"api-availability","description":"HTTP success rate for the public API","metricType":"availability","goodEventsQuery":"sum(rate(http_requests_total{status=~\"2..\"}[5m]))","totalEventsQuery":"sum(rate(http_requests_total[5m]))","unit":"requests","sourceProduct":"zcf-api"}'

Response Example

200
{
  "id": "sli-abc123",
  "name": "api-availability",
  "description": "Ratio of successful HTTP requests to total requests",
  "metricType": "availability",
  "goodEventsQuery": "sum(rate(http_requests_total{status=~\"2..\"}[5m]))",
  "totalEventsQuery": "sum(rate(http_requests_total[5m]))",
  "unit": "requests",
  "sourceProduct": "zcf-api"
}

Change History

This API has no change history records yet.

View all change history