Chunk Upload

Chunk File Upload API allows you to upload large files (size > 1 GB and up to 250 GB) efficiently where you can pause and resume uploads, and prevent failures even in a less stable network. Since the upload resumes from the point where it has been interrupted (instead from the beginning), you can save your internet data consumption.

The upload limit depends on the WorkDrive plan. Compare WorkDrive plans here.

For chunk upload, a new upload session will be created for every file. We have provided three APIs to upload the chunk files. They are: Create, Upload, and Commit Sessions.

Note:
Chunk file upload will be available only for files greater than 1 GB. For files less than 1 GB in size, normal full-file upload process will be followed.

General Terminology:

User should create a session for each file upload with the below API. Storage and file size limit of the team, user's upload permission, and file name validation will be performed. Once the request is authorised, we will send a response with Chunk details as follows:

  • chunk_size: Multiple of 64 MB in bytes for files above 1 GB, and multiple of 128 MB in bytes for files above 10 GB. All chunks except the last chunk should be uploaded with the given chunk size
  • upload_id: Unique ID of the upload session. This should be used for further API calls throughout the session.
  • chunks_uploaded: Chunks uploaded so far.
  • remaining_chunks: Chunks yet to be uploaded.
  • bytes_received: Total file size received in bytes.
  • remaining_bytes: Remaining file size yet to be uploaded in bytes.
  • expiry_time: Expiry time in ISO format (usually 7 days). We will not allow any action for the session after the expired time.
  • total_chunks: Total chunk count of the file.
  • file_size: Size of the file.
  • next_chunk: Next byte range to be uploaded. We have followed the sequential chunk order. So, if a user tries to upload any other range (other than the mentioned range), we will not allow users to upload the chunk file.
  • status: Current status of the chunk upload.

Download Chunk Upload OpenAPI Document
Download






Create Session (Normal Upload)

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

This API is used to upload a new file to your WorkDrive account.

Upload Status codes:
  • 200 - Session created successfully.
  • 401 - Create session failed.Given resource-id is not a valid parent or Chunk Upload is not allowed for this file size.
  • 402 - Create session failed. License is in suspended state.
  • 404 - Create session failed. File size limit exceeds.
  • 409 - Create session failed. File with the same name already exists. Use name-conflict parameter to create a new file name or update the existing file.
  • 423 - Create session failed.File has been checked out (locked) by another user.
  • 507 - Create session failed. Your workdrive organization storage limit exceeds.
  • 509 - Create session failed. MyFolder storage limit is restricted or exceeded.
Endpoints

OAuth Scope

WorkDrive.files.CREATECopied!

Request Example

cURL
cURL
Deluge
Copied!
curl --request POST \
  --url 'https://www.zohoapis.com/workdrive/api/v1/uploadsession/create?size={size_of_the_file}&file_name={name_of_the_file}&parent_id={parent_id}' \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52'

Query Parameters

Note:

Query parameter name should be URL encoded with UTF-8 Charset. For more info, refer here

sizestring(Required)

Size of the file in bytes

file_namestring(Required)

Name of the uploading file

parent_idstring(Required)

Parent folder ID in which file will be uploaded.

name_conflictstring(Optional)

If the same name exists (default option is fail). Allowed values: fail - API will return a failure response; rename - file will be uploaded with a new name; update - file will be uploaded as a top version on an existing file.

Allowed Values :
Show Values
failCopied!
renameCopied!
updateCopied!
Copied!Copy all as JSON Array

Response Example

200
200
400
401
402
404
409
423
500
507
509
Copied!
  {
    "received_bytes": 0,
    "chunk_size": 67108864,
    "upload_id": "CFU_NjY3MDA5NjIxXzc5OTEzMjIxMl81NzE5ODk5MDA1MDY4NzM3ODkx",
    "remaining_chunks": 18,
    "expiry_time_in_millis": 1682600933654,
    "total_chunks": 18,
    "file_size": 1141420772,
    "next_chunk": "0-67108863",
    "remaining_bytes": 1141420772,
    "expiry_time": "2023-04-27T13:08:53.654Z",
    "uploaded_chunks": 0,
    "status": "D9231"
  }
                
400 Bad Request
401 Unauthorized
402 Payment Required
404 Not Found
409 Conflict
423 Locked
500 Internal Server Error
507 Insufficient Storage
509 Bandwidth Limit Exceeded
Show full