Skip to main content
POST
/
v1
/
incidents
/
{incident_id}
/
alerts
Attach alerts to an incident
curl --request POST \
  --url https://api.rootly.com/v1/incidents/{incident_id}/alerts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/vnd.api+json' \
  --data '
{
  "data": {
    "type": "alerts",
    "attributes": {
      "alert_ids": [
        "<string>"
      ]
    }
  }
}
'
import requests

url = "https://api.rootly.com/v1/incidents/{incident_id}/alerts"

payload = { "data": {
"type": "alerts",
"attributes": { "alert_ids": ["<string>"] }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({data: {type: 'alerts', attributes: {alert_ids: ['<string>']}}})
};

fetch('https://api.rootly.com/v1/incidents/{incident_id}/alerts', 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.rootly.com/v1/incidents/{incident_id}/alerts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'type' => 'alerts',
'attributes' => [
'alert_ids' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+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.rootly.com/v1/incidents/{incident_id}/alerts"

payload := strings.NewReader("{\n \"data\": {\n \"type\": \"alerts\",\n \"attributes\": {\n \"alert_ids\": [\n \"<string>\"\n ]\n }\n }\n}")

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

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

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.rootly.com/v1/incidents/{incident_id}/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": {\n \"type\": \"alerts\",\n \"attributes\": {\n \"alert_ids\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.rootly.com/v1/incidents/{incident_id}/alerts")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/vnd.api+json'
request.body = "{\n \"data\": {\n \"type\": \"alerts\",\n \"attributes\": {\n \"alert_ids\": [\n \"<string>\"\n ]\n }\n }\n}"

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "id": "<string>",
      "type": "alerts",
      "attributes": {
        "short_id": "<string>",
        "source": "<string>",
        "summary": "<string>",
        "created_at": "<string>",
        "updated_at": "<string>",
        "description": "<string>",
        "services": [
          {
            "name": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "slug": "<string>",
            "description": "<string>",
            "public_description": "<string>",
            "notify_emails": [
              "<string>"
            ],
            "color": "<string>",
            "position": 123,
            "backstage_id": "<string>",
            "external_id": "<string>",
            "pagerduty_id": "<string>",
            "opsgenie_id": "<string>",
            "cortex_id": "<string>",
            "service_now_ci_sys_id": "<string>",
            "github_repository_name": "<string>",
            "github_repository_branch": "<string>",
            "gitlab_repository_name": "<string>",
            "gitlab_repository_branch": "<string>",
            "kubernetes_deployment_name": "<string>",
            "environment_ids": [
              "<string>"
            ],
            "service_ids": [
              "<string>"
            ],
            "owner_group_ids": [
              "<string>"
            ],
            "owner_user_ids": [
              123
            ],
            "alert_urgency_id": "<string>",
            "escalation_policy_id": "<string>",
            "alerts_email_enabled": true,
            "alerts_email_address": "<string>",
            "slack_channels": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "slack_aliases": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "alert_broadcast_enabled": true,
            "alert_broadcast_channel": {
              "id": "<string>",
              "name": "<string>"
            },
            "incident_broadcast_enabled": true,
            "incident_broadcast_channel": {
              "id": "<string>",
              "name": "<string>"
            },
            "properties": [
              {
                "catalog_property_id": "<string>",
                "value": "<string>"
              }
            ]
          }
        ],
        "groups": [
          {
            "name": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "slug": "<string>",
            "description": "<string>",
            "notify_emails": [
              "<string>"
            ],
            "color": "<string>",
            "position": 123,
            "backstage_id": "<string>",
            "external_id": "<string>",
            "pagerduty_id": "<string>",
            "pagerduty_service_id": "<string>",
            "opsgenie_id": "<string>",
            "victor_ops_id": "<string>",
            "pagertree_id": "<string>",
            "cortex_id": "<string>",
            "service_now_ci_sys_id": "<string>",
            "user_ids": [
              123
            ],
            "admin_ids": [
              123
            ],
            "alerts_email_enabled": true,
            "alerts_email_address": "<string>",
            "alert_urgency_id": "<string>",
            "slack_channels": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "slack_aliases": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "alert_broadcast_enabled": true,
            "alert_broadcast_channel": {
              "id": "<string>",
              "name": "<string>"
            },
            "incident_broadcast_enabled": true,
            "incident_broadcast_channel": {
              "id": "<string>",
              "name": "<string>"
            },
            "auto_add_members_when_attached": true,
            "properties": [
              {
                "catalog_property_id": "<string>",
                "value": "<string>"
              }
            ]
          }
        ],
        "functionalities": [
          {
            "name": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "slug": "<string>",
            "description": "<string>",
            "public_description": "<string>",
            "notify_emails": [
              "<string>"
            ],
            "color": "<string>",
            "backstage_id": "<string>",
            "external_id": "<string>",
            "pagerduty_id": "<string>",
            "opsgenie_id": "<string>",
            "opsgenie_team_id": "<string>",
            "cortex_id": "<string>",
            "service_now_ci_sys_id": "<string>",
            "position": 123,
            "environment_ids": [
              "<string>"
            ],
            "service_ids": [
              "<string>"
            ],
            "owner_group_ids": [
              "<string>"
            ],
            "owner_user_ids": [
              123
            ],
            "escalation_policy_id": "<string>",
            "slack_channels": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "slack_aliases": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "properties": [
              {
                "catalog_property_id": "<string>",
                "value": "<string>"
              }
            ]
          }
        ],
        "environments": [
          {
            "name": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "slug": "<string>",
            "description": "<string>",
            "notify_emails": [
              "<string>"
            ],
            "color": "<string>",
            "position": 123,
            "slack_channels": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "slack_aliases": [
              {
                "id": "<string>",
                "name": "<string>"
              }
            ],
            "properties": [
              {
                "catalog_property_id": "<string>",
                "value": "<string>"
              }
            ]
          }
        ],
        "service_ids": [
          "<string>"
        ],
        "group_ids": [
          "<string>"
        ],
        "functionality_ids": [
          "<string>"
        ],
        "environment_ids": [
          "<string>"
        ],
        "external_id": "<string>",
        "external_url": "<string>",
        "alert_urgency_id": "<string>",
        "alert_urgency": {
          "name": "<string>",
          "description": "<string>",
          "position": 123,
          "created_at": "<string>",
          "updated_at": "<string>",
          "id": "<string>",
          "urgency": "<string>",
          "color": "<string>",
          "team_id": 123,
          "deleted_at": "<string>"
        },
        "group_leader_alert_id": "<string>",
        "is_group_leader_alert": true,
        "labels": [
          {
            "key": "<string>",
            "value": "<string>"
          }
        ],
        "data": {},
        "notification_target_id": "<string>",
        "deduplication_key": "<string>",
        "alert_field_values": [
          {
            "id": "<string>",
            "value": "<string>",
            "alert_field_id": "<string>",
            "alert_id": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>"
          }
        ],
        "responders": [
          {
            "id": 123,
            "email": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "name": "<string>",
            "phone": "<string>",
            "phone_2": "<string>",
            "first_name": "<string>",
            "last_name": "<string>",
            "preferred_name": "<string>",
            "full_name": "<string>",
            "full_name_with_team": "<string>",
            "slack_id": "<string>",
            "time_zone": "<string>"
          }
        ],
        "notified_users": [
          {
            "email": "<string>",
            "created_at": "<string>",
            "updated_at": "<string>",
            "first_name": "<string>",
            "last_name": "<string>",
            "full_name": "<string>",
            "full_name_with_team": "<string>",
            "time_zone": "<string>"
          }
        ],
        "alerting_targets": [
          {
            "id": "<string>",
            "type": "<string>"
          }
        ],
        "url": "<string>",
        "started_at": "2023-11-07T05:31:56Z",
        "ended_at": "2023-11-07T05:31:56Z"
      },
      "source": "<string>"
    }
  ],
  "links": {
    "self": "<string>",
    "first": "<string>",
    "prev": "<string>",
    "next": "<string>",
    "last": "<string>"
  },
  "meta": {
    "current_page": 123,
    "next_page": 123,
    "prev_page": 123,
    "total_count": 123,
    "total_pages": 123,
    "next_cursor": "<string>"
  },
  "included": [
    {
      "id": "<string>",
      "type": "<string>",
      "attributes": {},
      "relationships": {}
    }
  ]
}
{
"errors": [
{
"title": "<string>",
"status": "<string>",
"code": "<string>",
"detail": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

incident_id
string
required

Body

application/vnd.api+json
data
object
required

Response

alert created

data
object[]
required
meta
object
required
included
object[]