Skip to main content
POST
/
v1
/
alerts
Create Alert
curl --request POST \
  --url https://api.mixpeek.com/v1/alerts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "notification_config": {
    "channels": [
      {
        "channel_type": "<string>",
        "channel_id": "wh_safety_team",
        "config": {
          "url": "https://example.com/webhook"
        }
      }
    ],
    "include_matches": true,
    "include_scores": true,
    "template_id": "<string>"
  },
  "description": "Alerts when new videos match known safety incidents",
  "source": "retriever",
  "retriever_id": "ret_safety_search",
  "trigger_on": "results",
  "system_condition": {
    "params": {}
  },
  "namespace_selector": {
    "mode": "all",
    "namespace_ids": [
      "<string>"
    ]
  },
  "enabled": true,
  "metadata": {}
}
'
import requests

url = "https://api.mixpeek.com/v1/alerts"

payload = {
"name": "<string>",
"notification_config": {
"channels": [
{
"channel_type": "<string>",
"channel_id": "wh_safety_team",
"config": { "url": "https://example.com/webhook" }
}
],
"include_matches": True,
"include_scores": True,
"template_id": "<string>"
},
"description": "Alerts when new videos match known safety incidents",
"source": "retriever",
"retriever_id": "ret_safety_search",
"trigger_on": "results",
"system_condition": { "params": {} },
"namespace_selector": {
"mode": "all",
"namespace_ids": ["<string>"]
},
"enabled": True,
"metadata": {}
}
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>',
notification_config: {
channels: [
{
channel_type: '<string>',
channel_id: 'wh_safety_team',
config: {url: 'https://example.com/webhook'}
}
],
include_matches: true,
include_scores: true,
template_id: '<string>'
},
description: 'Alerts when new videos match known safety incidents',
source: 'retriever',
retriever_id: 'ret_safety_search',
trigger_on: 'results',
system_condition: {params: {}},
namespace_selector: {mode: 'all', namespace_ids: ['<string>']},
enabled: true,
metadata: {}
})
};

fetch('https://api.mixpeek.com/v1/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.mixpeek.com/v1/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>',
'notification_config' => [
'channels' => [
[
'channel_type' => '<string>',
'channel_id' => 'wh_safety_team',
'config' => [
'url' => 'https://example.com/webhook'
]
]
],
'include_matches' => true,
'include_scores' => true,
'template_id' => '<string>'
],
'description' => 'Alerts when new videos match known safety incidents',
'source' => 'retriever',
'retriever_id' => 'ret_safety_search',
'trigger_on' => 'results',
'system_condition' => [
'params' => [

]
],
'namespace_selector' => [
'mode' => 'all',
'namespace_ids' => [
'<string>'
]
],
'enabled' => true,
'metadata' => [

]
]),
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.mixpeek.com/v1/alerts"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"notification_config\": {\n \"channels\": [\n {\n \"channel_type\": \"<string>\",\n \"channel_id\": \"wh_safety_team\",\n \"config\": {\n \"url\": \"https://example.com/webhook\"\n }\n }\n ],\n \"include_matches\": true,\n \"include_scores\": true,\n \"template_id\": \"<string>\"\n },\n \"description\": \"Alerts when new videos match known safety incidents\",\n \"source\": \"retriever\",\n \"retriever_id\": \"ret_safety_search\",\n \"trigger_on\": \"results\",\n \"system_condition\": {\n \"params\": {}\n },\n \"namespace_selector\": {\n \"mode\": \"all\",\n \"namespace_ids\": [\n \"<string>\"\n ]\n },\n \"enabled\": true,\n \"metadata\": {}\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.mixpeek.com/v1/alerts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"notification_config\": {\n \"channels\": [\n {\n \"channel_type\": \"<string>\",\n \"channel_id\": \"wh_safety_team\",\n \"config\": {\n \"url\": \"https://example.com/webhook\"\n }\n }\n ],\n \"include_matches\": true,\n \"include_scores\": true,\n \"template_id\": \"<string>\"\n },\n \"description\": \"Alerts when new videos match known safety incidents\",\n \"source\": \"retriever\",\n \"retriever_id\": \"ret_safety_search\",\n \"trigger_on\": \"results\",\n \"system_condition\": {\n \"params\": {}\n },\n \"namespace_selector\": {\n \"mode\": \"all\",\n \"namespace_ids\": [\n \"<string>\"\n ]\n },\n \"enabled\": true,\n \"metadata\": {}\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.mixpeek.com/v1/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 \"notification_config\": {\n \"channels\": [\n {\n \"channel_type\": \"<string>\",\n \"channel_id\": \"wh_safety_team\",\n \"config\": {\n \"url\": \"https://example.com/webhook\"\n }\n }\n ],\n \"include_matches\": true,\n \"include_scores\": true,\n \"template_id\": \"<string>\"\n },\n \"description\": \"Alerts when new videos match known safety incidents\",\n \"source\": \"retriever\",\n \"retriever_id\": \"ret_safety_search\",\n \"trigger_on\": \"results\",\n \"system_condition\": {\n \"params\": {}\n },\n \"namespace_selector\": {\n \"mode\": \"all\",\n \"namespace_ids\": [\n \"<string>\"\n ]\n },\n \"enabled\": true,\n \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "name": "<string>",
  "notification_config": {
    "channels": [
      {
        "channel_type": "<string>",
        "channel_id": "wh_safety_team",
        "config": {
          "url": "https://example.com/webhook"
        }
      }
    ],
    "include_matches": true,
    "include_scores": true,
    "template_id": "<string>"
  },
  "alert_id": "<string>",
  "namespace_id": "ns_production",
  "description": "Alerts when new videos match known safety incidents",
  "source": "retriever",
  "retriever_id": "ret_safety_search",
  "trigger_on": "results",
  "system_condition": {
    "params": {}
  },
  "namespace_selector": {
    "mode": "all",
    "namespace_ids": [
      "<string>"
    ]
  },
  "enabled": true,
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "metadata": {}
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Request model to create an alert.

Creates a new alert that can be attached to collections to monitor for matching content and send notifications when matches are found.

Note: The alert references a retriever that contains all query logic (filters, min_score, limits, collection targeting). The alert's job is simply to run that retriever and notify if results exist.

name
string
required

Human-readable name for the alert

Required string length: 1 - 200
Examples:

"Safety Incident Detector"

"Prohibited Content Alert"

notification_config
AlertNotificationConfig · object
required

How and where to send notifications when alert triggers

Example:
{
"channels": [
{
"channel_id": "wh_safety_team",
"channel_type": "webhook"
},
{
"channel_id": "sl_alerts",
"channel_type": "slack"
}
],
"include_matches": true,
"include_scores": true
}
description
string | null

Optional description of what this alert monitors

Maximum string length: 1000
Example:

"Alerts when new videos match known safety incidents"

source
enum<string>
default:retriever

Trigger source: 'retriever' (runs a retriever) or 'system' (built-in metric)

Available options:
retriever,
system
retriever_id
string | null

ID of the retriever to execute (source=retriever only). The retriever defines filters, scoring, limits.

Example:

"ret_safety_search"

trigger_on
enum<string>
default:results

source=retriever: fire on 'results' or 'no_results'

Available options:
results,
no_results
system_condition
SystemCondition · object | null

Built-in data-plane condition to watch (source=system only)

namespace_selector
NamespaceSelector · object | null

Org-level namespace scoping (all vs selected)

enabled
boolean
default:true

Whether the alert is active and will execute

metadata
Metadata · object | null

Additional user-defined metadata for the alert

Response

Successful Response

Response model for a single alert.

name
string
required

Human-readable name for the alert

Required string length: 1 - 200
Examples:

"Safety Incident Detector"

"Prohibited Content Alert"

notification_config
AlertNotificationConfig · object
required

How and where to send notifications when alert triggers

Example:
{
"channels": [
{
"channel_id": "wh_safety_team",
"channel_type": "webhook"
},
{
"channel_id": "sl_alerts",
"channel_type": "slack"
}
],
"include_matches": true,
"include_scores": true
}
alert_id
string

Unique identifier for the alert

Example:

"alt_abc123xyz789"

namespace_id
string | null

Namespace this alert belongs to

Example:

"ns_production"

description
string | null

Optional description of what this alert monitors

Maximum string length: 1000
Example:

"Alerts when new videos match known safety incidents"

source
enum<string>
default:retriever

Trigger source: 'retriever' (runs a retriever) or 'system' (built-in metric)

Available options:
retriever,
system
retriever_id
string | null

ID of the retriever to execute (source=retriever only). The retriever defines filters, scoring, limits.

Example:

"ret_safety_search"

trigger_on
enum<string>
default:results

For source=retriever: fire on 'results' (matches found) or 'no_results' (retriever went dark).

Available options:
results,
no_results
system_condition
SystemCondition · object | null

Built-in data-plane condition to watch (source=system only)

namespace_selector
NamespaceSelector · object | null

Org-level namespace scoping (all vs selected). When omitted, the alert is scoped to its own namespace_id.

enabled
boolean
default:true

Whether the alert is active and will execute

created_at
string<date-time> | null

Timestamp when the alert was created

updated_at
string<date-time> | null

Timestamp when the alert was last updated

metadata
Metadata · object

Additional user-defined metadata for the alert