API Reference#
This reference documents every endpoint published in openapi.yaml, with
sample requests, curl commands, and sample responses drawn from the current implementation.
It complements the OpenAPI specification with necessary examples and finer details.
Important
To override the service configuration, place a config.json file in the current
working directory, or select a file with SM_CONFIG_FILE.
The repository provides a sample config.json file.
See Configuration for all available settings.
Table of Contents#
Base URL and versioning#
All endpoints are mounted under the /v1 prefix. The service listens on port 8080 by default
(override this using config.json or SM_HTTP_ADDR). Examples in this document use:
http://localhost:8080/v1
Conventions#
Content type: requests and responses use
application/json, except/retrieve/*and/media/*, which may return raw image/video bytes (see Retrieval APIs).Timestamps: RFC 3339, UTC, with a
Zsuffix and up to 9 fractional digits (nanosecond precision), for example2026-09-16T09:12:03.400000000Z.Identifiers: New
stream_idvalues start withstr-and contain 22 URL-safe characters after the prefix (26 characters total). Newrecording_idvalues contain 22 URL-safe characters without a prefix. Both encode a random UUID. Existing records can retain their 36-character UUIDs. Treat all IDs as opaque strings.sensor_idis the name supplied by the caller. Resource IDs are 1-128 characters and match^[A-Za-z0-9_-][A-Za-z0-9._:-]*$. Sensor IDs are 1-128 characters and match^[A-Za-z0-9][A-Za-z0-9._:-]*$.Pagination:
GET /recordsacceptscursorandlimit(1-100, default 20) and returnsnext_cursor, an opaque token to pass back ascursorfor the next page.next_cursorisnullwhen there are no more pages. Stream listing is not paged.Metadata filtering:
GET /recordsaccepts repeatedmetadata[key]=valuequery parameters, AND-combined with every other filter.Errors: every non-2xx response returns the same
Errorshape.
Common response objects#
Note
The examples use short placeholders such as str-1 and rec-2. These are not
generated IDs. Use the IDs returned by the service in later requests.
Error#
Returned by every failure on every endpoint.
Field |
Type |
Description |
|---|---|---|
|
integer |
The HTTP status code, repeated inside the body. |
|
string |
A short, stable code meant to be matched by software. |
|
string |
A short explanation for a person. Never contains file paths, source addresses, credentials, or FFmpeg output. |
{
"status": 409,
"error_code": "history_unavailable",
"error_detail": "Requested pre-event history is not in the buffer."
}
See Error code reference for the full error_code enum and the
status codes each endpoint can return.
Stream#
Field |
Type |
Description |
|---|---|---|
|
string |
Identity given to the stream when it was attached. |
|
string |
Identity of the sensor; for a URI source, the name the caller chose. |
|
string |
One of |
|
string |
One of |
|
Current buffer capacity and held range. |
|
|
number |
Frames arriving per second, measured over the last second. |
|
integer |
Frames known lost or unusable since attachment. |
|
string (date-time) |
When the stream was attached. |
{
"stream_id": "str-1",
"sensor_id": "cam-07",
"state": "buffering",
"sync_confidence": "ntp_synced",
"buffer": {
"capacity": 30,
"held_bytes": 6000000,
"oldest_ts": "2026-09-16T09:11:48.000000000Z",
"newest_ts": "2026-09-16T09:12:00.000000000Z"
},
"stats": { "framerate": 30, "dropped_frames": 0 },
"creation_ts": "2026-09-16T09:11:48.000000000Z"
}
BufferStatus#
Field |
Type |
Description |
|---|---|---|
|
integer |
Seconds of video the buffer is set up to hold, 5-300. |
|
integer |
Bytes the buffer is holding right now. |
|
string (date-time), nullable |
Oldest time still held; |
|
string (date-time), nullable |
Newest time still held; |
Recording#
One record is one recording of one sensor.
Field |
Type |
Description |
|---|---|---|
|
string |
Recording identity. |
|
string |
Recorded sensor. |
|
string, nullable |
The stream it was recorded from; |
|
string |
One of |
|
string (date-time) |
The timestamp of the first moment covered in the recording, itself included. The recording starts at the keyframe at or before the requested start ( |
|
string (date-time), nullable |
For a fixed-length recording, the service sets the planned end at creation: the request’s |
|
integer, nullable |
Size of the finished media; |
|
object |
Whatever metadata the caller supplied, or |
|
string (date-time) |
Record creation time. |
|
string (date-time), nullable |
When retrieval becomes unavailable. It is |
|
string, nullable |
A short reason. It is present when |
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "ready",
"start_ts": "2026-09-16T09:12:00.400000000Z",
"end_ts": "2026-09-16T09:12:08.400000000Z",
"size_bytes": 4194304,
"metadata": { "incident_id": "incident-17" },
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
MediaResult#
Returned by the Retrieval APIs when the reply is JSON rather than raw media.
Field |
Type |
Description |
|---|---|---|
|
string |
The record the media was taken from. |
|
string |
The sensor the media belongs to. |
|
string (date-time) |
Time the caller asked for. |
|
string (date-time), nullable |
Requested end time (exclusive); |
|
string (date-time) |
Actual time of the returned frame, or first frame of the clip. It can be earlier than |
|
string (date-time), nullable |
Exclusive end bound of the requested clip interval ( |
|
string |
Origin-relative path that serves the file via |
|
string (date-time), nullable |
Always |
Deletion#
Returned by DELETE /streams/{stream-id} and DELETE /records/{recording-id}.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
Which resource was deleted. |
|
boolean |
Always |
{ "resource": "recording", "id": "rec-2", "deleted": true }
Service APIs#
Service status#
GET /status
Reports service status and the running build’s version, build number, and build date.
curl -i http://localhost:8080/v1/status
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "ok",
"version": "v0.1.0",
"build_number": "42",
"build_date": "2026-09-16T00:00:00+0000"
}
Status |
Meaning |
|---|---|
200 |
Service status and build details. |
Stream Attachment APIs#
Attach sources, inspect buffers, resize buffers, and detach.
Attach a source#
POST /streams
Attaches an RTSP/RTSPS source and starts reading and buffering it. The reply returns before any history has built up.
Request body — StreamCreate
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Sensor identity; the name recordings will be filed under. One sensor can have many sources. |
|
string |
yes |
Absolute URI of the source, no credentials, up to 2048 characters. |
|
integer |
no |
Seconds of history the buffer holds, 5-300. If omitted, uses the configured |
Example — default buffer length:
curl -i -X POST http://localhost:8080/v1/streams \
-H 'Content-Type: application/json' \
-d '{
"sensor_id": "cam-07",
"source_uri": "rtsp://camera.example.com/live"
}'
HTTP/1.1 201 Created
Location: /v1/streams/str-1
Content-Type: application/json
{
"stream_id": "str-1",
"sensor_id": "cam-07",
"state": "connecting",
"sync_confidence": "unverified",
"buffer": { "capacity": 30, "held_bytes": 0, "oldest_ts": null, "newest_ts": null },
"stats": { "framerate": 0, "dropped_frames": 0 },
"creation_ts": "2026-09-16T09:11:48.000000000Z"
}
Example — explicit buffer length:
curl -i -X POST http://localhost:8080/v1/streams \
-H 'Content-Type: application/json' \
-d '{
"sensor_id": "cam-08",
"source_uri": "rtsp://192.168.1.50:554/stream1",
"buffer_length": 120
}'
Error example — source already attached for the sensor:
{
"status": 409,
"error_code": "stream_exists",
"error_detail": "this source is already attached for the sensor as str-1"
}
Status |
|
Meaning |
|---|---|---|
201 |
— |
Stream attached. |
400 |
|
Malformed body, missing fields, or |
409 |
|
The same |
415 |
|
The source is not RTSP/RTSPS H.264/H.265 video. Invalid URIs, embedded credentials, or a missing host return |
429 |
|
No room left for another stream. |
List streams#
GET /streams
Returns all attached streams in one page. Paging is not supported yet.
curl -i http://localhost:8080/v1/streams
HTTP/1.1 200 OK
Content-Type: application/json
{
"items": [
{
"stream_id": "str-1",
"sensor_id": "cam-07",
"state": "buffering",
"sync_confidence": "ntp_synced",
"buffer": {
"capacity": 30,
"held_bytes": 6000000,
"oldest_ts": "2026-09-16T09:11:48.000000000Z",
"newest_ts": "2026-09-16T09:12:00.000000000Z"
},
"stats": { "framerate": 30, "dropped_frames": 0 },
"creation_ts": "2026-09-16T09:11:48.000000000Z"
}
],
"next_cursor": null
}
If no items match, the service returns 200 with an empty items list, never 404.
Status |
Meaning |
|---|---|
200 |
Page of |
Get a stream#
GET /streams/{stream-id}
Returns the complete stream, including its buffer and statistics.
curl -i http://localhost:8080/v1/streams/str-1
HTTP/1.1 200 OK
Content-Type: application/json
{
"stream_id": "str-1",
"sensor_id": "cam-07",
"state": "buffering",
"sync_confidence": "ntp_synced",
"buffer": {
"capacity": 30,
"held_bytes": 6000000,
"oldest_ts": "2026-09-16T09:11:48.000000000Z",
"newest_ts": "2026-09-16T09:12:00.000000000Z"
},
"stats": { "framerate": 30, "dropped_frames": 0 },
"creation_ts": "2026-09-16T09:11:48.000000000Z"
}
Status |
|
Meaning |
|---|---|---|
200 |
— |
The |
404 |
|
The stream is unknown or has been detached. |
422 |
|
The stream failed. The source did not give NTP-synced timestamps in the startup time, or the source sent no keyframe in that time. |
Detach a stream#
DELETE /streams/{stream-id}
Stops reading the source and frees the buffer memory. Finished recordings stay retrievable.
curl -i -X DELETE http://localhost:8080/v1/streams/str-1
HTTP/1.1 200 OK
Content-Type: application/json
{ "resource": "stream", "id": "str-1", "deleted": true }
Status |
|
Meaning |
|---|---|---|
200 |
— |
Stream detached. |
404 |
|
Not attached. |
409 |
|
A recording still holds a lease on the buffer. |
Resize a stream buffer#
PUT /streams/{stream-id}/buffer
Changes how many seconds of history the buffer holds. Growing keeps every existing
slice and lets the buffer accept more history; shrinking immediately discards the
oldest slices that no longer fit the smaller window. Requesting the current size
succeeds without changing anything. The same buffer_length limits as attachment
apply.
Request body — BufferUpdate
Field |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
yes |
New size in seconds, 5-300. |
curl -i -X PUT http://localhost:8080/v1/streams/str-1/buffer \
-H 'Content-Type: application/json' \
-d '{ "buffer_length": 60 }'
{
"stream_id": "str-1",
"sensor_id": "cam-07",
"state": "buffering",
"sync_confidence": "ntp_synced",
"buffer": { "capacity": 60, "held_bytes": 1048576, "oldest_ts": "2026-09-16T09:11:18.000000000Z", "newest_ts": "2026-09-16T09:11:48.000000000Z" },
"stats": { "framerate": 25, "dropped_frames": 0 },
"creation_ts": "2026-09-16T09:10:00.000000000Z"
}
Error example — out of range:
{
"status": 400,
"error_code": "invalid_request",
"error_detail": "buffer_length must be between 5 and 300 seconds"
}
Status |
|
Meaning |
|---|---|---|
200 |
— |
Buffer resized; the full stream, including the new |
400 |
|
Missing |
404 |
|
Unknown stream. |
Recording Storage APIs#
Start, stop, find, read, and delete recordings.
Start a recording#
POST /records/start
Saves the video around an event from one attached stream. If the stream lacks the
requested history, no record is created. Video is copied as whole keyframe-aligned
MPEG-TS slices without re-encoding; the stored window can extend to the enclosing
keyframes, and ready records report those actual bounds.
Request body — RecordStart
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
The attached stream to record. |
|
string (date-time) |
yes |
The moment the event happened (T), on the source’s timeline. Must not be in the future according to the server clock. Keep the source and server clocks synchronized. |
|
number |
no |
Positive seconds to record after T. Omit for an open recording ended later with |
|
number |
no |
Seconds of history before T to keep, 0-300, default 0. Must already be in the buffer. |
|
object |
no |
Arbitrary metadata to store with the record. |
Example — fixed-length recording with pre-event history and metadata:
curl -i -X POST http://localhost:8080/v1/records/start \
-H 'Content-Type: application/json' \
-d '{
"stream_id": "str-1",
"start_ts": "2026-09-16T09:12:03.400000000Z",
"duration": 5,
"pre_event_duration": 3,
"metadata": { "incident_id": "incident-17" }
}'
HTTP/1.1 201 Created
Content-Type: application/json
{
"recordings": [
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "recording",
"start_ts": "2026-09-16T09:12:00.400000000Z",
"end_ts": "2026-09-16T09:12:08.400000000Z",
"size_bytes": null,
"metadata": { "incident_id": "incident-17" },
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
]
}
Example — open-ended recording (no duration, no pre_event_duration, no metadata)
Omitting duration starts a recording that keeps running until /records/stop is
called; omitting pre_event_duration defaults it to 0; omitting metadata stores {}.
curl -i -X POST http://localhost:8080/v1/records/start \
-H 'Content-Type: application/json' \
-d '{
"stream_id": "str-1",
"start_ts": "2026-09-16T09:12:03.400000000Z"
}'
HTTP/1.1 201 Created
Content-Type: application/json
{
"recordings": [
{
"recording_id": "rec-open-1",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "recording",
"start_ts": "2026-09-16T09:12:03.400000000Z",
"end_ts": null,
"size_bytes": null,
"metadata": {},
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
]
}
Error example — requested history not in the buffer:
{
"status": 409,
"error_code": "history_unavailable",
"error_detail": "requested history is not available"
}
Status |
|
Meaning |
|---|---|---|
201 |
— |
Record accepted in the |
400 |
|
Malformed body or missing |
404 |
|
Unknown stream. |
409 |
|
Requested history unavailable, or the stream is not buffering with NTP-synced timestamps. |
429 |
|
The number of active recordings is at the |
507 |
|
The recording storage quota is reached. Delete recordings to free space. |
Stop an open recording#
POST /records/stop
Stops an open recording. The stop time is the service UTC time when the service accepts the first stop request. It is not the time when the client sends the request. A repeated stop request does not change the stop time.
While the state is finalizing, end_ts is null. When the state is ready,
end_ts is the end of the last stored video slice. This value can be later than
the stop time. Use GET /records/{recording_id} to read it.
A ready recording returns 200 with its current record.
Request body — RecordStop
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
The open recording to stop. |
curl -i -X POST http://localhost:8080/v1/records/stop \
-H 'Content-Type: application/json' \
-d '{ "recording_id": "rec-open-1" }'
Still finalizing — 202 Accepted
HTTP/1.1 202 Accepted
Content-Type: application/json
{
"recording_id": "rec-open-1",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "finalizing",
"start_ts": "2026-09-16T09:12:03.400000000Z",
"end_ts": null,
"size_bytes": null,
"metadata": {},
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
Already finished — 200 OK
HTTP/1.1 200 OK
Content-Type: application/json
{
"recording_id": "rec-open-1",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "ready",
"start_ts": "2026-09-16T09:12:03.400000000Z",
"end_ts": "2026-09-16T09:15:10.400000000Z",
"size_bytes": 20971520,
"metadata": {},
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
Status |
|
Meaning |
|---|---|---|
200 |
— |
The recording is |
202 |
— |
The service accepted the stop request. The state is |
400 |
|
Malformed body or invalid |
404 |
|
Unknown recording. |
409 |
|
The record is not an active open recording. For example, it is a fixed-length or |
409 |
|
The source sent no video frame after the recording start. |
Find records#
GET /records
Returns a page of records. All query parameters are optional and AND-combined. When
time bounds are supplied, a record must be fully contained within them. Both bounds
are inclusive. A record with end_ts set to null does not match an end_ts bound.
Parameter |
In |
Type |
Description |
|---|---|---|---|
|
query |
string |
Only records from this sensor, imported as well as live. |
|
query |
string |
Only records from this stream (never includes imports). |
|
query |
date-time |
Inclusive lower bound. The record’s |
|
query |
date-time |
Inclusive upper bound. The record’s |
|
query |
date-time |
Keep only records expiring at or before this time. |
|
query |
string |
One of |
|
query |
string |
One or more metadata keys/values to match against. Repeatable. |
|
query |
string |
Opaque cursor from a previous page’s |
|
query |
integer |
Items per page, 1-100, default 20. |
Example — filter by sensor and state, default page size:
curl -i "http://localhost:8080/v1/records?sensor_id=cam-07&state=ready"
Example — filter by time window and metadata, custom page size:
curl -i "http://localhost:8080/v1/records?start_ts=2026-09-16T09:00:00Z&end_ts=2026-09-16T10:00:00Z&metadata%5Bincident_id%5D=incident-17&limit=10"
HTTP/1.1 200 OK
Content-Type: application/json
{
"items": [
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "ready",
"start_ts": "2026-09-16T09:12:00.400000000Z",
"end_ts": "2026-09-16T09:12:08.400000000Z",
"size_bytes": 4194304,
"metadata": { "incident_id": "incident-17" },
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
],
"next_cursor": null
}
Example — paging with a cursor:
curl -i "http://localhost:8080/v1/records?limit=20&cursor=MTc4OTU0OTkyMzYwMDAwMDAwMApBQUVDQXdRRkJnY0lDUW9MREEwT0R3"
If no items match, the service returns 200 with an empty items list, never 404.
Status |
|
Meaning |
|---|---|---|
200 |
— |
Page of |
400 |
|
Invalid ID, state, metadata filter, cursor, or limit ( |
Get a record#
GET /records/{recording-id}
Returns the complete record, available in every state. A failed record carries
error_detail.
curl -i http://localhost:8080/v1/records/rec-2
HTTP/1.1 200 OK
Content-Type: application/json
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "ready",
"start_ts": "2026-09-16T09:12:00.400000000Z",
"end_ts": "2026-09-16T09:12:08.400000000Z",
"size_bytes": 4194304,
"metadata": { "incident_id": "incident-17" },
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": null
}
Example — a failed record:
{
"recording_id": "rec-9",
"sensor_id": "cam-07",
"stream_id": "str-1",
"state": "failed",
"start_ts": "2026-09-16T09:12:00.000000000Z",
"end_ts": null,
"size_bytes": null,
"metadata": {},
"creation_ts": "2026-09-16T09:12:03.600000000Z",
"expiry_ts": null,
"error_detail": "recording interrupted by service restart"
}
Status |
|
Meaning |
|---|---|---|
200 |
— |
The |
404 |
|
Unknown or deleted recording. |
Delete a record#
DELETE /records/{recording-id}
Deletes the record’s metadata first, then attempts to delete its media. If metadata
deletion fails, the request returns 503 and the media stays unchanged.
If media deletion fails or an extraction still uses the media, the request returns
200. Deleting again, or reading the deleted recording, returns 404.
curl -i -X DELETE http://localhost:8080/v1/records/rec-2
HTTP/1.1 200 OK
Content-Type: application/json
{ "resource": "recording", "id": "rec-2", "deleted": true }
Status |
|
Meaning |
|---|---|---|
200 |
— |
Record deleted. |
404 |
|
Unknown or already deleted recording. |
409 |
|
Record is still recording or finalizing. |
503 |
|
Metadata deletion failed. The record and media remain; retry later. |
Retrieval APIs#
Extracts media from a ready record. Use the Accept header to select the response.
|
Response |
|---|---|
Missing, |
JSON |
|
Image bytes in the selected format. |
|
MP4 bytes. |
No acceptable supported type |
|
When several supported types match, the service uses this order: JSON, JPEG, then PNG.
Use media types without parameters. The service does not parse parameters such as
;q=1, so entries with parameters do not match.
Responses include Vary: Accept. Errors use JSON, including errors for binary requests.
The /media endpoint serves the file referenced by a JSON response.
Extract a frame#
GET /retrieve/{recording-id}/frame
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
|
path |
string |
yes |
The recording, e.g. |
|
query |
date-time |
yes |
Time wanted; must fall inside |
|
query |
string |
no |
Optional image format: |
|
query |
string |
no |
|
For frames, X-Exact-Match is true when the returned frame differs from the
requested time by no more than 1 ms. This applies to both match modes.
JSON reply (default Accept: application/json)
curl -i "http://localhost:8080/v1/retrieve/rec-2/frame?timestamp=2026-09-16T09:12:03.400000000Z"
HTTP/1.1 200 OK
Content-Type: application/json
X-Frame-Timestamp: 2026-09-16T09:12:03.400000000Z
X-Exact-Match: true
Cache-Control: no-store
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"requested_start_ts": "2026-09-16T09:12:03.400000000Z",
"requested_end_ts": null,
"start_ts": "2026-09-16T09:12:03.400000000Z",
"end_ts": null,
"url": "/v1/media/rec-2/frame-3000000000.jpeg",
"expiry_ts": null
}
Raw bytes reply with a png format and nearest match
curl "http://localhost:8080/v1/retrieve/rec-2/frame?timestamp=2026-09-16T09:12:03.700000000Z&format=png&match=nearest" \
-H 'Accept: image/png' \
-o frame.png
HTTP/1.1 200 OK
Content-Type: image/png
X-Frame-Timestamp: 2026-09-16T09:12:03.666666667Z
X-Exact-Match: false
Status |
|
Meaning |
|---|---|---|
200 |
— |
|
400 |
|
Missing or invalid |
400 |
|
Unsupported |
404 |
|
Recording not found, timestamp outside coverage, exact frame missing, or no decodable frame available for the requested time. |
406 |
|
Incompatible |
409 |
|
Record not ready. |
429 |
|
Extraction capacity reached. |
507 |
|
The recording storage quota is reached. Delete recordings to free space. |
503 |
|
Extraction or storage failure. |
Extract a clip#
GET /retrieve/{recording-id}/clip
The recording must cover the whole requested interval. If it does not, the service returns 404.
The clip starts at the keyframe at or before start_ts. So the returned
start_ts can be earlier than the requested time. end_ts is the exclusive
end bound (the request’s start_ts + duration), not the last frame timestamp.
For clips, X-Exact-Match is true only when the first keyframe time equals the
requested start_ts.
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
|
path |
string |
yes |
The recording, e.g. |
|
query |
date-time |
yes |
Requested start time. The clip can start earlier, at the preceding keyframe. Must be RFC 3339 UTC and end in |
|
query |
number |
yes |
Positive clip length in seconds. The full interval must be covered by the recording. |
|
query |
string |
no |
|
curl -i "http://localhost:8080/v1/retrieve/rec-2/clip?start_ts=2026-09-16T09:12:00.400000000Z&duration=5"
HTTP/1.1 200 OK
Content-Type: application/json
X-Frame-Timestamp: 2026-09-16T09:12:00.400000000Z
X-Exact-Match: true
Cache-Control: no-store
{
"recording_id": "rec-2",
"sensor_id": "cam-07",
"requested_start_ts": "2026-09-16T09:12:00.400000000Z",
"requested_end_ts": "2026-09-16T09:12:05.400000000Z",
"start_ts": "2026-09-16T09:12:00.400000000Z",
"end_ts": "2026-09-16T09:12:05.400000000Z",
"url": "/v1/media/rec-2/clip-0-5000000000.mp4",
"expiry_ts": null
}
Raw clip bytes in mp4 format
curl "http://localhost:8080/v1/retrieve/rec-2/clip?start_ts=2026-09-16T09:12:00.400000000Z&duration=8&format=mp4" \
-H 'Accept: video/mp4' \
-o clip.mp4
Status |
|
Meaning |
|---|---|---|
200 |
— |
|
400 |
|
Missing or invalid |
400 |
|
Missing or invalid |
404 |
|
Recording not found, the requested interval is not fully covered, or no clip is available for the requested interval. |
406 |
|
Incompatible |
409 |
|
Record not ready. |
429 |
|
Extraction capacity reached. |
507 |
|
The recording storage quota is reached. Delete recordings to free space. |
503 |
|
Extraction or storage failure. |
Get produced media#
GET /media/{recording-id}/{file}
Serves a derived frame or clip. Derived media does not expire. Recording expiry does not affect it, but deleting the recording removes it. expiry_ts is always null.
Parameter |
In |
Type |
Required |
Description |
|---|---|---|---|---|
|
path |
string |
yes |
The recording, e.g. |
|
path |
string |
yes |
The file name from a |
curl "http://localhost:8080/v1/media/rec-2/frame-3000000000.jpeg" -o frame.jpeg
HTTP/1.1 200 OK
Content-Type: image/jpeg
Cache-Control: private, no-cache
X-Content-Type-Options: nosniff
Status |
|
Meaning |
|---|---|---|
200 |
— |
The frame or clip bytes ( |
404 |
|
Unknown recording, or the frame or clip file is missing. |
Error code reference#
|
Typical status |
Meaning |
|---|---|---|
|
400 |
The request is malformed, or its fields contradict each other. |
|
400 |
|
|
400 |
A timestamp is malformed or out of range. A |
|
404 |
The stream is unknown or has been detached. |
|
404 |
The recording is unknown or has been deleted. |
|
404 |
The requested frame is not covered, no frame is within 1 ms of the requested time ( |
|
404 |
The requested clip interval is not covered, no clip is available for the requested interval, or a clip file is missing. |
|
406 |
The |
|
409 |
The same |
|
409 |
The record is not in a state that allows the requested action. |
|
409 |
Requested history is unavailable, or the stream is not buffering with NTP-synced timestamps. |
|
409 |
Another resource still depends on this one (e.g. an active recording). |
|
415 |
The source is not RTSP/RTSPS H.264/H.265 video. |
|
422 |
The stream failed. The source did not give NTP-synced timestamps in the startup time, or the source sent no keyframe in that time. |
|
429 |
Capacity limit reached for a stream, recording, or extraction. |
|
500 |
An unexpected server-side failure. |
|
507 |
The recording storage quota ( |
|
503 |
Storage or media processing failed. |