Skip to content
Create a key

Paste a key to use it in the examples on these pages. The key stays in this browser tab. These pages never send it anywhere.

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

Code
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 write call. See rate limits.
  • No Idempotency-Key.

Parameters

Path

NameTypeRequiredDescription
uploadIdstringRequiredThe id of the upload, as create_upload (POST /v1/uploads) returned it. Matches ^upl_[0-9a-f]{20}$.

Request

Cancel an upload.

Request example
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

HTTP 200
{
  "uploadId": "upl_5d2a8f1e6c3b4079e0a1",
  "cancelled": true
}
All response fields
NameTypeRequiredDescription
uploadIdstringRequiredThe id of the upload that was cancelled.
cancelledbooleanRequiredAlways 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

HTTP 404
{
  "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

CodeStatusWhenWhat to do
NOT_FOUND404Cancel an upload that does not existChange the request, then send it again.
CONFLICT409The 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.

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.

View as Markdown