Skip to content
POST/api/v1/monitoring/sla

Create an SLA target

Adds an SLA target. Requires name+modelOrEndpoint+metric+target; metric from a fixed enum. Optional operator/windowMinutes/severity. Returns 201.

Authentication

Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.

Request body required

Example

{
  "name": "string",
  "modelOrEndpoint": "string",
  "metric": "availability",
  "target": 0,
  "operator": "lte",
  "windowMinutes": 60,
  "severity": "warning"
}
Schema
{
  "application/json": {
    "schema": {
      "type": "object",
      "required": [
        "name",
        "modelOrEndpoint",
        "metric",
        "target"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "modelOrEndpoint": {
          "type": "string"
        },
        "metric": {
          "type": "string",
          "enum": [
            "availability",
            "latency_p95",
            "latency_p99",
            "error_rate",
            "throughput"
          ]
        },
        "target": {
          "type": "number"
        },
        "operator": {
          "type": "string",
          "enum": [
            "lte",
            "gte"
          ],
          "description": "Defaults to gte for availability/throughput, lte otherwise."
        },
        "windowMinutes": {
          "type": "number",
          "default": 60
        },
        "severity": {
          "type": "string",
          "enum": [
            "critical",
            "warning",
            "info"
          ],
          "default": "warning"
        }
      }
    }
  }
}

Response

201 example

{
  "success": true
}

All status codes

201Created.
400(no description)
401(no description)
429(no description)

Code samples

cURL

curl -X POST \
  https://evalguard.ai/api/v1/monitoring/sla \
  -H "Authorization: Bearer $EVALGUARD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "string", "modelOrEndpoint": "string", "metric": "availability", "target": 0, "operator": "lte", "windowMinutes": 60, "severity": "warning" }'

TypeScript

import { EvalGuard } from "@evalguard/sdk";

const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });

const response = await client.request({
  method: "POST",
  path: "/api/v1/monitoring/sla",
  body: {
    "name": "string",
    "modelOrEndpoint": "string",
    "metric": "availability",
    "target": 0,
    "operator": "lte",
    "windowMinutes": 60,
    "severity": "warning"
  },
});
console.log(response);

Python

from evalguard import EvalGuard
import os

client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])

response = client.request(
    method="POST",
    path="/api/v1/monitoring/sla",
    body={
    "name": "string",
    "modelOrEndpoint": "string",
    "metric": "availability",
    "target": 0,
    "operator": "lte",
    "windowMinutes": 60,
    "severity": "warning"
},
)
print(response)

Go

package main

import (
	"context"
	"fmt"
	"net/http"
	"os"
	"strings"
)

func main() {
	body := strings.NewReader(`{"name":"string","modelOrEndpoint":"string","metric":"availability","target":0,"operator":"lte","windowMinutes":60,"severity":"warning"}`)
	req, _ := http.NewRequestWithContext(context.Background(), "POST", "https://evalguard.ai/api/v1/monitoring/sla", body)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("EVALGUARD_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	fmt.Println(resp.Status)
}

Errors

400401429

Other Monitoring endpoints