Cancel an upload
cancel_uploadDELETE/v1/uploads/{uploadId}Beta
Cancels an open upload and deletes the parts sent so far.
Beta. This endpoint is supported and can gain new fields. If a change would break your code, we tell you before it takes effect and list it in the changelog.
About
Use it when you will not finish an upload: its parts are deleted and it no longer counts among your uploads in progress, so a new one can start. An upload that is being completed cannot be cancelled. Cancelling an upload that was already completed, cancelled or removed answers not found.
Example use
A script that finds out the wrong file is being sent cancels the open upload. This removes the parts already sent, so the script can open a new upload with the right file.
Endpoint
DELETE https://api.gpt-video.com/v1/uploads/{uploadId}- Scope
clips:write. - Rate limit 60 requests a minute for each key and 120 for each account, shared by every
writecall. See rate limits. - No
Idempotency-Key.
Parameters
Path
| Name | Type | Required | Description |
|---|---|---|---|
uploadId | string | Required | The id of the upload, as create_upload (POST /v1/uploads) returned it. Matches ^upl_[0-9a-f]{20}$. |
Request
Cancel an upload.
curl -X DELETE "https://api.gpt-video.com/v1/uploads/upl_5d2a8f1e6c3b4079e0a1" \
-H "Authorization: Bearer $GPT_VIDEO_API_KEY"const res = await fetch("https://api.gpt-video.com/v1/uploads/upl_5d2a8f1e6c3b4079e0a1", {
method: "DELETE",
headers: {
"Authorization": `Bearer ${process.env.GPT_VIDEO_API_KEY}`,
},
});
const data = await res.json();
console.log(data);import os
import requests
r = requests.delete(
"https://api.gpt-video.com/v1/uploads/upl_5d2a8f1e6c3b4079e0a1",
headers={
"Authorization": f"Bearer {os.environ['GPT_VIDEO_API_KEY']}",
},
)
data = r.json()
print(data){
"method": "tools/call",
"params": {
"name": "cancel_upload",
"arguments": {
"uploadId": "upl_5d2a8f1e6c3b4079e0a1"
}
}
}Response
A successful call answers HTTP 200.
Response example
{
"uploadId": "upl_5d2a8f1e6c3b4079e0a1",
"cancelled": true
}All response fields
| Name | Type | Required | Description |
|---|---|---|---|
uploadId | string | Required | The id of the upload that was cancelled. |
cancelled | boolean | Required | Always true: a cancel that could not happen is an error. Always true. |
More examples
Cancel an upload that does not exist
DELETE /v1/uploads/upl_3b6f9e2d7c0a4e51a8d9
{
"error": {
"code": "NOT_FOUND",
"message": "Upload upl_3b6f9e2d7c0a4e51a8d9 not found",
"hint": "Check the id. An id that belongs to another account is not found either.",
"requestId": "req_2e8b4d0f6a3c9e1b5d7f0a4c"
}
}Errors
| Code | Status | When | What to do |
|---|---|---|---|
NOT_FOUND | 404 | Cancel an upload that does not exist | Change the request, then send it again. |
CONFLICT | 409 | The upload is being completed at that moment. Wait for complete_upload (POST /v1/uploads/{uploadId}/complete) to answer, then cancel the upload if it is still open. | Read the resource again, then decide. Do not send the same request again. |
Every call can also answer these errors. VALIDATION_FAILED, UNKNOWN_PARAMETER, UNAUTHORIZED, SCOPE_MISSING, RATE_LIMITED, INTERNAL, UNAVAILABLE.
Cost
No credits are used.
Related operations
create_upload(POST /v1/uploads) Start an uploadget_upload(GET /v1/uploads/{uploadId}) Get an uploadcomplete_upload(POST /v1/uploads/{uploadId}/complete) Complete an upload
Questions
Is a cancelled upload kept anywhere?
No. Its parts are deleted at once and it cannot be resumed; start a new upload to send the file again.
Why was my cancel refused with a conflict?
The upload was being completed at that moment. Wait for complete_upload (POST /v1/uploads/{uploadId}/complete) to answer: the upload then either became an asset or is still open and can be cancelled.