Live Monitor
curl --request POST \
--url https://trio.machinefi.com/api/live-monitor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stream_url": "<string>",
"condition": "<string>",
"webhook_url": "<string>",
"interval_seconds": 10,
"input_mode": "clip",
"clip_duration_seconds": 3,
"monitor_duration_seconds": 600,
"trigger_cooldown_seconds": 0,
"max_triggers": 1
}
'import requests
url = "https://trio.machinefi.com/api/live-monitor"
payload = {
"stream_url": "<string>",
"condition": "<string>",
"webhook_url": "<string>",
"interval_seconds": 10,
"input_mode": "clip",
"clip_duration_seconds": 3,
"monitor_duration_seconds": 600,
"trigger_cooldown_seconds": 0,
"max_triggers": 1
}
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({
stream_url: '<string>',
condition: '<string>',
webhook_url: '<string>',
interval_seconds: 10,
input_mode: 'clip',
clip_duration_seconds: 3,
monitor_duration_seconds: 600,
trigger_cooldown_seconds: 0,
max_triggers: 1
})
};
fetch('https://trio.machinefi.com/api/live-monitor', 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://trio.machinefi.com/api/live-monitor",
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([
'stream_url' => '<string>',
'condition' => '<string>',
'webhook_url' => '<string>',
'interval_seconds' => 10,
'input_mode' => 'clip',
'clip_duration_seconds' => 3,
'monitor_duration_seconds' => 600,
'trigger_cooldown_seconds' => 0,
'max_triggers' => 1
]),
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://trio.machinefi.com/api/live-monitor"
payload := strings.NewReader("{\n \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\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://trio.machinefi.com/api/live-monitor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trio.machinefi.com/api/live-monitor")
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 \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"created_at": "<string>",
"stream_url": "<string>",
"job_type": "<string>",
"details": {},
"message": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}Monitoring
Live Monitor
Start a continuous monitoring job that checks for a condition
POST
/
live-monitor
Live Monitor
curl --request POST \
--url https://trio.machinefi.com/api/live-monitor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stream_url": "<string>",
"condition": "<string>",
"webhook_url": "<string>",
"interval_seconds": 10,
"input_mode": "clip",
"clip_duration_seconds": 3,
"monitor_duration_seconds": 600,
"trigger_cooldown_seconds": 0,
"max_triggers": 1
}
'import requests
url = "https://trio.machinefi.com/api/live-monitor"
payload = {
"stream_url": "<string>",
"condition": "<string>",
"webhook_url": "<string>",
"interval_seconds": 10,
"input_mode": "clip",
"clip_duration_seconds": 3,
"monitor_duration_seconds": 600,
"trigger_cooldown_seconds": 0,
"max_triggers": 1
}
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({
stream_url: '<string>',
condition: '<string>',
webhook_url: '<string>',
interval_seconds: 10,
input_mode: 'clip',
clip_duration_seconds: 3,
monitor_duration_seconds: 600,
trigger_cooldown_seconds: 0,
max_triggers: 1
})
};
fetch('https://trio.machinefi.com/api/live-monitor', 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://trio.machinefi.com/api/live-monitor",
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([
'stream_url' => '<string>',
'condition' => '<string>',
'webhook_url' => '<string>',
'interval_seconds' => 10,
'input_mode' => 'clip',
'clip_duration_seconds' => 3,
'monitor_duration_seconds' => 600,
'trigger_cooldown_seconds' => 0,
'max_triggers' => 1
]),
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://trio.machinefi.com/api/live-monitor"
payload := strings.NewReader("{\n \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\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://trio.machinefi.com/api/live-monitor")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://trio.machinefi.com/api/live-monitor")
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 \"stream_url\": \"<string>\",\n \"condition\": \"<string>\",\n \"webhook_url\": \"<string>\",\n \"interval_seconds\": 10,\n \"input_mode\": \"clip\",\n \"clip_duration_seconds\": 3,\n \"monitor_duration_seconds\": 600,\n \"trigger_cooldown_seconds\": 0,\n \"max_triggers\": 1\n}"
response = http.request(request)
puts response.read_body{
"job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"created_at": "<string>",
"stream_url": "<string>",
"job_type": "<string>",
"details": {},
"message": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"remediation": "<string>"
}
}Starts a continuous job that checks a stream until your condition is met, the job is stopped, or limits are reached.
Key Request Fields
monitor_duration_seconds(default600): per-job runtime limit in seconds.trigger_cooldown_seconds(default0): minimum seconds between trigger alerts.max_triggers(default1): number of trigger alerts before auto-stop.1keeps legacy first-match behavior.>1allows repeated alerts, then stops.nullmeans unlimited alerts until duration/cancel.
Delivery Mode Selection
POST /live-monitor selects response mode by request shape:
webhook_urlpresent -> webhook modeAccept: text/event-streamand nowebhook_url-> SSE mode- otherwise -> polling mode
Response Semantics by Mode
Polling mode
Returns a job response (job_id, status, created_at, job_type, stream_url, optional message).
Use GET /jobs/{job_id} to track runtime and terminal state.
Webhook mode
Returns a job response immediately, then sends async webhook events. Common webhooktype values:
job_startedwatch_triggeredjob_stoppederror
SSE mode
Returns a text event stream. Common event names:startedprogresstriggered(non-terminal trigger event in multi-trigger mode)stoppederror
stopped and error as terminal events for that stream session.
Treat triggered as non-terminal.
Status Semantics
For polling or post-hoc inspection:running: active checks in progresscompleted: condition matched and job completedstopped: ended without failure (cancelled or auto-stop)failed: ended due to runtime/stream failure
stats.reason include:
condition_triggeredmax_triggers_reachedmax_duration_reachedcancelled
Typical Usage
- Validate URL: Validate Stream
- Validate wording: Check Once
- Start
POST /live-monitor - Track via polling, webhook, or SSE
Related
- Workflow chooser: Choose Your Workflow
- Job state details: Get Job Details
- Webhook implementation: Use Webhooks
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
application/json
Request to start a live monitor job.
YouTube Live URL or RTSP stream to monitor
Required string length:
1 - 500Natural language condition to watch for
Required string length:
1 - 1000Webhook URL for notifications
Required string length:
1 - 2083Polling interval in seconds
Required range:
5 <= x <= 300Input mode: 'frames' for single frame, 'clip' for video clip, 'hybrid' for frame+clip combined
Available options:
frames, clip, hybrid Duration of video clip in seconds (used when input_mode is 'clip' or 'hybrid')
Required range:
1 <= x <= 10Maximum monitoring duration in seconds
Required range:
x >= 5Minimum time in seconds between trigger alerts
Required range:
0 <= x <= 3600Maximum trigger alerts before auto-stop. Null means unlimited.
Required range:
x >= 1Response
Successful Response