Detections
Stream detection status
Opens a Server-Sent Events stream of the detection’s status changes. Emits the current status immediately, then each transition, and ends once the detection settles (complete or failed). Each event’s data is a DetectionStatusEvent (see the response schema). Authenticate with a Bearer token via a fetch-based client; the native EventSource cannot send an Authorization header.
GET
/
workspaces
/
{workspaceId}
/
detections
/
{detectionId}
/
events
Stream detection status
curl --request GET \
--url https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/eventsimport requests
url = "https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events', 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.example.com/workspaces/{workspaceId}/detections/{detectionId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending"
}{
"message": "<string>",
"name": "<string>"
}{
"message": "<string>",
"name": "<string>"
}{
"message": "<string>",
"name": "<string>"
}Path Parameters
Response
Server-sent event stream; each event's data is the payload below.
A detection's status change, broadcast on the core-NATS subject
[detection_subject].
Fan-out to any watching SSE connections; the detection row in Postgres remains the source of truth, so a missed broadcast is recoverable by re-reading it.
Stream detection status
curl --request GET \
--url https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/eventsimport requests
url = "https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events', 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.example.com/workspaces/{workspaceId}/detections/{detectionId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/workspaces/{workspaceId}/detections/{detectionId}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"detectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending"
}{
"message": "<string>",
"name": "<string>"
}{
"message": "<string>",
"name": "<string>"
}{
"message": "<string>",
"name": "<string>"
}