Skip to Content
Create a new direct upload URL
post

Creates a new direct upload, through which video content can be uploaded for ingest to Mux.

curl https://api.mux.com/video/v1/uploads \
  -X POST \
  -d '{ "cors_origin": "*", "new_asset_settings": { "playback_policy": ["public"], "video_quality": "basic" } }' \
  -H "Content-Type: application/json" \
  -u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}
Request body params
timeout
integer
(default: 3600, min: 60, max: 604800)

Max time in seconds for the signed upload URL to be valid. If a successful upload has not occurred before the timeout limit, the direct upload is marked timed_out

cors_origin
string

If the upload URL will be used in a browser, you must specify the origin in order for the signed URL to have the correct CORS headers.

An array of objects that each describe an input file to be used to create the asset. As a shortcut, input can also be a string URL for a file when only one input file is used. See input[].url for requirements.

new_asset_settings.input[].url
string

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

  • For the main input file, this should be the URL to the muxed file for Mux to download, for example an MP4, MOV, MKV, or TS file. Mux supports most audio/video file formats and codecs, but for fastest processing, you should use standard inputs wherever possible.
  • 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.
  • For Watermarking or Overlay, the URL is the location of the watermark image. The maximum size is 4096x4096.
  • When creating clips from existing Mux assets, the URL is defined with mux://assets/{asset_id} template where asset_id is the Asset Identifier for creating the clip from.
    The url property may be omitted on the first input object when providing asset settings for LiveStream and Upload objects, in order to configure settings related to the primary (live stream or direct upload) input.

An object that describes how the image file referenced in URL should be placed over the video (i.e. watermarking). Ensure that the URL is active and persists the entire lifespan of the video object.

new_asset_settings.input[].overlay_settings.vertical_align
string
Possible values: "top""middle""bottom"

Where the vertical positioning of the overlay/watermark should begin from. Defaults to "top"

new_asset_settings.input[].overlay_settings.vertical_margin
string

The distance from the vertical_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'middle', a positive value will shift the overlay towards the bottom and and a negative value will shift it towards the top.

new_asset_settings.input[].overlay_settings.horizontal_align
string
Possible values: "left""center""right"

Where the horizontal positioning of the overlay/watermark should begin from.

new_asset_settings.input[].overlay_settings.horizontal_margin
string

The distance from the horizontal_align starting point and the image's closest edge. Can be expressed as a percent ("10%") or as a pixel value ("100px"). Negative values will move the overlay offscreen. In the case of 'center', a positive value will shift the image towards the right and and a negative value will shift it towards the left.

new_asset_settings.input[].overlay_settings.width
string

How wide the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the width will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If height is supplied with no width, the width will scale proportionally to the height.

new_asset_settings.input[].overlay_settings.height
string

How tall the overlay should appear. Can be expressed as a percent ("10%") or as a pixel value ("100px"). If both width and height are left blank the height will be the true pixels of the image, applied as if the video has been scaled to fit a 1920x1080 frame. If width is supplied with no height, the height will scale proportionally to the width.

new_asset_settings.input[].overlay_settings.opacity
string

How opaque the overlay should appear, expressed as a percent. (Default 100%)

Generate subtitle tracks using automatic speech recognition with this configuration. This may only be provided for the first input object (the main input file). For direct uploads, this first input should omit the url parameter, as the main input file is provided via the direct upload. This will create subtitles based on the audio track ingested from that main input file. Note that subtitle generation happens after initial ingest, so the generated tracks will be in the preparing state when the asset transitions to ready.

new_asset_settings.input[].generated_subtitles[].name
string

A name for this subtitle track.

new_asset_settings.input[].generated_subtitles[].passthrough
string

Arbitrary metadata set for the subtitle track. Max 255 characters.

new_asset_settings.input[].generated_subtitles[].language_code
string
(default: en)
Possible values: "en""es""it""pt""de""fr""pl""ru""nl""ca""tr""sv""uk""no""fi""sk""el""cs""hr""da""ro""bg"

The language to generate subtitles in.

new_asset_settings.input[].start_time
number

The time offset in seconds from the beginning of the video indicating the clip's starting marker. The default value is 0 when not included. This parameter is only applicable for creating clips when input.url has mux://assets/{asset_id} format.

new_asset_settings.input[].end_time
number

The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included. This parameter is only applicable for creating clips when input.url has mux://assets/{asset_id} format.

new_asset_settings.input[].type
string
Possible values: "video""audio""text"

This parameter is required for text type tracks.

new_asset_settings.input[].text_type
string
Possible values: "subtitles"

Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, see this blog post. This parameter is required for text type tracks.

new_asset_settings.input[].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. This parameter is required for text and audio track types.

new_asset_settings.input[].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 a subtitle text track with this value. For example, the value should be "English" for a subtitle text track with language_code set to en. This optional parameter should be used only for text and audio type tracks. This parameter can be optionally provided for the first video input to denote the name of the muxed audio track if present. If this parameter is not included, Mux will auto-populate based on the input[].language_code value.

new_asset_settings.input[].closed_captions
boolean

Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for tracks with type of text and text_type set to subtitles.

new_asset_settings.input[].passthrough
string

This optional parameter should be used for tracks with type of text and text_type set to subtitles.

new_asset_settings.playback_policy
array

An array of playback policy names that you want applied to this asset and available through playback_ids. Options include:

  • "public" (anyone with the playback URL can stream the asset).
  • "signed" (an additional access token is required to play the asset).

If no playback_policy is set, the asset will have no playback IDs and will therefore not be playable. For simplicity, a single string name can be used in place of the array in the case of only one playback policy.

Possible values: "public""signed""drm"
  • public playback IDs are accessible by constructing an HLS URL like https://stream.mux.com/${PLAYBACK_ID}

  • signed playback IDs should be used with tokens https://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}. See Secure video playback for details about creating tokens.

  • drm playback IDs are protected with DRM technologies. See DRM documentation for more details.

An array of playback policy objects that you want applied to this asset and available through playback_ids. advanced_playback_policies must be used instead of playback_policy when creating a DRM playback ID.

new_asset_settings.advanced_playback_policies[].policy
string
Possible values: "public""signed""drm"
  • public playback IDs are accessible by constructing an HLS URL like https://stream.mux.com/${PLAYBACK_ID}

  • signed playback IDs should be used with tokens https://stream.mux.com/${PLAYBACK_ID}?token={TOKEN}. See Secure video playback for details about creating tokens.

  • drm playback IDs are protected with DRM technologies. See DRM documentation for more details.

new_asset_settings.advanced_playback_policies[].drm_configuration_id
string

The DRM configuration used by this playback ID. Must only be set when policy is set to drm.

new_asset_settings.passthrough
string

You can set this field to anything you want. It will be included in the asset details and related webhooks. If you're looking for more structured metadata, such as title or external_id, you can use the meta object instead. Max: 255 characters.

new_asset_settings.mp4_support
string
Deprecated
Possible values: "none""capped-1080p""audio-only""audio-only,capped-1080p""standard" (Deprecated)

Deprecated. See the Static Renditions API for the updated API.

Specify what level of support for mp4 playback. You may not enable both mp4_support and static_renditions.

  • The capped-1080p option produces a single MP4 file, called capped-1080p.mp4, with the video resolution capped at 1080p. This option produces an audio.m4a file for an audio-only asset.
  • The audio-only option produces a single M4A file, called audio.m4a for a video or an audio-only asset. MP4 generation will error when this option is specified for a video-only asset.
  • The audio-only,capped-1080p option produces both the audio.m4a and capped-1080p.mp4 files. Only the capped-1080p.mp4 file is produced for a video-only asset, while only the audio.m4a file is produced for an audio-only asset.

The standard(deprecated) option produces up to three MP4 files with different levels of resolution (high.mp4, medium.mp4, low.mp4, or audio.m4a for an audio-only asset).

MP4 files are not produced for none (default).

In most cases you should use our default HLS-based streaming playback ({playback_id}.m3u8) which can automatically adjust to viewers' connection speeds, but an mp4 can be useful for some legacy devices or downloading for offline playback. See the Download your videos guide for more information.

new_asset_settings.normalize_audio
boolean
(default: false)

Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.

new_asset_settings.master_access
string
Possible values: "none""temporary"

Specify what level (if any) of support for master access. Master access can be enabled temporarily for your asset to be downloaded. See the Download your videos guide for more information.

new_asset_settings.test
boolean

Marks the asset as a test asset when the value is set to true. A Test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test asset are watermarked with the Mux logo, limited to 10 seconds, deleted after 24 hrs.

new_asset_settings.max_resolution_tier
string
Possible values: "1080p""1440p""2160p"

Max resolution tier can be used to control the maximum resolution_tier your asset is encoded, stored, and streamed at. If not set, this defaults to 1080p.

new_asset_settings.encoding_tier
string
Deprecated
Possible values: "smart""baseline""premium"

This field is deprecated. Please use video_quality instead. The encoding tier informs the cost, quality, and available platform features for the asset. The default encoding tier for an account can be set in the Mux Dashboard. See the video quality guide for more details.

new_asset_settings.video_quality
string
Possible values: "basic""plus""premium"

The video quality controls the cost, quality, and available platform features for the asset. The default video quality for an account can be set in the Mux Dashboard. This field replaces the deprecated encoding_tier value. See the video quality guide for more details.

An array of static renditions to create for this asset. You may not enable both static_renditions and mp4_support (the latter being deprecated)

new_asset_settings.static_renditions[].resolution
string
Possible values: "highest""audio-only"
new_asset_settings.static_renditions[].passthrough
string

Arbitrary user-supplied metadata set for the static rendition. Max 255 characters.

new_asset_settings.meta.title
string

The video title. Max 512 code points.

new_asset_settings.meta.creator_id
string

This is an identifier you provide to keep track of the creator of the video. Max 128 code points.

new_asset_settings.meta.external_id
string

This is an identifier you provide to link the video to your own data. Max 128 code points.

test
boolean

Indicates if this is a test Direct Upload, in which case the Asset that gets created will be a test Asset.

post
201
/video/v1/uploads
Request
(application/json)
{
  "cors_origin": "https://example.com/",
  "new_asset_settings": {
    "playback_policy": [
      "public"
    ]
  }
}
Response
(application/json)
{
  "data": {
    "url": "https://storage.googleapis.com/video-storage-us-east1-uploads/zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc?Expires=1610112458&GoogleAccessId=mux-direct-upload%40mux-cloud.iam.gserviceaccount.com&Signature=LCu4PMoKUo%2BJkWQAUwB9WU4bWVVfW3K5bZxSxEptBz3DrjbFxNyGvs0sriyJupZh9Jdb6FxKWFIRbxEetfnAAiesOvSPH%2F1GlIichmGg3YfebfxiX77%2B6ToFF6FMkJucBo284PD90AVLHhKagOea2VsbdO0fh78MAxGH9sEspyQ2uJEfYWjHFqYQ9smJyIuM3CYOmN5HKPgRWy2yUqzV7OTMe%2FivPO4%2FX6XiiN2J4nTmy83252CJUsHIvbiGctfKxcNI6b23UVN4B1tJTVgyxTOZiBQCkMLkD%2FEe5OhoAkvJgkqENRr0q3swO0IChDDWjrh7OTMwqvWGwAoVXEGiHg%3D%3D&upload_id=ABg5-UznTdib1HhOAMjdHhWIYqBbwmSYM6dVKyPe3v33uTeEE8gkN5QzvR3cei6uSZOSrjPn7bdvvDH3nhsrLBq8AjWY2qE4UQ",
    "timeout": 3600,
    "status": "waiting",
    "new_asset_settings": {
      "playback_policies": [
        "public"
      ],
      "video_quality": "basic"
    },
    "id": "zd01Pe2bNpYhxbrwYABgFE01twZdtv4M00kts2i02GhbGjc",
    "cors_origin": "https://example.com/"
  }
}