Last update:2025-12-26 17:32:31
The Multipart Upload allows you to split a single video into multiple parts (blocks) and upload them concurrently or sequentially. This method is recommended for uploading large videos as it offers better reliability and supports resuming uploads (breakpoint continuation).
To successfully upload a video using this method, you need to understand two key concepts: Blocks and Chunks.
Basic Workflow:
/mkblk): Create the corresponding block on the server by uploading its first chunk./bput): Upload all subsequent chunks for that specific block until the block is complete./mkfile): Once all blocks are uploaded, instruct the server to combine the block information in the specified order to form the final video.
Before calling any endpoints in this document, you must obtain upload credentials.
/vod/videoManage/getUploadToken).| Value from Token Response | Maps to Multipart Header/Parameter | Description |
|---|---|---|
uploadUrl |
Host (Base URL) | The domain where you will send upload requests. |
uploadToken |
Authorization | The verification token for the upload request. |
fileKey |
Key | The unique identifier/path for the video storage. |
This endpoint initializes a new block and uploads the first chunk of data for that block.
Endpoint:POST <uploadUrl>/mkblk/<BlockSize>/<BlockIndex>
| Parameter | Type | Required | Description |
|---|---|---|---|
BlockSize |
Integer | Yes | The size of the block in bytes. Must be a multiple of 4 MB (4194304), except for the last block which is the actual remaining size. |
BlockIndex |
Integer | Yes | The zero-based index of the block (e.g., 0 for the first block, 1 for the second). |
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | The uploadToken obtained from the Get Upload Token API. |
Content-Length |
Integer | Yes | The size of the current chunk being uploaded (in bytes). |
Content-Type |
String | Yes | Fixed value: application/octet-stream. |
UploadBatch |
UUID | Yes | A random UUID string generated by the client to identify this specific video upload session. Use the same UUID for all requests regarding this video. |
Key |
String | Yes | The fileKey (or target video path). Can also be specified in the upload policy. |
{
"ctx": "ExampleContextStringForNextChunk...",
"checksum": "checksum_string",
"crc32": 123456789,
"offset": 4194304
}
bput request. Must be preserved by the client to link the next chunk.Use this endpoint to upload the remaining chunks for a specific block. You must repeat this call until the current block is completely uploaded.
Endpoint:POST <uploadUrl>/bput/<Ctx>/<NextChunkOffset>
| Parameter | Type | Required | Description |
|---|---|---|---|
Ctx |
String | Yes | The context string returned by the previous /mkblk or /bput response. This links the chunk to the correct block. |
NextChunkOffset |
Integer | Yes | The starting offset of the current chunk within the block. This matches the offset returned in the previous response. |
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | The uploadToken. |
Content-Length |
Integer | Yes | The size of the current chunk being uploaded (in bytes). |
Content-Type |
String | Yes | Fixed value: application/octet-stream. |
UploadBatch |
UUID | Yes | The same UUID used in Step 1. |
Key |
String | Yes | The fileKey. |
{
"ctx": "ExampleContextStringForNextChunk...",
"checksum": "checksum_string",
"crc32": 123456789,
"offset": 8388608
}
bput request.Once all blocks have been successfully uploaded, call this endpoint to merge them into the final video.
Endpoint:POST <uploadUrl>/mkfile/<FileSize>
Note: You can append optional parameters to the URL format: <uploadUrl>/mkfile/<FileSize>/x:<UserParam>/<EncodedValue>.
| Parameter | Type | Required | Description |
|---|---|---|---|
FileSize |
Integer | Yes | The total size of the entire video in bytes. |
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
String | Yes | The uploadToken. |
Content-Type |
String | Yes | Fixed value: text/plain;charset=UTF-8. |
UploadBatch |
UUID | Yes | The same UUID used in previous steps. |
Key |
String | Yes | The fileKey. |
MimeType |
String | No | Custom MIME type for the video. |
DeleteAfterDays |
Integer | No | The number of days to retain the video. 0 implies immediate deletion (not recommended). |
A comma-separated list of the final ctx string returned for each block, sorted strictly by the block index (e.g., Block 0, Block 1…).
Format:
<LastCtxOfBlock0>,<LastCtxOfBlock1>,<LastCtxOfBlock2>
{
"hash": "FqlKj-9023...",
"key": "video/2023/example.mp4"
}
offset response./mkfile step to finalize the video.