API reference
Webhooks.
Register endpoint URLs and DroidHub POSTs signed JSON events to each as streams go live, end, and change controller. Every endpoint gets its own signing secret (whsec_…); each delivery carries X-DroidHub-Event and X-DroidHub-Signature (hex HMAC-SHA256 of the raw body).
Each event is sent once, with a 5 s timeout and no retries. Respond 2xx fast and do heavy work async. Redirects aren't followed, so register your endpoint's final URL. To catch anything missed, reconcile with GET /v1/streams/:id.
Endpoint requirements
Webhook URLs must be https and must resolve to a public address — loopback, link-local and private ranges are rejected at registration and at delivery.Register an endpoint
Returns the endpoint with its whsec_… signing secret — shown exactly once, here. Store it to verify deliveries.
| Body | Type | Description |
|---|---|---|
| urlrequired | string (https) | Public https URL to deliver events to (max 2048 chars). |
{
"endpoint": {
"id": "…",
"url": "https://api.example.com/droidhub/webhook",
"enabled": true,
"createdAt": "…",
"secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // shown once
}
}List endpoints
Returns { endpoints: [{ id, url, enabled, createdAt }] }. Signing secrets are never included after creation.
Delete an endpoint
Deliveries to it stop immediately. Returns { ok: true }, or 404 if unknown.
Event types
| Type | Fired when | data |
|---|---|---|
| stream.live | The first camera connects and the stream goes live. | { streamId, name, livekitRoomName } |
| stream.hls_ready | The main camera's HLS recording started and its playlist URL is known. The playlist plays a few seconds later. Sent again with a new URL when that camera reconnects. | { streamId, hlsPlaybackUrl } |
| stream.ended | The room closes after every participant has left. A robot or viewer still connected keeps the stream live. | { streamId, hlsPlaybackUrl } |
| stream.estopped | An e-stop latches. Control is revoked and only robots can send data. | { streamId, reason, by } |
| stream.estop_cleared | The e-stop is cleared. Nobody holds control until one is assigned. | { streamId } |
| controller.assigned | A participant becomes the controller. | { streamId, identity, assignedBy } |
| controller.revoked | Control ends: revoked by the API or the dashboard, the controller disconnected or timed out, or an e-stop latched. | { streamId, identity, reason } |
| camera.connected | A camera joins the stream under a name that wasn't connected. | { streamId, camera, identity } |
| camera.disconnected | The last connection under a camera's name leaves, or the room closes. | { streamId, camera, identity } |
| camera.hls_ready | A camera's HLS recording started and its playlist URL is known; it plays a few seconds later. Sent for every recorded camera, the main one included. | { streamId, camera, hlsPlaybackUrl } |
| webhook.test | You asked for a test delivery (POST /api/v2/org/webhooks/:id/test). Sent to that endpoint only, paused or not. | { endpointId } |
Sample delivery
POST /droidhub/webhook
Content-Type: application/json
X-DroidHub-Event: controller.assigned
X-DroidHub-Signature: 3e1f0b2a8c… (hex HMAC-SHA256 of the raw body)
{
"id": "evt_V1StGXR8_Z5jdHi6B-myT",
"type": "controller.assigned",
"createdAt": "2026-06-12T09:30:00.000Z",
"data": { "streamId": "…", "identity": "operator-jane", "assignedBy": "api" }
}Verifying the signature
Compute HMAC-SHA256 over the raw request body (before any JSON parsing) with your endpoint secret and compare in constant time.
import { createHmac, timingSafeEqual } from "node:crypto";
function verifySignature(rawBody, signatureHeader, secret) {
const expected = createHmac("sha256", secret).update(rawBody).digest();
const received = Buffer.from(signatureHeader ?? "", "hex");
return (
received.length === expected.length && timingSafeEqual(received, expected)
);
}
// Mount with express.raw so req.body is the raw Buffer:
app.post("/droidhub/webhook", (req, res) => {
const ok = verifySignature(
req.body, // Buffer of the raw payload
req.get("X-DroidHub-Signature"),
process.env.DROIDHUB_WEBHOOK_SECRET, // whsec_…
);
if (!ok) return res.status(401).end();
const event = JSON.parse(req.body);
// handle event.type / event.data …
res.status(204).end();
});