Create a custom monitor (THRESHOLD / CHANGE / OUTLIER)
curl --request POST \
--url https://api.dev.swarmd.ai/audit/v1/monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"owner": "<string>",
"enabled": true,
"messageTemplate": "<string>",
"queryConfig": {
"type": "<string>",
"filters": [
{
"values": [
"<string>"
]
}
],
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"channelIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"debounceSeconds": 123
}
'import requests
url = "https://api.dev.swarmd.ai/audit/v1/monitors"
payload = {
"name": "<string>",
"description": "<string>",
"tags": ["<string>"],
"owner": "<string>",
"enabled": True,
"messageTemplate": "<string>",
"queryConfig": {
"type": "<string>",
"filters": [{ "values": ["<string>"] }],
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"channelIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"debounceSeconds": 123
}
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>',
description: '<string>',
tags: ['<string>'],
owner: '<string>',
enabled: true,
messageTemplate: '<string>',
queryConfig: {
type: '<string>',
filters: [{values: ['<string>']}],
warningPercentChange: 123,
criticalPercentChange: 123
},
channelIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
debounceSeconds: 123
})
};
fetch('https://api.dev.swarmd.ai/audit/v1/monitors', 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.dev.swarmd.ai/audit/v1/monitors",
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>',
'description' => '<string>',
'tags' => [
'<string>'
],
'owner' => '<string>',
'enabled' => true,
'messageTemplate' => '<string>',
'queryConfig' => [
'type' => '<string>',
'filters' => [
[
'values' => [
'<string>'
]
]
],
'warningPercentChange' => 123,
'criticalPercentChange' => 123
],
'channelIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'debounceSeconds' => 123
]),
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.dev.swarmd.ai/audit/v1/monitors"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\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.dev.swarmd.ai/audit/v1/monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dev.swarmd.ai/audit/v1/monitors")
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 \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorType": "SYSTEM_TEMPLATE",
"templateId": "POLICY_INVOCATION_ANOMALY",
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"owner": "<string>",
"ownerLabel": "<string>",
"priority": "P1",
"sensitivity": "LOW",
"enabled": true,
"state": "OK",
"coverageStatus": "HEALTHY",
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"messageTemplate": "<string>",
"runbookSlug": "<string>",
"category": "BEHAVIORAL",
"queryConfig": {
"type": "<string>",
"metric": "REQUESTS",
"aggregation": "SUM",
"window": "LAST_5M",
"groupBy": "NONE",
"filters": [
{
"dimension": "AGENT",
"operator": "IN",
"values": [
"<string>"
]
}
],
"direction": "SPIKE",
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currentMute": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mutedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mutedByLabel": "<string>",
"mutedAt": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"scheduledDowntimes": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdByLabel": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"cancelledAt": "2023-11-07T05:31:56Z",
"cancelledBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"latestRevisionVersion": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastAlertAt": "2023-11-07T05:31:56Z",
"alertCount24h": 123,
"channelIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"debounceSeconds": 123
}Audit Monitors
Create a custom monitor (THRESHOLD / CHANGE / OUTLIER)
Security Requirements
| Auth Types | Entities | Permissions | Required Roles |
|---|---|---|---|
| USER | AUDIT | WRITE | AUDIT:WRITE |
POST
/
audit
/
v1
/
monitors
Create a custom monitor (THRESHOLD / CHANGE / OUTLIER)
curl --request POST \
--url https://api.dev.swarmd.ai/audit/v1/monitors \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"owner": "<string>",
"enabled": true,
"messageTemplate": "<string>",
"queryConfig": {
"type": "<string>",
"filters": [
{
"values": [
"<string>"
]
}
],
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"channelIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"debounceSeconds": 123
}
'import requests
url = "https://api.dev.swarmd.ai/audit/v1/monitors"
payload = {
"name": "<string>",
"description": "<string>",
"tags": ["<string>"],
"owner": "<string>",
"enabled": True,
"messageTemplate": "<string>",
"queryConfig": {
"type": "<string>",
"filters": [{ "values": ["<string>"] }],
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"channelIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"debounceSeconds": 123
}
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>',
description: '<string>',
tags: ['<string>'],
owner: '<string>',
enabled: true,
messageTemplate: '<string>',
queryConfig: {
type: '<string>',
filters: [{values: ['<string>']}],
warningPercentChange: 123,
criticalPercentChange: 123
},
channelIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
debounceSeconds: 123
})
};
fetch('https://api.dev.swarmd.ai/audit/v1/monitors', 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.dev.swarmd.ai/audit/v1/monitors",
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>',
'description' => '<string>',
'tags' => [
'<string>'
],
'owner' => '<string>',
'enabled' => true,
'messageTemplate' => '<string>',
'queryConfig' => [
'type' => '<string>',
'filters' => [
[
'values' => [
'<string>'
]
]
],
'warningPercentChange' => 123,
'criticalPercentChange' => 123
],
'channelIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'debounceSeconds' => 123
]),
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.dev.swarmd.ai/audit/v1/monitors"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\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.dev.swarmd.ai/audit/v1/monitors")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dev.swarmd.ai/audit/v1/monitors")
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 \"description\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"owner\": \"<string>\",\n \"enabled\": true,\n \"messageTemplate\": \"<string>\",\n \"queryConfig\": {\n \"type\": \"<string>\",\n \"filters\": [\n {\n \"values\": [\n \"<string>\"\n ]\n }\n ],\n \"warningPercentChange\": 123,\n \"criticalPercentChange\": 123\n },\n \"channelIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"debounceSeconds\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorType": "SYSTEM_TEMPLATE",
"templateId": "POLICY_INVOCATION_ANOMALY",
"name": "<string>",
"description": "<string>",
"tags": [
"<string>"
],
"owner": "<string>",
"ownerLabel": "<string>",
"priority": "P1",
"sensitivity": "LOW",
"enabled": true,
"state": "OK",
"coverageStatus": "HEALTHY",
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"messageTemplate": "<string>",
"runbookSlug": "<string>",
"category": "BEHAVIORAL",
"queryConfig": {
"type": "<string>",
"metric": "REQUESTS",
"aggregation": "SUM",
"window": "LAST_5M",
"groupBy": "NONE",
"filters": [
{
"dimension": "AGENT",
"operator": "IN",
"values": [
"<string>"
]
}
],
"direction": "SPIKE",
"warningPercentChange": 123,
"criticalPercentChange": 123
},
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currentMute": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mutedBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"mutedByLabel": "<string>",
"mutedAt": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"scheduledDowntimes": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdByLabel": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z",
"reason": "<string>",
"cancelledAt": "2023-11-07T05:31:56Z",
"cancelledBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"latestRevisionVersion": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lastAlertAt": "2023-11-07T05:31:56Z",
"alertCount24h": 123,
"channelIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"debounceSeconds": 123
}Authorizations
JWT token (USER, AGENT, or SERVICE auth)
Body
application/json
Available options:
SYSTEM_TEMPLATE, THRESHOLD, CHANGE, OUTLIER Available options:
P1, P2, P3, P4, P5 Available options:
LOW, MEDIUM, HIGH - Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Response
200 - */*
OK
Available options:
SYSTEM_TEMPLATE, THRESHOLD, CHANGE, OUTLIER Available options:
POLICY_INVOCATION_ANOMALY, POLICY_BLOCK_ANOMALY, POLICY_WARN_ANOMALY, POLICY_HITL_HOLD_ANOMALY, AGENT_VOLUME_ANOMALY, USER_VOLUME_ANOMALY, MCP_SERVER_VOLUME_ANOMALY, LLM_GATEWAY_VOLUME_ANOMALY, CHANNEL_VOLUME_ANOMALY, TENANT_ERROR_SPIKE, TENANT_WARN_SPIKE, TENANT_HITL_SPIKE, LLM_PROVIDER_ERROR_RATE_SPIKE, LLM_GATEWAY_FAILOVER_SPIKE, MCP_SERVER_ERROR_RATE_SPIKE, DORMANT_AGENT_REACTIVATION, DORMANT_USER_REACTIVATION, NOVEL_TOOL_CALL, NEW_MCP_SERVER_BINDING Available options:
P1, P2, P3, P4, P5 Available options:
LOW, MEDIUM, HIGH Available options:
OK, ALERT, WARN, NO_DATA, MUTED Available options:
HEALTHY, FAILED, STALE, NEVER_RUN, DISABLED, RUNNING Available options:
BEHAVIORAL, STATISTICAL, INFRA - Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
