Skip to main content
POST
/
api
/
agents
/
triggers
/
create-alert
cURL
curl -X POST "https://app.cotool.ai/api/agents/triggers/create-alert" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agentIds":["string"],"createAlert":true}'
import requests

url = "https://app.cotool.ai/api/agents/triggers/create-alert"

payload = {
"agentIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"createAlert": True
}
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({agentIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'], createAlert: true})
};

fetch('https://app.cotool.ai/api/agents/triggers/create-alert', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
HttpResponse<String> response = Unirest.post("https://app.cotool.ai/api/agents/triggers/create-alert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"createAlert\": true\n}")
.asString();
package main

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

func main() {

url := "https://app.cotool.ai/api/agents/triggers/create-alert"

payload := strings.NewReader("{\n \"agentIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"createAlert\": true\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))

}
{
  "updatedAgentIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "updatedTriggerCount": 1,
  "agentsWithoutTriggers": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ]
}
{
"error": "<string>",
"issues": [
{}
]
}
{
"error": "<string>"
}
{
"error": "<string>",
"missingPerms": [
"<string>"
]
}
{
"error": "<string>"
}

Authorizations

Authorization
string
header
required

API Key authentication for programmatic access. Include your API key in the Authorization header as: Bearer your_api_key_here

Body

application/json
agentIds
string<uuid>[]
required

Agents whose triggers should have alert creation toggled

Required array length: 1 - 200 elements
createAlert
boolean
required

Whether the triggers should create alerts when they fire

Response

Successful response

updatedAgentIds
string<uuid>[]
required

Agents that had at least one trigger updated

updatedTriggerCount
integer
required

Total number of triggers whose alert-creation setting changed

Required range: x >= 0
agentsWithoutTriggers
string<uuid>[]
required

Supplied agents that had no triggers to update