Skip to main content
PUT
/
alert-rules
/
{alertRuleId}
Update alert rule
curl --request PUT \
  --url https://api.qovery.com/alert-rules/{alertRuleId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "tag": "<string>",
  "condition": {
    "promql": "<string>",
    "threshold": 123
  },
  "for_duration": "<string>",
  "enabled": true,
  "alert_receiver_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "presentation": {
    "summary": "<string>",
    "runbook_url": "<string>"
  }
}
'
import requests

url = "https://api.qovery.com/alert-rules/{alertRuleId}"

payload = {
    "name": "<string>",
    "description": "<string>",
    "tag": "<string>",
    "condition": {
        "promql": "<string>",
        "threshold": 123
    },
    "for_duration": "<string>",
    "enabled": True,
    "alert_receiver_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
    "presentation": {
        "summary": "<string>",
        "runbook_url": "<string>"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    description: '<string>',
    tag: '<string>',
    condition: {promql: '<string>', threshold: 123},
    for_duration: '<string>',
    enabled: true,
    alert_receiver_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
    presentation: {summary: '<string>', runbook_url: '<string>'}
  })
};

fetch('https://api.qovery.com/alert-rules/{alertRuleId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.qovery.com/alert-rules/{alertRuleId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'name' => '<string>',
    'description' => '<string>',
    'tag' => '<string>',
    'condition' => [
        'promql' => '<string>',
        'threshold' => 123
    ],
    'for_duration' => '<string>',
    'enabled' => true,
    'alert_receiver_ids' => [
        '3c90c3cc-0d44-4b50-8888-8dd25736052a'
    ],
    'presentation' => [
        'summary' => '<string>',
        'runbook_url' => '<string>'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.qovery.com/alert-rules/{alertRuleId}"

	payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"description\": \"<string>\",\n  \"tag\": \"<string>\",\n  \"condition\": {\n    \"promql\": \"<string>\",\n    \"threshold\": 123\n  },\n  \"for_duration\": \"<string>\",\n  \"enabled\": true,\n  \"alert_receiver_ids\": [\n    \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n  ],\n  \"presentation\": {\n    \"summary\": \"<string>\",\n    \"runbook_url\": \"<string>\"\n  }\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.qovery.com/alert-rules/{alertRuleId}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"<string>\",\n  \"description\": \"<string>\",\n  \"tag\": \"<string>\",\n  \"condition\": {\n    \"promql\": \"<string>\",\n    \"threshold\": 123\n  },\n  \"for_duration\": \"<string>\",\n  \"enabled\": true,\n  \"alert_receiver_ids\": [\n    \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n  ],\n  \"presentation\": {\n    \"summary\": \"<string>\",\n    \"runbook_url\": \"<string>\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.qovery.com/alert-rules/{alertRuleId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"<string>\",\n  \"description\": \"<string>\",\n  \"tag\": \"<string>\",\n  \"condition\": {\n    \"promql\": \"<string>\",\n    \"threshold\": 123\n  },\n  \"for_duration\": \"<string>\",\n  \"enabled\": true,\n  \"alert_receiver_ids\": [\n    \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n  ],\n  \"presentation\": {\n    \"summary\": \"<string>\",\n    \"runbook_url\": \"<string>\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "description": "<string>",
  "tag": "<string>",
  "condition": {
    "promql": "<string>",
    "threshold": 123
  },
  "for_duration": "<string>",
  "enabled": true,
  "alert_receiver_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "presentation": {
    "summary": "<string>",
    "runbook_url": "<string>"
  },
  "target": {
    "target_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "service": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "name": "<string>",
      "description": "<string>",
      "icon_uri": "<string>",
      "project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "project_name": "<string>",
      "environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "environment_name": "<string>",
      "cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  },
  "is_up_to_date": true,
  "updated_at": "2023-11-07T05:31:56Z",
  "starts_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

JWT tokens should be used with OIDC account (human to machine). JWT tokens used by the Qovery console to communicate with the API have a TTL. Curl Example ' curl https://console.qovery.com/organization -H "Authorization: Bearer $qovery_token" '

Path Parameters

alertRuleId
string<uuid>
required

Alert Rule ID

Body

application/json
name
string
required

Name of the alert rule

description
string
required

Description of what the alert monitors

tag
string
required
condition
AlertRuleCondition · object
required
for_duration
string<duration>
required

Duration the condition must be true before firing (ISO-8601 duration format)

severity
enum<string>
required

Alert severity level: - LOW: Minor issues or informational alerts that don't require immediate attention. Can be addressed during normal business hours. - MEDIUM: Moderate issues that should be investigated soon but don't impact critical services. May cause degraded performance or minor service disruption. - HIGH: Serious issues affecting service quality or availability. Requires prompt attention and resolution within hours. - CRITICAL: Critical issue requiring immediate action. Service outage, data loss risk, or severe performance degradation affecting users.

Available options:
LOW,
MEDIUM,
HIGH,
CRITICAL
enabled
boolean
required

Whether the alert rule is enabled

alert_receiver_ids
string<uuid>[]
required

List of alert receiver IDs to send notifications to

Minimum array length: 1
presentation
AlertPresentation · object
required

Response

OK

Base schema for alert rule responses with discriminator

id
string<uuid>
required
read-only
created_at
string<date-time>
required
read-only
source
enum<string>
required

Source of the alert rule:

  • MANAGED: Alert rule created and managed through the Qovery API
  • GHOST: Alert rule that exists in Prometheus but has been deleted from the database
Available options:
MANAGED,
GHOST
name
string
required

Name of the alert rule

state
enum<string>
required
Available options:
UNDEPLOYED,
OK,
TRIGGERED,
PENDING_NOTIFICATION,
NOTIFIED,
SUPPRESSED,
UNROUTED
organization_id
string<uuid>
required

Organization identifier

cluster_id
string<uuid>
required

Cluster identifier

description
string
required

Description of what the alert monitors

tag
string
required
condition
AlertRuleCondition · object
required
for_duration
string<duration>
required

Duration the condition must be true before firing (ISO-8601 duration format)

severity
enum<string>
required

Alert severity level: - LOW: Minor issues or informational alerts that don't require immediate attention. Can be addressed during normal business hours. - MEDIUM: Moderate issues that should be investigated soon but don't impact critical services. May cause degraded performance or minor service disruption. - HIGH: Serious issues affecting service quality or availability. Requires prompt attention and resolution within hours. - CRITICAL: Critical issue requiring immediate action. Service outage, data loss risk, or severe performance degradation affecting users.

Available options:
LOW,
MEDIUM,
HIGH,
CRITICAL
enabled
boolean
required

Whether the alert rule is enabled

alert_receiver_ids
string<uuid>[]
required

List of alert receiver IDs to send notifications to

presentation
AlertPresentationResponse · object
required
target
AlertTarget · object
required
is_up_to_date
boolean
required

Indicates whether the current version of the alert has been synced with the alerting system. If false, an outdated version is currently deployed.

updated_at
string<date-time>
read-only
starts_at
string<date-time>

when the alert starts firing