IoT / Camera Proxy
Backflow can act as a secure proxy for IP cameras, enabling remote access, multi-camera dashboards, and AI-powered video analysis — all behind tenant authentication and RBAC.
Supported Camera Types
| Type | Protocol | Features |
|---|---|---|
| RTSP | Real-Time Streaming Protocol | HLS transcoding, snapshots via FFmpeg |
| HTTP | HTTP/HTTPS | Snapshot proxy, basic auth forwarding |
| MJPEG | Motion JPEG over HTTP | Stream relay |
| ONVIF | Open Network Video Interface | Device management (planned) |
Quick Start
1. Register a Camera
bash
curl -X POST https://api.backflow.dev/tenant/iot \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Front Door",
"type": "rtsp",
"connectionUrl": "rtsp://192.168.1.100:554",
"credentials": { "username": "admin", "password": "cam123" },
"streamPath": "/stream1"
}'Credentials are encrypted at rest and never returned in API responses.
2. Capture a Snapshot
bash
# Raw JPEG (for display)
curl -H "Authorization: Bearer $TOKEN" \
https://api.backflow.dev/tenant/iot/front-door/snapshot \
--output snapshot.jpg
# Base64 JSON (for workflows)
curl -H "Authorization: Bearer $TOKEN" \
https://api.backflow.dev/tenant/iot/front-door/snapshot?format=base643. Start Live Streaming (RTSP only)
bash
# Start HLS transcoding
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://api.backflow.dev/tenant/iot/front-door/stream/start
# Play in browser via HLS.js
# URL: https://api.backflow.dev/tenant/iot/front-door/stream.m3u8
# Stop streaming
curl -X POST -H "Authorization: Bearer $TOKEN" \
https://api.backflow.dev/tenant/iot/front-door/stream/stopStreams auto-stop after 5 minutes of no viewer activity.
AI Vision Integration
Camera snapshots integrate directly with Backflow workflows for AI analysis.
Direct Vision (llm_call)
Pass the snapshot URL in the images array of an llm_call step:
json
{
"action": "llm_call",
"params": {
"prompt": "Describe what you see in this camera feed. Flag any security concerns.",
"model": "gpt-4-vision",
"provider": "openai"
},
"images": [
{
"url": "https://api.backflow.dev/tenant/iot/front-door/snapshot",
"detail": "high"
}
]
}Chained Workflow (api_call → llm_call)
Fetch the snapshot as base64 in one step, then analyze in another:
json
{
"steps": [
{
"id": "capture",
"action": "api_call",
"params": {
"endpoint": "/tenant/iot/front-door/snapshot?format=base64",
"method": "GET"
}
},
{
"id": "analyze",
"action": "llm_call",
"params": {
"prompt": "Count the number of people visible. Return JSON: { count: number }",
"model": "claude-sonnet-4-5-20250929"
},
"files": [
{
"data": "{{capture.data}}",
"mimeType": "image/jpeg",
"filename": "snapshot.jpg"
}
]
}
]
}API Reference
| Method | Endpoint | Description |
|---|---|---|
GET | /tenant/iot | List all cameras |
POST | /tenant/iot | Register a camera |
GET | /tenant/iot/:id | Get camera details |
PUT | /tenant/iot/:id | Update camera |
DELETE | /tenant/iot/:id | Delete camera |
GET | /tenant/iot/:id/snapshot | Capture JPEG snapshot |
GET | /tenant/iot/:id/snapshot?format=base64 | Snapshot as base64 JSON |
POST | /tenant/iot/:id/stream/start | Start HLS transcoding |
POST | /tenant/iot/:id/stream/stop | Stop transcoding |
GET | /tenant/iot/:id/stream/status | Stream status |
GET | /tenant/iot/:id/stream.m3u8 | HLS playlist |
GET | /tenant/iot/:id/stream/:segment | HLS segment |
Requirements
- FFmpeg must be installed on the server for RTSP streaming and RTSP snapshots
- HTTP camera snapshots work without FFmpeg
- Cameras must be network-accessible from the Backflow server
- Pro plan or higher required
Security
- Camera credentials are double-encrypted via the tenant secrets system
- All endpoints require a valid tenant JWT
- Credentials are never returned in API responses
- RBAC resource type:
iot— configure per-role access in tenant RBAC settings - Idle streams auto-cleanup prevents resource leaks