All Products
Search
Document Center

ApsaraVideo VOD:UploadMediaByURL

Last Updated:Dec 09, 2025

Pulls and uploads audio or video files from source URLs. Batch uploads are supported.

Operation description

  • Before you use this operation, make sure that you fully understand the billing methods and pricing of ApsaraVideo VOD. Uploading media files to ApsaraVideo VOD incurs storage fees. For more information about billing, see Media asset storage billing. If you have enabled transfer acceleration, upload acceleration fees are also incurred when you upload media files to ApsaraVideo VOD. For more information about billing, see Storage and transfer acceleration billing.

  • For information about the media file formats that this operation supports, see Media formats.

  • This operation is suitable for scenarios where files are not stored on a local server or terminal and must be uploaded from a URL that is accessible over the public network.

  • This is an asynchronous operation. It is not performed in real time, and timeliness is not guaranteed. After a task is submitted, the upload may take several hours or even days to complete. If you have high requirements for timeliness, use an upload SDK.

  • If a callback is configured, you receive an URLUploadComplete event notification after the upload is complete. You can call the GetURLUploadInfos operation to query the upload status.

  • After you submit an upload task, an asynchronous task is generated in the cloud. All URL upload tasks submitted by users in the region are queued for execution. The completion time depends on the number of existing tasks. After the upload is complete, you can use the URL and video ID from the event notification (message callback) to associate the media asset.

  • This operation is available only in the China (Shanghai), China (Beijing), China (Shenzhen), Singapore, and US (Silicon Valley) regions.

  • Each time you submit an upload task for the same media file URL, a new media asset with a new media ID is generated in ApsaraVideo VOD.

  • If a single file is larger than 20 GB, the upload fails. To upload a file larger than 20 GB, use an upload SDK. For more information, see Overview of upload SDKs.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vod:UploadMediaByURL

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

UploadURLs

string

Yes

The URL of the source media file.

  • The URL must include a file name extension, such as mp4 in https://****.mp4.
    • If the URL does not include a file name extension, you can specify one by setting FileExtension in UploadMetadatas.

    • If the URL includes a file name extension and you also set FileExtension, the value of FileExtension takes precedence.

    • For information about supported file name extensions, see Upload overview.

Note
  • Separate multiple URLs with commas (,). You can specify up to 20 URLs. To prevent upload failures caused by special characters, URL-encode each URL before you concatenate them with commas.

https://****.mp4

TemplateGroupId

string

No

The ID of the transcoding template group. You can obtain the ID in one of the following ways:

  • Log on to the ApsaraVideo VOD console. Choose Configuration Management > Media Processing > Transcoding Template Groups to view the ID.

  • When you call the AddTranscodeTemplateGroup operation to create a transcoding template group, the value of the TranscodeTemplateGroupId parameter in the response is the transcoding template group ID.

  • When you call the ListTranscodeTemplateGroup operation to query transcoding template groups, the value of the TranscodeTemplateGroupId parameter in the response is the transcoding template group ID.

Note
  • If you do not set this parameter, the default transcoding template group is used. If you set this parameter, the specified transcoding template group is used.

  • You can also set the transcoding template group ID in UploadMetadatas. If you set TemplateGroupId in both UploadMetadatas and at this level, the value in UploadMetadatas takes precedence.

ca3a8f6e4957b65806709586****

StorageLocation

string

No

The storage address of the media file.

Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management > Storage to view the storage address. If you do not specify this parameter, the default storage address is used.

outin-bfefbb90a47c******163e1c7426.oss-cn-shanghai.aliyuncs.com

UploadMetadatas

string

No

The metadata of the media file to upload, in a JSON string.

  • The metadata takes effect only when it is matched with a URL in UploadURLs.

  • JSON format: [UploadMetadata, UploadMetadata,…]. The value must be a JSON string.

  • For more information, see the UploadMetadata table below.

[{"SourceURL":"https://example.aliyundoc.com/video01.mp4","Title":"urlUploadTest"}]

UserData

string

No

Custom settings in a JSON string. You can configure settings such as message callbacks and transfer acceleration. For more information, see UserData.

Note
  • To use the message callback feature in this parameter, you must configure a webhook address and select the corresponding event types in the console. Otherwise, the callback settings do not take effect. For information about how to configure an HTTP webhook, see Callback settings.

  • To use the transfer acceleration feature, you must submit a ticket to enable it. For more information, see Upload-related notes. For information about how to submit a ticket, see Contact us.

{"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}

AppId

string

No

The application ID. The default value is app-1000000. For more information, see Multi-application service.

app-****

WorkflowId

string

No

The workflow ID. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Processing > Workflows to view the workflow ID.

Note

If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows.

e1e243b42548248197d6f74f9****

SessionId

string

No

A custom deduplication ID. If you specify this parameter in a request, an error is returned if the system detects a request with the same ID in the last 10 minutes.

Note
  • The ID can be up to 50 characters in length and can contain uppercase letters, lowercase letters, digits, hyphens (-), and underscores (_). If you do not specify this parameter or specify an empty string, deduplication is not performed.

5c62d40299034bbaa4c195da330****

UploadMetadata

NameTypeRequiredDescription
SourceURLStringYesThe URL of the source media file to upload.
TitleStringNoThe title of the media asset. The title can be up to 128 bytes in length and must be UTF-8 encoded.
FileSizeStringNoThe file size.
DescriptionStringNoThe description. The description can be up to 1,024 bytes in length and must be UTF-8 encoded.
CoverURLStringNoThe URL of the custom video thumbnail.
CateIdStringNoThe category ID. Log on to the ApsaraVideo VOD console and choose Configuration Management > Media Asset Management > Categorization to view the category ID.
TagsStringNoThe tags. A single tag can be up to 32 bytes in length. You can specify a maximum of 16 tags. Separate multiple tags with commas (,). The tags must be UTF-8 encoded.
TemplateGroupIdStringNoThe ID of the transcoding template group. This parameter overwrites the outer TemplateGroupId parameter.
WorkflowIdStringNoThe workflow ID. If you specify both WorkflowId and TemplateGroupId, WorkflowId takes precedence. For more information, see Workflows.
FileExtensionStringNoThe file name extension of the media file. For information about supported file name extensions, see Upload overview.
ReferenceIdStringNoA custom ID. The ID can be 6 to 64 characters in length and can contain lowercase letters, uppercase letters, digits, hyphens (-), and underscores (_). The ID must be unique for each user.
Note
  • Parameters in UploadMetadata, such as Title, Description, and Tags, cannot contain emojis.

  • To ensure normal playback, if you set TemplateGroupId to `VOD_NO_TRANSCODE` to upload a video file without transcoding, only files in MP4, FLV, MP3, M3U8, and WEBM formats can be played directly. Files in other formats can only be stored. Pay attention to the file name extension. If you use ApsaraVideo Player, the player version must be 3.1.0 or later.

  • If you specify a transcoding template group that does not require transcoding (TemplateGroupId is set to `VOD_NO_TRANSCODE`), you receive only an FileUploadComplete event notification after the video is uploaded. You do not receive a SingleStreamTranscodeComplete event notification.

  • If a callback is configured, after the video is uploaded, you receive an URLUploadComplete event notification in addition to the standard upload and transcoding notifications.

  • When you submit a batch request, a separate notification is sent for each SourceURL.

Response elements

Element

Type

Description

Example

object

The response.

RequestId

string

The request ID.

25818875-5F78-4AF6-D7393642CA58****

UploadJobs

array<object>

The list of upload jobs.

object

The details of an upload job.

SourceURL

string

The source file URL of the upload job.

http://example****.mp4

JobId

string

The upload job ID.

ad90a501b1b94fb72374ad005046****

Examples

Success response

JSON format

{
  "RequestId": "25818875-5F78-4AF6-D7393642CA58****",
  "UploadJobs": [
    {
      "SourceURL": "http://example****.mp4",
      "JobId": "ad90a501b1b94fb72374ad005046****"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.