Translate existing captions into another language with the Mux Robots API. Use translated captions when your videos reach viewers in more than one language.
Translate an existing caption track on a Mux asset from one language to another. The translated captions can be automatically attached to the asset as a new text track, making multilingual video accessible with a single API call. See the Translate Captions API referenceAPI for the full endpoint specification. See Mux Robots pricing for unit costs.
Check the shared workflow prerequisites before creating a job.
Caption translation requires an existing caption track on the asset. Make sure your asset has captions, either auto-generated or manually added, before creating a translate-captions job. By default, the request is also rejected if the asset already has a text track in the target language, or with the same name as the new track. See Managing existing tracks.
translate-captions jobcurl https://api.mux.com/robots/v1/jobs/translate-captions \
-H "Content-Type: application/json" \
-X POST \
-d '{
"parameters": {
"asset_id": "YOUR_ASSET_ID",
"track_id": "YOUR_TRACK_ID",
"output_language_code": "es"
}
}' \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}This request is asynchronous. The POST returns immediately with the job in pending status and does not include results. We strongly recommend listening for the robots.v1.job.translate_captions.completed webhook — the payload contains the full completed job, so no follow-up API call is needed. If webhooks aren't an option, you can poll GET /robots/v1/jobs/translate-captions/{JOB_ID} with the id from the response until the status is completed.
| Parameter | Type | Description |
|---|---|---|
asset_id | string | Required. The Mux asset ID of the video whose captions will be translated. |
track_id | string | Required. Mux text track ID of the source captions. Must identify a ready subtitle track, or the single ready legacy text transcript without subtitle metadata on an audio-only asset. A missing or unready source is rejected. |
track_name | string | Name for the translated Mux text track. Defaults to "{Language} (Auto-translated)", e.g. "Spanish (Auto-translated)". Mux requires text track names to be unique on an asset, and an existing track with this name is handled according to replace_existing_tracks. |
upload_to_mux | boolean | Whether to upload the translated VTT and attach it as a text track on the Mux asset. Defaults to true. |
never_translate | array of string | Best-effort list of terms (brand names, proper nouns) to preserve verbatim in the translated captions. Does not guarantee exact output. Terms must not contain '<' or '>', invisible characters, or characters altered by Unicode normalization. Up to 100 items. Each item: up to 100 characters. |
replace_existing_tracks | string | What to do when the asset already has a text track in the same language as, or with the same name as, the translated track. Defaults to fail, which rejects the request before any translation is billed. replace_all deletes every such track first. replace_generated deletes only Mux Video auto-generated tracks and rejects if an uploaded track is in the way. Any value other than fail requires upload_to_mux to be true. Existing tracks are matched by language ignoring region subtags, and by name ignoring case, in any status. |
output_language_code | string | Required. BCP 47 language code for the translated output (e.g. "es", "ja"). Unless replace_existing_tracks allows replacement, the asset must not already have a text track for this language. |
The outputs object is included in the job once its status is completed. You'll receive it on the robots.v1.job.translate_captions.completed webhook (recommended), or you can fetch it with GET /robots/v1/jobs/translate-captions/{JOB_ID}. It contains:
| Field | Type | Description |
|---|---|---|
temporary_vtt_url | string | Temporary pre-signed URL to download the translated VTT file, including when upload_to_mux is false. Expires 7 days after the job completes. |
never_translate_terms_preserved | boolean | Present when never_translate terms were supplied. False when at least one term was not preserved verbatim in the translated captions. Preservation is best-effort: verified, not guaranteed. |
track_id | string | Mux text track ID of the newly created translated captions, distinct from the source parameters.track_id. Present when upload_to_mux is true. |
replaced_track_ids | array of string | IDs of tracks deleted during replacement. Omitted when no deletions were recorded; historical jobs may lack this information. |
This example uses a five-minute asset, consuming 2,600 units. It is the job delivered in the robots.v1.job.translate_captions.completed webhook's data field and returned by GET /robots/v1/jobs/translate-captions/{JOB_ID}:
{
"data": {
"id": "rjob_pqr678",
"workflow": "translate-captions",
"status": "completed",
"units_consumed": 2600,
"created_at": 1746403200,
"updated_at": 1746403260,
"parameters": {
"asset_id": "YOUR_ASSET_ID",
"track_id": "YOUR_TRACK_ID",
"output_language_code": "es",
"upload_to_mux": true
},
"outputs": {
"track_id": "track_abc123",
"temporary_vtt_url": "https://storage.googleapis.com/..."
}
}
}When upload_to_mux is true (the default), the translated caption track is automatically attached to your asset. Your viewers will see the new language option in the player's caption menu without any additional work.
Use replace_existing_tracks to control what happens when the asset already has a text track in the target language (ignoring region, so es matches es-MX) or with the same name as the new track.
| Value | Behavior |
|---|---|
fail (default) | Nothing is deleted, and the new track isn't added. |
replace_all | Conflicting tracks are deleted, then the new track is added. |
replace_generated | Conflicting tracks auto-generated by Mux Video are deleted. If any other track conflicts, nothing is deleted and the new track isn't added. |
Tracks created by an earlier Robots job count as uploaded, so replacing one needs replace_all.
outputs.replaced_track_ids.422. If a conflicting track is added while the job runs, the job errors instead. Neither case is billed.