Skip to main content

Packager HTTP API

The Packager exposes a REST API for managing and monitoring media streams. The API is available on port 4040 by default, configurable through the [api] section of the configuration file.

Authentication​

Set the optional key in the configuration:

toml
[api]
bind = "127.0.0.1:4040"
api_key = "replace-with-your-api-key"

Every endpoint, including metrics and health probes, then requires that bearer token. The examples on this page read it from PACKAGER_API_KEY; drop the Authorization header if the instance has no key:

bash
curl -H "Authorization: Bearer $PACKAGER_API_KEY" http://localhost:4040/api/sources

Without a configured key the API is unauthenticated.

Identifiers​

Wherever an endpoint takes an :id, it accepts the string ID of the object or an alias configured for it. Compositor commands use literal compositor/filter IDs. See aliases in the configuration reference.

Endpoints​

GET /metrics​

Returns Prometheus metrics in text format.

GET /healthcheck​

Returns a 200 OK response if the Packager is running.

GET /api/sources​

Lists all configured sources and their current status.

PUT /api/sources​

Creates a new source, or replaces an existing one with the same id. The request body is the JSON representation of a single source, using the same fields as the [[sources]] section of the configuration file.

GET /api/sources/:id​

Returns detailed information about a specific source.

DELETE /api/sources/:id​

Removes a source.

POST /api/sources/:id/start​

Start a source.

POST /api/sources/:id/stop​

Stop a source.

GET /api/sources/:id/healthcheck​

Returns a 200 OK response if the source is healthy. A source is considered healthy if:

  • The source task is in started state

GET /api/sinks​

Lists all configured sinks and their current status.

PUT /api/sinks​

Creates a new sink, or replaces an existing one with the same id. The request body is the JSON representation of a single sink, using the same fields as the [[sinks]] section of the configuration file.

GET /api/sinks/:id​

Returns detailed information about a specific sink.

DELETE /api/sinks/:id​

Removes a sink.

GET /api/sinks/:id/healthcheck​

The result depends on the sink state and an origin task found recursively through its upstream graph. A started origin is preferred if several origins exist.

ConditionStatus
Sink/task information is missing503
Selected origin is started, sink is started200
Selected origin is started or congested, sink is not healthy503
Selected origin is congested, even with a started sink503
Selected origin is in another state, such as stopped or waiting200
No upstream origin is resolvedSink is evaluated as if its origin were started.

The sink health check reflects the sink and its selected origin. To confirm that every source is streaming, check source states and output traffic as well. /healthcheck reports that the HTTP process responds.

POST /api/sinks/:id/start​

Start a sink.

POST /api/sinks/:id/stop​

Stop a sink.

GET /api/transcoders​

Lists all configured transcoders and their current status.

PUT /api/transcoders​

Creates a new transcoder, or replaces an existing one with the same id. The request body is the JSON representation of a single transcoder, using the same fields as the [[transcoders]] section of the configuration file.

GET /api/transcoders/:id​

Returns detailed information about a specific transcoder.

DELETE /api/transcoders/:id​

Removes a transcoder.

POST /api/transcoders/:id/start​

Start a transcoder.

POST /api/transcoders/:id/stop​

Stop a transcoder.

Check a transcoder's state with GET /api/transcoders/:id.

GET /api/compositors​

Lists all configured compositors and their current status.

PUT /api/compositors​

Creates a new compositor, or replaces an existing one with the same id. The request body is the JSON representation of a single compositor, using the same fields as the [[compositors]] section of the configuration file. Replacing a compositor with a changed configuration removes and re-creates it, so its outputs drop briefly; sending an identical configuration changes nothing. The API returns 404 if the compositor cannot be applied.

GET /api/compositors/:id​

Returns detailed information about a specific compositor, or 404 if it does not exist.

DELETE /api/compositors/:id​

Removes a compositor, or returns 404 if it does not exist.

GET /api/compositors/:id/healthcheck​

Returns 200 OK with an empty body if the compositor is in the started state, 503 in any other state, and 404 if it does not exist.

POST /api/compositors/:id/start​

Start a compositor.

POST /api/compositors/:id/stop​

Stop a compositor.

To change only a filter setting such as an overlay position, use a filter command instead of replacing the compositor.

Compositor filter commands​

Some compositor filters accept commands that change their behaviour while the stream is running without requesting a task restart. This is how an overlay is repositioned, a text graphic updated, or an audio level adjusted live.

A filter is addressed by the id of the compositor and the id of the node within it. Which options a filter accepts as commands is listed with each filter in the [[compositors]] reference; in summary:

FilterCommands
overlayx, y
drawtexttext, font_color, font_size, alpha, x, y, box, box_border_w, box_color, box_w, box_h, line_spacing, text_align, border_w
volumevolume
amixweights, one per source in source_ids order

overlay_cuda, overlay_qsv, xstack, null, amerge, anull and channelmap do not accept commands. Sending one to them returns 422 Unprocessable Entity.

The same command routes also switch a passthrough source on and off. Address it by the id of the passthrough source and send {"enabled": false} or {"enabled": true}. A body that does not parse returns 422 with an error message.

POST /api/compositors/:compositor_id/:filter_id/command​

Sends one command to a single filter node. The body is a JSON object holding the options to change; anything omitted is left as it is.

Returns 200 OK when the command is accepted, or 422 Unprocessable Entity if the compositor or filter is not found, the filter does not support commands, or the body cannot be parsed for that filter.

Example​

Move a CPU overlay to a new position:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"x": "W-w-32", "y": "32"}' \
"http://localhost:4040/api/compositors/compositor/browser-overlay/command"

Update the text and colour of a drawtext node:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "GOAL!", "font_color": "yellow", "font_size": 96}' \
"http://localhost:4040/api/compositors/compositor/scoreboard/command"

Duck the audio on one branch of a mix:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"volume": 0.2}' \
"http://localhost:4040/api/compositors/compositor/music-level/command"

Change the balance of an amix node, here taking the second source out of the mix:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"weights": [1.0, 0.0]}' \
"http://localhost:4040/api/compositors/mix/sum/command"

Stop forwarding the passthrough source subs:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled": false}' \
"http://localhost:4040/api/compositors/compositor/subs/command"

POST /api/compositors/:compositor_id/commands​

Sends several commands to different filter nodes of one compositor in a single request. The body is a JSON array; each entry names its target node with id and carries that filter's options alongside it.

All commands are resolved before any of them is dispatched. If any entry fails to resolve (an unknown node, or a filter that does not support commands), the whole request is rejected with 422 Unprocessable Entity and nothing is applied, so a batch with a resolution error is not dispatched. Dispatch is asynchronous, so check the output to confirm the change.

Example​

Reposition an overlay and update a caption together:

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{"id": "browser-overlay", "x": "32", "y": "32"},
{"id": "caption", "text": "Second half", "alpha": 0.9}
]' \
"http://localhost:4040/api/compositors/compositor/commands"

Timed metadata​

POST /api/timed-metadata/:id​

Sends timed metadata to the specified sink, through the task that feeds it. Delivery depends on the sink and output protocol.

Query parameters:

  • timestamp (optional): The timestamp in milliseconds when the metadata should be inserted. If not specified, the timestamp is left unset for the downstream implementation to handle.

Request body:

  • Raw metadata content to be inserted into the stream

Example​

bash
curl \
-X POST \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-d '{"meta": "data"}' \
"http://localhost:4040/api/timed-metadata/vindral"

POST /api/timed_metadata/:id​

An alias for POST /api/timed-metadata/:id, with an underscore instead of a hyphen. Both spellings behave identically.

Runtime updates and responses​

PUT takes a complete single-task configuration, not a JSON patch or a full configuration file. Updating an existing task reconfigures that task and can restart media processing. Runtime changes are held in memory; they do not rewrite the TOML file. Save durable changes in the configuration or its controlling system. See Lifecycle and recovery for persistence and restart behavior, and Managed mode for control-plane-owned tasks.

For example, create a source in the stopped state:

bash
curl --fail-with-body -X PUT \
-H "Authorization: Bearer $PACKAGER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id":"preview","source_type":"file","target_state":"stopped","protocol_options":{"url":"/media/input.mp4"}}' \
http://localhost:4040/api/sources

GET /api/sources returns an array. The detail endpoint returns an object with state, target_state, config, tracks, start_time, protocol_options, and demuxer_options. Use the config object as the basis of a source replacement, not the entire detail response. Sink and transcoder details have their own media/status fields.

OperationSuccessRelevant failures
List/detail200, JSON array/objectMissing detail ID: 404.
Start/stop200, empty body; transition requestedMissing ID: 404.
Upsert/delete200, empty bodyLookup/update failure: 404; malformed JSON or body fields are rejected.
Source health200 only for startedMissing source: 404; other states: 503.
Authenticated requestNormal route responseMissing/wrong bearer token: 401.
Compositor command200, empty body; dispatchedResolution/command-body failure: 422, JSON error message.

A timed metadata response confirms the request. When delivery matters, confirm receipt in the downstream consumer.

Complete live-control recipes​

Use live audio levels for independent program/commentary gain, logo and text for caption updates, or camera switching for video cuts that keep the same program audio input. These examples include complete graphs, API commands and expected media changes. A command's response confirms dispatch; check the output. A recreated graph starts from the configured filter values.