Vault
Guides

Resumable multipart uploads

Upload large files in parts, with retries and resume.

For large files, Vault supports multipart uploads: split the file into parts, upload them independently, then complete. The SDK does this automatically for bodies at or above 10 MiB — you just call upload().

// SDK: multipart is automatic for large, sized bodies
await storage.objects.upload({ bucket: "big", key: "video.mp4", body: file });

Manual control (REST)

If you're driving multipart yourself (e.g. resuming across sessions):

Create the upload

POST /v1/buckets/big/uploads
{ "key": "video.mp4", "contentType": "video/mp4" }
# -> { "uploadId": "..." }

Upload each part (≥ 5 MiB except the last)

PUT /v1/buckets/big/uploads/{uploadId}/parts/1?key=video.mp4
# body = part bytes  ->  { "partNumber": 1, "etag": "..." }

Complete with the collected parts

POST /v1/buckets/big/uploads/{uploadId}/complete
{ "key": "video.mp4", "parts": [{ "partNumber": 1, "etag": "..." }] }

To cancel, DELETE /v1/buckets/big/uploads/{uploadId}?key=video.mp4.

Every part except the final one must be at least 5 MiB, per R2's multipart rules.

On this page