Skip to Content
Create an 'edit-captions' job
post

Creates a new job that edits an existing Mux text track using static replacements, speaker-label replacements, and optional profanity censoring. Provide at least one of replacements, speaker_replacements, or auto_censor_profanity.

Request body params
passthrough
string

Arbitrary string stored with the job and returned in responses. Useful for correlating jobs with your own systems.

parameters.asset_id
string

The Mux asset ID whose existing text track should be edited.

parameters.track_id
string

The existing ready Mux text track ID to edit and optionally replace.

Optional LLM-driven profanity detection and censorship rules applied to the selected caption track.

parameters.auto_censor_profanity.detection_method
string
(default: llm)
Possible values: "llm"

How profanity is detected. Currently only llm is supported, which uses an LLM to identify profanity in cue text.

parameters.auto_censor_profanity.mode
string
(default: blank)
Possible values: "blank""remove""mask"

Replacement strategy for detected profanity: blank inserts bracketed underscores, remove drops the match, and mask replaces characters with question marks. Defaults to "blank".

parameters.auto_censor_profanity.always_censor
array

Additional words or short phrases that should always be censored even if the model does not detect them.

parameters.auto_censor_profanity.never_censor
array

Words or short phrases that should never be censored even if the model flags them.

Optional static word or phrase replacements applied directly to cue text.

parameters.replacements[].find
string

Exact word or phrase to replace in cue text.

parameters.replacements[].replace
string

Replacement text to insert when a match is found.

parameters.replacements[].case_sensitive
boolean
(default: false)

When true, find is matched only with exact case. Defaults to false (case-insensitive matching), so "gonna" also matches "Gonna" and "GONNA".

Optional replacements for bracketed speaker labels at the start of caption cues. Values omit the surrounding square brackets, and matching spoken text is not changed.

parameters.speaker_replacements[].find
string

Existing speaker label without the surrounding square brackets.

parameters.speaker_replacements[].replace
string

New speaker label without the surrounding square brackets.

parameters.upload_to_mux
boolean
(default: true)

Whether to upload the edited VTT back to the Mux asset as a text track. Defaults to true.

parameters.replace_existing_tracks
string
Possible values: "replace""fail"

What to do with the source track. Defaults to replace: the source is deleted and the edited track takes its place under the same name, language and closed-captions setting; no other track is touched, and the source is restored if the edited track can't be added. fail deletes nothing and adds the edited track alongside the source, so it requires a track_name different from the source's. Either way the request is rejected if a track other than the source already has the edited track's name. replace requires upload_to_mux to be true.

parameters.track_name
string

Name for the edited Mux text track. Defaults to the source track's name. Required and must differ from the source's name when replace_existing_tracks is fail. Mux requires text track names to be unique on an asset.

parameters.delete_original_track
boolean
Deprecated

Deprecated: use replace_existing_tracks. When set, the previous behavior applies: the edited track is added as <source name> (<track_name_suffix>), then the source is deleted if this is true. Cannot be combined with replace_existing_tracks or track_name.

parameters.track_name_suffix
string
Deprecated

Deprecated: use track_name. Selects the previous naming scheme, appending this suffix to the source track's name (default "edited"). Cannot be combined with replace_existing_tracks or track_name.

post
202
https://api.mux.com/robots/v0/jobs/edit-captions
Request
(application/json)
{
  "parameters": {
    "asset_id": "mux_asset_123abc",
    "track_id": "text_track_456def",
    "replacements": [
      {
        "find": "Mucks",
        "replace": "Mux",
        "case_sensitive": true
      },
      {
        "find": "gonna",
        "replace": "going to"
      }
    ],
    "speaker_replacements": [
      {
        "find": "speaker_0",
        "replace": "Alice"
      }
    ],
    "upload_to_mux": true,
    "replace_existing_tracks": "replace"
  }
}
Response
(application/json)
{
  "data": {
    "id": "rjob_example123",
    "workflow": "edit-captions",
    "status": "pending",
    "units_consumed": 0,
    "created_at": 1700000000,
    "updated_at": 1700000060,
    "parameters": {
      "asset_id": "mux_asset_123abc",
      "track_id": "text_track_456def",
      "replacements": [
        {
          "find": "Mucks",
          "replace": "Mux",
          "case_sensitive": true
        },
        {
          "find": "gonna",
          "replace": "going to"
        }
      ],
      "speaker_replacements": [
        {
          "find": "speaker_0",
          "replace": "Alice"
        }
      ],
      "upload_to_mux": true,
      "replace_existing_tracks": "replace"
    }
  }
}