Create an alert
curl --request POST \
--url https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"projections": [
"<string>"
],
"notification_details": {
"critical": {
"metadata": {},
"user_ids": [
"<string>"
]
},
"resolved": {
"metadata": {},
"user_ids": [
"<string>"
]
}
},
"description": "<string>",
"minimum_sample_size": 0,
"alert_type": "AGGREGATE",
"aggregation": "AVERAGE"
}
'import requests
url = "https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts"
payload = {
"name": "<string>",
"thresholds": {
"critical": { "value": 123 },
"resolved": { "value": 123 }
},
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"projections": ["<string>"],
"notification_details": {
"critical": {
"metadata": {},
"user_ids": ["<string>"]
},
"resolved": {
"metadata": {},
"user_ids": ["<string>"]
}
},
"description": "<string>",
"minimum_sample_size": 0,
"alert_type": "AGGREGATE",
"aggregation": "AVERAGE"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
thresholds: {critical: {value: 123}, resolved: {value: 123}},
filters: [{field: '<string>', value: '<string>'}],
projections: ['<string>'],
notification_details: {
critical: {metadata: {}, user_ids: ['<string>']},
resolved: {metadata: {}, user_ids: ['<string>']}
},
description: '<string>',
minimum_sample_size: 0,
alert_type: 'AGGREGATE',
aggregation: 'AVERAGE'
})
};
fetch('https://api.cp.us.honeyhive.ai/v1/projects/{project_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.cp.us.honeyhive.ai/v1/projects/{project_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([
'name' => '<string>',
'thresholds' => [
'critical' => [
'value' => 123
],
'resolved' => [
'value' => 123
]
],
'filters' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'projections' => [
'<string>'
],
'notification_details' => [
'critical' => [
'metadata' => [
],
'user_ids' => [
'<string>'
]
],
'resolved' => [
'metadata' => [
],
'user_ids' => [
'<string>'
]
]
],
'description' => '<string>',
'minimum_sample_size' => 0,
'alert_type' => 'AGGREGATE',
'aggregation' => 'AVERAGE'
]),
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.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cp.us.honeyhive.ai/v1/projects/{project_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/json'
request.body = "{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"minimum_sample_size": 123,
"aggregation": "<string>",
"event_filters": [
{
"filter": {
"field": "<string>",
"value": "<string>"
}
}
],
"event_metrics": [
{
"projection": "<string>"
}
],
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"is_active": true,
"is_muted": true,
"created_at": "2023-11-07T05:31:56Z",
"scope_type": "<string>",
"scope_id": "<string>",
"description": "<string>",
"last_run_at": "2023-11-07T05:31:56Z",
"last_result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"trigger_error": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"last_trigger_id": "<string>",
"created_by": "<string>",
"last_trigger": {
"id": "<string>",
"alert_id": "<string>",
"result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"muted": true,
"notification_sent": true,
"triggered_time": "2023-11-07T05:31:56Z",
"resolved_time": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"triggers": [
{
"id": "<string>",
"alert_id": "<string>",
"result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"muted": true,
"notification_sent": true,
"triggered_time": "2023-11-07T05:31:56Z",
"resolved_time": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"notifications": [
{
"id": "<string>",
"alert_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"membership_id": "<string>",
"metadata": {},
"last_sent_at": "2023-11-07T05:31:56Z",
"membership": {
"user": {
"id": "<string>"
}
}
}
]
}
}Alerts
Create an alert
Create an alert in a project. The project is identified by the project_id path parameter
alone; the x-hh-project-id header does not participate. The alert’s filters and
projections (metrics) are mapped against the project’s logged-event schema; if no schema
data matches them — e.g. no events have been logged to the project yet — the request fails
with a 400.
POST
/
v1
/
projects
/
{project_id}
/
alerts
Create an alert
curl --request POST \
--url https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"projections": [
"<string>"
],
"notification_details": {
"critical": {
"metadata": {},
"user_ids": [
"<string>"
]
},
"resolved": {
"metadata": {},
"user_ids": [
"<string>"
]
}
},
"description": "<string>",
"minimum_sample_size": 0,
"alert_type": "AGGREGATE",
"aggregation": "AVERAGE"
}
'import requests
url = "https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts"
payload = {
"name": "<string>",
"thresholds": {
"critical": { "value": 123 },
"resolved": { "value": 123 }
},
"filters": [
{
"field": "<string>",
"value": "<string>"
}
],
"projections": ["<string>"],
"notification_details": {
"critical": {
"metadata": {},
"user_ids": ["<string>"]
},
"resolved": {
"metadata": {},
"user_ids": ["<string>"]
}
},
"description": "<string>",
"minimum_sample_size": 0,
"alert_type": "AGGREGATE",
"aggregation": "AVERAGE"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
thresholds: {critical: {value: 123}, resolved: {value: 123}},
filters: [{field: '<string>', value: '<string>'}],
projections: ['<string>'],
notification_details: {
critical: {metadata: {}, user_ids: ['<string>']},
resolved: {metadata: {}, user_ids: ['<string>']}
},
description: '<string>',
minimum_sample_size: 0,
alert_type: 'AGGREGATE',
aggregation: 'AVERAGE'
})
};
fetch('https://api.cp.us.honeyhive.ai/v1/projects/{project_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.cp.us.honeyhive.ai/v1/projects/{project_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([
'name' => '<string>',
'thresholds' => [
'critical' => [
'value' => 123
],
'resolved' => [
'value' => 123
]
],
'filters' => [
[
'field' => '<string>',
'value' => '<string>'
]
],
'projections' => [
'<string>'
],
'notification_details' => [
'critical' => [
'metadata' => [
],
'user_ids' => [
'<string>'
]
],
'resolved' => [
'metadata' => [
],
'user_ids' => [
'<string>'
]
]
],
'description' => '<string>',
'minimum_sample_size' => 0,
'alert_type' => 'AGGREGATE',
'aggregation' => 'AVERAGE'
]),
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.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.cp.us.honeyhive.ai/v1/projects/{project_id}/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cp.us.honeyhive.ai/v1/projects/{project_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/json'
request.body = "{\n \"name\": \"<string>\",\n \"thresholds\": {\n \"critical\": {\n \"value\": 123\n },\n \"resolved\": {\n \"value\": 123\n }\n },\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\"\n }\n ],\n \"projections\": [\n \"<string>\"\n ],\n \"notification_details\": {\n \"critical\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n },\n \"resolved\": {\n \"metadata\": {},\n \"user_ids\": [\n \"<string>\"\n ]\n }\n },\n \"description\": \"<string>\",\n \"minimum_sample_size\": 0,\n \"alert_type\": \"AGGREGATE\",\n \"aggregation\": \"AVERAGE\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"name": "<string>",
"minimum_sample_size": 123,
"aggregation": "<string>",
"event_filters": [
{
"filter": {
"field": "<string>",
"value": "<string>"
}
}
],
"event_metrics": [
{
"projection": "<string>"
}
],
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"is_active": true,
"is_muted": true,
"created_at": "2023-11-07T05:31:56Z",
"scope_type": "<string>",
"scope_id": "<string>",
"description": "<string>",
"last_run_at": "2023-11-07T05:31:56Z",
"last_result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"trigger_error": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"last_trigger_id": "<string>",
"created_by": "<string>",
"last_trigger": {
"id": "<string>",
"alert_id": "<string>",
"result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"muted": true,
"notification_sent": true,
"triggered_time": "2023-11-07T05:31:56Z",
"resolved_time": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"triggers": [
{
"id": "<string>",
"alert_id": "<string>",
"result": {
"current_bucket_score": 123,
"previous_bucket_score": 123,
"last_triggered_baseline": 123,
"drift_percentage": 123,
"thresholds": {
"critical": {
"value": 123
},
"resolved": {
"value": 123
}
},
"event_filters": [
"<unknown>"
],
"event_metrics": [
"<unknown>"
],
"aggregation": "<string>"
},
"muted": true,
"notification_sent": true,
"triggered_time": "2023-11-07T05:31:56Z",
"resolved_time": "2023-11-07T05:31:56Z",
"resolved_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"notifications": [
{
"id": "<string>",
"alert_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"membership_id": "<string>",
"metadata": {},
"last_sent_at": "2023-11-07T05:31:56Z",
"membership": {
"user": {
"id": "<string>"
}
}
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the project the alert is created in
Body
application/json
Minimum string length:
1Available options:
HOURLY, DAILY, WEEKLY, MONTHLY Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
DRIFT, AGGREGATE, PER_EVENT Available options:
AVERAGE, COUNT, SUM, MIN, MAX, P90, P95, P99, MEDIAN Available options:
ACTIVE, TRIGGERED, PAUSED, RESOLVED Was this page helpful?
⌘I

