Resume an interrupted API upload
Resume multipart API uploads from recorded part numbers, retry missing chunks safely, and complete only after every expected 10 MiB part has landed.
Last reviewed
Dosya selects multipart upload above 50 MiB. A client can request it for a smaller nonempty file with force_multipart: true. Multipart sessions use 10 MiB parts and resume by uploaded part number, not by a raw byte offset.

Before you start
- Retain the
session_id, source file, declaredfile_size, and any content hash until completion succeeds. - Resume as the same Dosya user in the same workspace with the original session and unchanged file. The credential may be an authorized replacement API key; it does not have to be the key that initialized the session.
- An unstarted pending session becomes eligible for cleanup after 10 minutes, and multipart work can be retired after 24 hours without a landed part. The bucket’s seven-day multipart lifecycle is only a backstop, while complete or failed session rows can be pruned after seven days; status is the authority, not any promised expiry time.
Steps
- Call
GET /api/upload/session_id/status. Readstatus,size_bytes,part_size,total_parts,bytes_uploaded,uploaded_parts,has_multipart, andfile_idwhen completion has already produced one. - If status already represents completion and
file_idis present, verify that file instead of uploading more. For an active session, compute the missing integers from 1 throughtotal_parts. - Seek the local source to
(partNumber - 1) × part_sizeand upload only each missing part toPUT /api/upload/session_id/part/partNumber. The final part may be shorter than 10 MiB. - Treat a successful repeated part response with
already_uploaded: trueas confirmation, not duplication. Re-read status after transport failures because the server may have stored the part before the connection broke. - Send
POST /api/upload/session_id/completeonly when status lists every expected part. If it saysOnly N of M parts uploaded. Upload remaining parts before completing., return to the missing-part calculation. - Require the completion receipt’s file ID, then fetch its metadata and compare the final measured size or configured hash. Delete the local resume record only after that verification.

Expected result
Every expected part number appears in status, completion returns the stored file receipt, and a metadata read shows the finished object. Re-sending a recorded part does not add a second part.
Troubleshooting
Status is missing or expired. Start a new session only after confirming the old session can no longer be resumed.
The source file changed locally. Abort the resume. Part numbers from one byte sequence cannot safely finish another.
Completion reports missing parts. Trust uploaded_parts, upload only absent numbers, and call complete again. Do not translate bytes_uploaded into a byte-offset resume.
Related guides
Was this helpful?
Loading helpfulness results…
Voting saves a necessary ballot cookie for up to 180 days so you can change your answer.
Questions and replies
Ask about the steps in this guide. Questions are reviewed before publication.
Keep account details, credentials and private files out of public questions. Use private support for those.
Loading questions…
Sign in to your Dosya account to ask a question.