Pipelines API¶
Complete reference for pipeline management endpoints.
Create Pipeline¶
POST /flex/pipeline
SimplePipeline¶
curl -X POST http://localhost:3539/flex/pipeline \
-H "Content-Type: application/json" \
-d '{
"id": "camera-1",
"mode": "simple",
"on_demand": true,
"source": {
"uri": "rtsp://192.168.1.100:8554/live",
"latency_ms": 200
},
"encoding": {
"codec": "h264",
"bitrate": 2000,
"width": 1920,
"height": 1080,
"fps": 30,
"quality": 7
},
"output": {
"uri": "rtsp://0.0.0.0:8731/camera-1"
}
}'
AdvancedPipeline¶
curl -X POST http://localhost:3539/flex/pipeline \
-H "Content-Type: application/json" \
-d '{
"id": "custom-pipeline",
"mode": "advanced",
"on_demand": true,
"raw_pipeline": "videotestsrc ! videoconvert ! x264enc ! rtph264pay ! udpsink host=239.1.1.1 port=5004"
}'
Response¶
201 Created
{
"id": "camera-1",
"mode": "simple",
"on_demand": true,
"state": "ready",
"source": { ... },
"encoding": { ... },
"output": { ... },
"klv": {
"available": false
}
}
Errors¶
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid configuration |
| 402 | LICENSE_ERROR | Codec not licensed |
| 402 | LICENSE_LIMIT_EXCEEDED | Stream limit reached |
| 504 | PIPELINE_START_TIMEOUT | Non-on-demand pipeline failed to start |
List Pipelines¶
GET /flex/pipeline
Query Parameters¶
| Parameter | Type | Description |
|---|---|---|
mode | string | Filter by simple or advanced |
on_demand | boolean | Filter by on-demand status |
state | string | Filter by state |
Examples¶
# All pipelines
curl http://localhost:3539/flex/pipeline
# Only simple pipelines
curl "http://localhost:3539/flex/pipeline?mode=simple"
# Only playing pipelines
curl "http://localhost:3539/flex/pipeline?state=playing"
Response¶
[
{
"id": "camera-1",
"mode": "simple",
"state": "playing",
...
},
{
"id": "camera-2",
"mode": "simple",
"state": "ready",
...
}
]
Get Pipeline¶
GET /flex/pipeline/{id}
Response¶
{
"id": "camera-1",
"mode": "simple",
"on_demand": true,
"state": "playing",
"source": {
"uri": "rtsp://192.168.1.100:8554/live",
"latency_ms": 200
},
"encoding": {
"codec": "h264",
"bitrate": 2000,
"width": 1920,
"height": 1080,
"fps": 30,
"quality": 7
},
"output": {
"uri": "rtsp://0.0.0.0:8731/camera-1"
},
"klv": {
"available": true,
"state": "playing"
}
}
Errors¶
| Status | Code | Description |
|---|---|---|
| 404 | NOT_FOUND | Pipeline doesn't exist |
Update Pipeline¶
PUT /flex/pipeline/{id}
Replaces the entire pipeline configuration. Pipeline must be stopped first.
curl -X PUT http://localhost:3539/flex/pipeline/camera-1 \
-H "Content-Type: application/json" \
-d '{
"id": "camera-1",
"mode": "simple",
"source": { ... },
"encoding": {
"codec": "h265",
"bitrate": 1500,
...
},
"output": { ... }
}'
Errors¶
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid configuration |
| 404 | NOT_FOUND | Pipeline doesn't exist |
| 409 | CONFLICT | Pipeline is running |
Patch Geolocation¶
PATCH /flex/pipeline/{id}
Update only the geolocation without replacing the entire pipeline.
curl -X PATCH http://localhost:3539/flex/pipeline/camera-1 \
-H "Content-Type: application/json" \
-d '{
"geolocation": {
"latitude": 38.8977,
"longitude": -77.0365,
"altitude": 100.0,
"heading": 45.0
}
}'
Set to null to remove geolocation:
curl -X PATCH http://localhost:3539/flex/pipeline/camera-1 \
-H "Content-Type: application/json" \
-d '{"geolocation": null}'
Delete Pipeline¶
DELETE /flex/pipeline/{id}
Response¶
204 No Content on success.
Errors¶
| Status | Code | Description |
|---|---|---|
| 404 | NOT_FOUND | Pipeline doesn't exist |
| 409 | CONFLICT | Pipeline is running |
Play Pipeline¶
PUT /flex/pipeline/{id}/play
Response¶
Returns the updated pipeline with state: "playing".
Errors¶
| Status | Code | Description |
|---|---|---|
| 402 | LICENSE_ERROR | Codec not licensed |
| 402 | LICENSE_LIMIT_EXCEEDED | Stream limit reached |
| 404 | NOT_FOUND | Pipeline doesn't exist |
| 500 | GSTREAMER_ERROR | GStreamer failed |
| 503 | SERVICE_UNAVAILABLE | GStreamer unavailable |
| 504 | PIPELINE_START_TIMEOUT | Didn't reach PLAYING state |
Stop Pipeline¶
PUT /flex/pipeline/{id}/stop
Response¶
Returns the updated pipeline with state: "ready".
Get Pipeline Status¶
GET /flex/pipeline/{id}/status
Same response as Get Pipeline.
Subscribe to Status Events¶
GET /flex/pipeline/{id}/status/events
Server-Sent Events stream for real-time updates.
Events¶
pipeline_status - State changed:
pipeline_not_found - Pipeline deleted:
pipeline_error - Error occurred:
Keepalive - Sent every 30 seconds:
Screenshots Control¶
Start Screenshots¶
PUT /flex/pipeline/{id}/screenshots/start
curl -X PUT http://localhost:3539/flex/pipeline/camera-1/screenshots/start \
-H "Content-Type: application/json" \
-d '{"interval_seconds": 5, "quality": 90}'
Stop Screenshots¶
PUT /flex/pipeline/{id}/screenshots/stop
KLV Control¶
Start KLV Extraction¶
PUT /flex/pipeline/{id}/klv/start
Stop KLV Extraction¶
PUT /flex/pipeline/{id}/klv/stop
Pipeline ID Rules¶
Pipeline IDs must match: ^[a-zA-Z0-9_-]+$
- Alphanumeric characters
- Dashes (
-) - Underscores (
_)
Invalid characters cause a 400 error.