Download a Sume video with curl: send the key to /content

The docs' curl call for GET /v1/videos/{id}/content sends the API key and follows redirects. A short script saves the MP4 and prints the 409 reason on failure.

4 min readSume
All posts

Call GET /v1/videos/{id}/content?index=0 with your Authorization header, follow redirects with -L, and write the body to a file. The completed poll response lists unsigned_urls, and for a Sume job those point at this same content route. Sume's docs show the content call with the key, so send it.

Why send the key to an unsigned URL

The docs are not uniform here. Their curl example for /content includes the key. Their Python example downloads unsigned_urls[0] with a bare request. I could not confirm from the docs that a keyless download always works, and a header costs nothing, so the script sends it. curl does not forward the header to a different host after a redirect.

Responses from GET /v1/videos/{id}/content (Sume docs, read 2026-10-07)
StatusCodeWhat to do
200noneThe body is the video
409job_not_completedRetryable; keep polling GET /v1/videos/{id}
409job_failedNot retryable; the message carries the public reason
404not_foundWrong id, or a job another member created

The script

It saves to video.mp4, and on any non-200 prints the saved error body, which is JSON, so check the status before opening the file. index defaults to 0; use a higher value only for a model that returns more than one video.

JOB=job_123
code=$(curl -sS -L -o video.mp4 -w '%{http_code}' \
  "https://api.sume.com/v1/videos/$JOB/content?index=0" \
  -H "Authorization: Bearer $SUME_API_KEY")
if [ "$code" != 200 ]; then
  cat video.mp4; echo   # 409 job_not_completed: keep polling. 409 job_failed: stop.
  exit 1
fi

What it does not do

It does not poll. Get the id and wait for completed first, using the polling URL from the submit response. The docs' sample sleeps 30 seconds between polls, and status shows cancelled with two Ls on this route but canceled on /v1/jobs.

A saved MP4 is your copy. Store the job id as well, since a later read of the job is the way to recover if a download fails halfway.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume