Sample - OpenAI API
POST/uploads/{upload_id}/cancel

Cancel an upload

Cancels an upload before its parts are complete. Use upload_id to identify the upload; no additional parts can be added after cancellation.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter
upload_idstringrequired
The identifier of the upload to cancel.

1 status code
200Returns the upload object with its status set to `cancelled`, along with its identifier, file details, and expiration timestamp.
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

Error handling

upload_id must identify the upload to cancel. The upload must not already be cancelled or otherwise closed, because parts cannot be added after the upload reaches the cancelled state.