YouTube Download API Error Codes, and How to Handle Each One
Where errors show up
There are two places. Request errors come straight back from POST /api/start-download with an HTTP error status, before any job exists. Video errors come later, from GET /api/download-status, as "status": "error" once the job has tried and failed. Both use the same shape:
{
"error": "Video is private",
"error_code": 3,
"error_label": "VIDEO_PRIVATE",
"error_type": "video_unavailable"
}
Request errors can also include field, hint, plan_limit or retry_after. Messages may be reworded over time. Codes won't, so build your logic on error_code.
Video errors: skip the video
These describe the video itself. Retrying won't change anything.
| Code | Label | Meaning |
|---|---|---|
| 1 | VIDEO_DELETED | The video has been removed |
| 2 | VIDEO_UNAVAILABLE | The video is unavailable |
| 3 | VIDEO_PRIVATE | The video is private |
| 4 | VIDEO_GEO_RESTRICTED | Blocked in the regions we download from |
| 5 | VIDEO_LIVE | Currently live. Try again after the stream ends |
| 6 | VIDEO_AGE_RESTRICTED | Age-restricted |
| 7 | VIDEO_MEMBER_ONLY | For channel members only |
| 8 | VIDEO_PREMIUM_ONLY | Requires YouTube Premium |
| 9 | VIDEO_UPCOMING | A scheduled stream that hasn't started |
| 10 | VIDEO_TOO_LONG | Too long to download |
| 11 | VIDEO_SIGN_IN | YouTube requires sign-in for this video |
| 12 | VIDEO_EMBED_DISABLED | Playback on other websites is disabled |
| 13 | VIDEO_LIVE_ENDED | This live event has ended |
| 31 | ERR_DURATION_EXCEEDED | Longer than your plan's duration limit |
| 52 | ERR_FORMAT_UNAVAILABLE | No stream matches your resolution, codec, container or size settings |
| 60 | ERR_NO_REGION | Geo-blocked everywhere we can download from |
Code 52 is the one you can often fix: loosen the request. For example, add "any" to the end of video_codec, or raise the size limit.
Slow down: wait and retry
| Code | HTTP | Meaning | Do this |
|---|---|---|---|
| 55 | 429 | Too many requests for your plan | Wait retry_after seconds, then retry |
| 56 | job status | Service busy, no download server free | Request the video again in a few seconds |
| 57 | 503 | API temporarily on hold | Retry later |
Codes 20 (download server blocked) and 23 (retries exhausted) are related. When a download server is blocked, the job moves to another server automatically, up to 3 attempts. You only see 23 if all attempts failed.
Stop: fix the account or the request
| Code | HTTP | Meaning |
|---|---|---|
| 40 | 401 | Missing API key. Send it in X-API-Key |
| 41 | 403 | Invalid API key |
| 51 | 429 | Monthly video quota used |
| 54 | 429 | Monthly bandwidth used |
| 53 | 400 | Not a YouTube video URL. Playlists, channels and /live/ links are rejected |
| 58 | 403 | Feature not on your plan, such as captions, 4K or a custom format |
| 59 | 403 | Account suspended |
| 64 | 403 | Plan expired |
| 65 | 400 | Invalid parameter. The response names the field and lists the accepted ones |
| 66 | 403 | Above your plan's limits, for example file size or duration |
| 67 | 404 | Job not found, or older than the retention period |
| 69 | 410 | Download link expired. Request the video again |
Partial results
Extras like captions and comments don't fail the whole job. If one fails, you still get the video, with "partial": true and a warning:
| Code | Meaning |
|---|---|
| 70 | Caption requests were rate-limited |
| 71 | Captions not available in a language you asked for |
| 72 | Comments unavailable |
| 73 | Live chat unavailable |
| 74 | Another extra failed |
The exception is skip_download: when the extras are all you asked for, a failed extra fails the job.
Handling it in code
This function downloads one video and sorts every outcome into one of the three groups. We tested each branch against a mock of the API: rate limits wait and retry, private videos and bad URLs are skipped, missing captions come back as partial, and an exhausted quota stops the batch.
import time
import requests
API = "https://api.videodl.app"
SKIP_VIDEO = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 30, 31, 52, 53, 60}
WAIT_AND_RETRY = {55, 56}
STOP_ALL = {40, 41, 51, 54, 57, 58, 59, 64, 66}
def download(url, api_key, **options):
headers = {"X-API-Key": api_key}
while True:
r = requests.post(f"{API}/api/start-download", headers=headers,
json={"url": url, **options}, timeout=30)
body = r.json()
if r.status_code == 202:
break
code = body.get("error_code")
if code in WAIT_AND_RETRY:
time.sleep(body.get("retry_after", 10))
continue
if code in STOP_ALL:
raise RuntimeError(f"Stop the batch: {code} {body.get('error')}")
return {"url": url, "skipped": True, "error_code": code, "error": body.get("error")}
worker_id = body["worker_id"]
while True:
job = requests.get(f"{API}/api/download-status", headers=headers,
params={"worker_id": worker_id}, timeout=30).json()
if job["status"] == "downloaded":
return {"url": url, "download_url": job["download_url"],
"partial": job.get("partial", False), "warnings": job.get("warnings", [])}
if job["status"] == "error":
if job.get("error_code") in SKIP_VIDEO:
return {"url": url, "skipped": True, "error_code": job["error_code"],
"error": job.get("error_label")}
raise RuntimeError(f"Failed after retries: {job.get('error_code')} {job.get('error')}")
time.sleep(job.get("retry_after", 3))
In a batch, catch the RuntimeError to stop cleanly, and log the skipped videos with their codes so you can report why each one was missed.
FAQ
What does error code 55 mean in the VideoDL API?
Too many requests for your plan's rate limit. The response includes retry_after, the number of seconds to wait. Wait that long and send the request again.
Should I retry a VIDEO_PRIVATE or VIDEO_DELETED error?
No. Codes 1 to 13 describe the video itself, so retrying won't help. Skip the video and log the code.
What does ERR_FORMAT_UNAVAILABLE (52) mean?
No stream matched your resolution, codec, container or size settings. Loosen the request, for example by adding "any" to the end of video_codec or raising the size limit.
Why is my download marked partial?
An extra, such as captions in one language, failed while the main file succeeded. The warning gives a code from 70 to 74 explaining which extra failed.
Do I need to retry failed downloads myself?
Not for temporary failures. Jobs are retried automatically on other download servers, up to 3 attempts. You only need to handle rate limits on new requests and the final error codes.
Downloads that tell you what went wrong
Numbered errors, automatic retries on other servers, and partial results instead of failed jobs. From $12/month.
Keep reading
All articles →
Run bulk downloads within rate limits
Send hundreds of YouTube downloads through an API without 429 errors: plan by rate limit, queue locally, poll politely and log results. Tested Python script.
YouTube download API for AI agents
AI agents running yt-dlp hit "Sign in to confirm you're not a bot" on cloud servers. Give your agent a download API instead: one call in, a file link out.
YouTube "Video unavailable": what it means
YouTube says Video unavailable? Match the exact message to its cause: private, removed, region-blocked, or a rate limit from downloading. Then the fix for each.