Skip to Content
Create a directive
post

Creates a new directive that defines which Robots workflows should run against Mux assets, and under what resource conditions.

Request body params
name
string

Human-readable directive name.

subject.type
string
Possible values: "video.asset""video.live_stream"

The entity type each run targets. V1 accepts "video.asset" only; "video.live_stream" is reserved and rejected at save time.

Resources the engine ensures on the asset before dependent workflows run. May be omitted for workflows-only directives.

The Robots workflows to dispatch on each run.

post
201
https://api.mux.com/robots/v0/directives
Request
(application/json)
{
  "name": "Generate captions, then translate",
  "subject": {
    "type": "video.asset"
  },
  "resources": [
    {
      "reference_id": "captions_en",
      "type": "video.asset.track",
      "kind": "caption",
      "language": "en",
      "source": {
        "via": "workflow",
        "binding": "premium_captions"
      }
    }
  ],
  "workflows": [
    {
      "reference_id": "premium_captions",
      "workflow": "generate-premium-captions",
      "params": {
        "language_code": "en"
      }
    },
    {
      "reference_id": "translate_es",
      "workflow": "translate-captions",
      "inputs": [
        "captions_en"
      ],
      "params": {
        "to_language_code": "es"
      }
    }
  ]
}