Skip to main content

Chunk Upload Media

This endpoint performs the chunk upload of a media with type image or document.

info

The client must split the file into chunks and send to the server in series. After all the chunks have been uploaded the client must call the Chunk Upload Complete endpoint with the given upload_id parameter to finalize the upload and retrieve the Media.

To perform chunk upload the request must contain Content-Range header with the information about the chunk.

Max file size for image file is 5M.

Max file size for document file is 50M.

Max chunk size is 204800 bytes.

info

This operation requires authentication

HTTP Request

POST /api/v2/media/upload/chunk/

Parameters

NameInTypeRequiredDescription
» Content-Rangeheaderstringtruerange of the chunk upload in the format bytes start-end/total
» upload_idbodystringtruereturned by the first call and required from the second
» expiresbodystringfalseexpiration time
» imagebodyblobfalseImage chunk to be uploaded
» documentbodyblobfalseDocument chunk to be uploaded

Example Body Parameters

{
"upload_id": "string",
"offset": "string"
}

Example Request

const inputBody = '{
"upload_id": "string",
"offset": "string",
"image": "blob"
}';
const headers = {
'Content-Type':'multipart/form-data',
'Content-Range': 'bytes 1433600-1638399/2124437',
'Accept':'application/json',
'Authorization': 'Bearer {access_token}'
};

fetch('/api/v2/media/upload/chunk/',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
201CreatednoneChunkMedia

Example responses

{
"upload_id": "string",
"offset": "string",
"expires": "string"
}