Skip to Content
Create an asset track
post

Adds an asset track (for example, subtitles, or an alternate audio track) to an asset.

curl https://api.mux.com/video/v1/assets/${ASSET_ID}/tracks \
  -X POST \
  -d '{ "url": "https://example.com/myVIdeo_en.srt", "type": "text", "text_type": "subtitles", "closed_captions": true, "language_code": "en-US", "name": "English",  "passthrough": "English" }' \
  -H "Content-Type: application/json" \
  -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
url
string

The URL of the file that Mux should download and use.

  • For audio tracks, the URL is the location of the audio file for Mux to download, for example an M4A, WAV, or MP3 file. Mux supports most audio file formats and codecs, but for fastest processing, you should use standard inputs wherever possible.
  • For text tracks, the URL is the location of subtitle/captions file. Mux supports SubRip Text (SRT) and Web Video Text Tracks formats for ingesting Subtitles and Closed Captions.
type
string
Possible values: "text""audio"
text_type
string
Possible values: "subtitles"
language_code
string

The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English.

name
string

The name of the track containing a human-readable description. This value must be unique within each group of text or audio track types. The HLS manifest will associate the text or audio track with this value. For example, set the value to "English" for subtitles text track with language_code as en-US. If this parameter is not included, Mux will auto-populate a value based on the language_code value.

closed_captions
boolean

Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH).

passthrough
string

Arbitrary user-supplied metadata set for the track either when creating the asset or track.

Request path & query params
ASSET_ID
string

The asset ID.

post
201
/video/v1/assets/{ASSET_ID}/tracks
Request
(application/json)
{
  "url": "https://example.com/myVideo_en.srt",
  "type": "text",
  "text_type": "subtitles",
  "language_code": "en-US",
  "name": "English",
  "closed_captions": true,
  "passthrough": "English"
}
Response
(application/json)
{
  "data": {
    "type": "text",
    "text_type": "subtitles",
    "status": "preparing",
    "passthrough": "English",
    "name": "English",
    "language_code": "en-US",
    "id": "xBe7u01029ipxBLQhYzZCJ1cke01zCkuUsgnYtH0017nNzbpv2YcsoMDmw",
    "closed_captions": true
  }
}