POST/uploads/{upload_id}/complete

Complete an upload

Completes an upload by assembling its parts into a file that can be used on the platform. Supply the ordered part IDs and optionally an MD5 checksum; the total uploaded bytes must match the byte count specified when creating the upload. No more parts can be added after completion.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 2 body fields
upload_idstringrequired
The ID of the upload to complete.

Completion details for the upload. part_ids is required.

part_idsarray<string>required
The ordered list of Part IDs.
md5stringoptional
The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.

6 status codes
200Returns the completed upload object with status `completed` and a `file` property containing the created file object.
idstringrequired
The Upload unique identifier, which can be referenced in API endpoints.
created_atintegerrequired
The Unix timestamp (in seconds) for when the Upload was created.
filenamestringrequired
The name of the file to be uploaded.
bytesintegerrequired
The intended number of bytes to be uploaded.
purposestringrequired
The intended purpose of the file. [Please refer here](https://developers.openai.com/api/reference/resources/files#%28resource%29%20files%20%3E%20%28model%29%20file_object%20%3E%20%28schema%29%20%3E%20%28property%29%20purpose) for acceptable values.
statusstringrequired
The status of the Upload.
Allowed:pendingcompletedcancelledexpired
expires_atintegerrequired
The Unix timestamp (in seconds) for when the Upload will expire.
objectstringoptional
The object type, which is always "upload".
Allowed:upload
fileobjectoptional
The ready File object after the Upload is completed.
400Returned when the upload cannot be completed in its current state, its parts are invalid, or the uploaded size does not match the specified size.
errorobjectrequired
404Returned when the upload is not found.
errorobjectrequired
410Returned when the upload has expired.
errorobjectrequired
429Returned when upload requests are sent too frequently.
errorobjectrequired
500Returned when the upload could not be completed; retry the same request with the same part order and MD5 value.
errorobjectrequired

Error handling

A 400 is returned when the upload cannot be completed in its current state, its parts are invalid, or the uploaded size does not match the specified size. A 404 is returned when the upload is not found. A 410 is returned when the upload has expired, a 429 is returned when upload requests are sent too frequently, and a 500 is returned when the upload cannot be completed. The upload_id path parameter must identify the upload, and part_ids is required; order the IDs as the parts should be assembled.