Skip to content
  • There are no suggestions because the search field is empty.

Make your first request

Call the AlertOps API in cURL, Python, Node.js, Ruby or Go.

This example lists the users in your account with the V2 API. Replace <YOUR_API_KEY> with your key from User Profile.

cURL

curl -X GET "https://api.alertops.com/api/v2/users" \
  -H "api-key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json"

Python

import requests

url = "https://api.alertops.com/api/v2/users"
headers = {
    "api-key": "<YOUR_API_KEY>",
    "Content-Type": "application/json",
}

response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())

Node.js

const response = await fetch("https://api.alertops.com/api/v2/users", {
  method: "GET",
  headers: {
    "api-key": "<YOUR_API_KEY>",
    "Content-Type": "application/json",
  },
});

console.log(response.status);
console.log(await response.json());

Ruby

require "uri"
require "net/http"

url = URI("https://api.alertops.com/api/v2/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["api-key"] = "<YOUR_API_KEY>"
request["Content-Type"] = "application/json"

response = http.request(request)
puts response.body

Go

package main

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

func main() {
	req, err := http.NewRequest("GET", "https://api.alertops.com/api/v2/users", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Add("api-key", "<YOUR_API_KEY>")
	req.Header.Add("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	body, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(body))
}

Next: create an alert

Send a POST to /api/v2/alerts to open an alert without a monitoring tool. is_incident is required. See Create an alert for every field.

curl -X POST "https://api.alertops.com/api/v2/alerts" \
  -H "api-key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"escalation_policy":"<policy name>","subject":"Database CPU above 95%","description":"db-orders-01 CPU 97% for 10 minutes","priority":"High","is_incident":false}'