Large File Upload as Chunks

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

Once the upload session is created, a user can upload the chunks in a sequential order. Upload API is common for both normal upload and revision upload. In each upload call, we will validate the following things.

  • Upload session should be created for the given upload-id.
  • Content length should be equal to the chunk size.

  • Content range should be equal to the next-chunk value.

  • Session should be active. It will be validated with expiry time.

  • Once a chunk is uploaded, we will send a response with status and the next chunk's details similar to the Create Session API response, or user can use the Chunk Upload Session Progress (GET Method) API to get the chunk details.

Note:
  • We have to send several chunks one by one as binary.
Status codes:
  • 200 - Chunk upload request completed successfully.
  • 400 - Upload failed. Upload session has expired.
  • 401 - Upload failed. Invalid OAuth token/scope or no permission to upload.
  • 412 - Upload failed. Upload session has already been completed.
Additional error codes:
  • D9232 - Upload failed. Invalid upload ID.
  • D9233 - Upload failed. Invalid byte range or chunk order.
  • D9234 - Upload failed. Upload session has expired.
Endpoints

OAuth Scope

WorkDrive.files.CREATEZohoFiles.files.CREATECopied!

Request Example

cURL
cURL
Deluge
Copied!
curl --request POST \
  --url https://upload.zoho.com/workdrive-api/v1/stream/upload \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'Content-Length: 67108864' \
  --header 'Content-Range: bytes 0-67108863/114120772' \
  --header 'upload-id: SOME_STRING_VALUE' \
  --header 'x-streammode: 1'

Headers

upload-idstring(Required)

Upload ID from the Create Session API.

Content-Rangestring(Required)

Uploading chunk byte range. Format: bytes -/.

x-streammodestring(Required)

Upload content transfer mode type. Possible values: 1 (stream mode - supported with this API).

Allowed Values :
Show Values
1Copied!
Copied!Copy all as JSON Array
Content-Lengthstring(Required)

The Content-Length header indicates the size of the message body, in bytes, sent to the recipient.

Response Example

D9236

D9236

D9237

D9202

D9218

D9244

D9244

D9233

D9245

D9235

D9238

D9231

D9231

D9222

D9201

D9223

D9214

D9219

D9220

D9211

D9221

200
200
400
404
409
412
417
423
507
509
Copied!
  {
    "received_bytes": 67108864,
    "chunk_size": 67108864,
    "upload_id": "CFU_NjY3MDA5NjIxXzc5OTEzMjIxMl81NzE5ODk5MDA1MDY4NzM3ODkx",
    "remaining_chunks": 17,
    "expiry_time_in_millis": 1682601204850,
    "md5_checksum": "5f6e72c188b2e0e1f19aa16082a786cd",
    "total_chunks": 18,
    "file_size": 1141420772,
    "next_chunk": "67108864-134217727",
    "remaining_bytes": 1074311908,
    "expiry_time": "2023-04-27T13:13:24.850Z",
    "uploaded_chunks": 1,
    "status": "D9231"
  }
                
  {
    "errors": [
      {
        "id": "D9236",
        "title": "File extension is on the blocked list"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9237",
        "title": "File extension not in org-allowed list"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9202",
        "title": "File size exceeds the allowed limit"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9218",
        "title": "Duplicate filename with no override"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9244",
        "title": "Camera upload device folder not found"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9233",
        "title": "Chunk uploaded out of sequence"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9245",
        "title": "Invalid camera upload device folder"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9235",
        "title": "Chunk MD5 checksum does not match"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9238",
        "title": "Same chunk uploaded more than once"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9231",
        "title": "Upload partially completed"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9222",
        "title": "MyFolder storage restricted"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9201",
        "title": "No file content found"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9223",
        "title": "Team folder library storage limit exceeded"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9214",
        "title": "Bad input - missing folder/resource ID"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9219",
        "title": "Permission denied"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9220",
        "title": "File locked by another user"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9211",
        "title": "Org storage quota exceeded"
      }
    ]
  }
                
  {
    "errors": [
      {
        "id": "D9221",
        "title": "MyFolder storage quota exceeded"
      }
    ]
  }
                
Show full