YouTube Downloader API: Get an MP4 or MP3 Link in One Call (2026)
Send a YouTube URL, get back a direct MP4 or MP3 download link. cURL, Python and Node examples, every format from 360p to 1080p and 320 kbps MP3, trimming, error codes, and what it costs.
Vid Kraken · Updated October 27, 2026
You want users to paste a YouTube link into your product and get the video or the audio back. You don't want to run yt-dlp, rent proxies, export cookies, or patch anything the next time YouTube changes.
That's what a YouTube downloader API is for: you send a URL, it sends back a link to the file.
Short version: send POST /download with a YouTube URL and a format (1080, 720, 480, 360, audio or audio-mp3). The response already contains the downloadUrl, so one call gets you the link. The link points at our CDN, so your users download from us, not from YouTube. You pay only for bandwidth, failed downloads are free, and you get a machine-readable error code when a video can't be downloaded.
What a YouTube downloader API does
Downloading one YouTube video on your laptop is easy. Doing it for thousands of users from a server is not:
- YouTube blocks server traffic. Datacenter IPs get "Sign in to confirm you're not a bot" and 403 errors. Getting past that takes residential proxies, cookies, proof-of-origin (PO) tokens and a JavaScript runtime, and they all need maintaining.
- YouTube changes often. A yt-dlp release that worked last month can stop working this week.
- Formats are messy. 1080p arrives as separate video and audio streams that have to be merged. Audio comes as Opus or AAC, not MP3.
A downloader API takes all of that on. You call one endpoint. It deals with YouTube, merges and converts the file, stores it, and gives you a link.
Authentication
Create an account and copy your API key from the dashboard. Send it on every request:
Authorization: Bearer YOUR_API_KEY
Quick start
One request. The response has the download link:
curl -X POST https://vidkraken.com/api/v2/download \
-H "Authorization: Bearer $VIDKRAKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtu.be/dQw4w9WgXcQ", "format": "audio-mp3"}'
# {"jobId": "69cfc45e...", "title": "...", "duration": 213,
# "status": "IN_QUEUE", "downloadUrl": "https://..."}import os, requests
r = requests.post(
"https://vidkraken.com/api/v2/download",
headers={"Authorization": f"Bearer {os.environ['VIDKRAKEN_API_KEY']}"},
json={"url": "https://youtu.be/dQw4w9WgXcQ", "format": "audio-mp3"},
)
print(r.json()["downloadUrl"])const r = await fetch("https://vidkraken.com/api/v2/download", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.VIDKRAKEN_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: "https://youtu.be/dQw4w9WgXcQ", format: "audio-mp3" }),
});
console.log((await r.json()).downloadUrl);The link is the file's permanent CDN address, so you can store it or hand it to your user straight away. It serves the file as soon as the file is ready, which takes seconds for a short video. If you need to know exactly when it's ready, or how big the file is, use the flow below.
For long videos and batches: submit, then poll or get a webhook
curl -X POST https://vidkraken.com/api/v2/download \
-H "Authorization: Bearer $VIDKRAKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtu.be/dQw4w9WgXcQ", "format": "1080"}'
# {"jobId": "69cfc45e...", "title": "...", "duration": 213, "status": "IN_QUEUE"}
curl https://vidkraken.com/api/v2/download/69cfc45e... \
-H "Authorization: Bearer $VIDKRAKEN_API_KEY"
# {"status": "COMPLETED", "downloadUrl": "https://...", "fileSize": 32240544, ...}import os, time, requests
API = "https://vidkraken.com/api/v2"
HEADERS = {"Authorization": f"Bearer {os.environ['VIDKRAKEN_API_KEY']}"}
def download(url, fmt="1080"):
job = requests.post(f"{API}/download", headers=HEADERS,
json={"url": url, "format": fmt}).json()
while True:
time.sleep(3)
s = requests.get(f"{API}/download/{job['jobId']}", headers=HEADERS).json()
if s["status"] == "COMPLETED":
return s["downloadUrl"]
if s["status"] == "FAILED":
raise RuntimeError(s.get("errorCode") or "FAILED")
print(download("https://youtu.be/dQw4w9WgXcQ", "audio-mp3"))const API = "https://vidkraken.com/api/v2";
const headers = {
Authorization: "Bearer " + process.env.VIDKRAKEN_API_KEY,
"Content-Type": "application/json",
};
async function download(url, format = "1080") {
const job = await fetch(API + "/download", {
method: "POST",
headers,
body: JSON.stringify({ url, format }),
}).then((r) => r.json());
while (true) {
await new Promise((r) => setTimeout(r, 3000));
const s = await fetch(API + "/download/" + job.jobId, { headers }).then((r) => r.json());
if (s.status === "COMPLETED") return s.downloadUrl;
if (s.status === "FAILED") throw new Error(s.errorCode ?? "FAILED");
}
}
console.log(await download("https://youtu.be/dQw4w9WgXcQ", "audio-mp3"));The first response already has the title and duration, so you can show them while the file is prepared. Rather not poll? Pass a webhookUrl and we POST the finished job to you. Up to 100 downloads can run at once per account.
Choosing quality and format
format | You get | Good for |
|---|---|---|
1080, 720, 480, 360 | MP4 at that resolution (H.264 video, AAC audio) | Video imports, editing, playback anywhere |
audio | The best audio YouTube serves, untouched: usually M4A (AAC) or WebM (Opus), about 130 to 160 kbps | Transcription and speech models, highest fidelity |
audio-aac | AAC in an M4A file | Pipelines calibrated on AAC |
audio-mp3 | MP3 at 320 kbps | Players, podcasts, anything that expects .mp3 |
A few details that save support tickets:
- Lower-resolution videos still work. Ask for
1080on a 720p video and you get 720p.actualFormaton the finished job tells you what was delivered. - Shorts are handled. A vertical Short's 1080p is 1080x1920, and that's what
1080gets you. - Clips. Add
startTimeandendTimein seconds to get just that part. - Languages. Add
language(for examplees) to get a dubbed audio track. See multi-language audio. - 4K. Up to 4K is available on request. Email us.
When a video can't be downloaded
Some videos can't be downloaded by anyone: private, deleted, age-restricted, region-locked, members-only, still live. A failed job tells you which, with a stable errorCode such as AGE_RESTRICTED, GEO_RESTRICTED or VIDEO_NOT_FOUND, not a free-text message you have to parse. Failed downloads are never charged. The error codes guide lists every code with a message to show your users.
To check before you download, POST /info returns the title, duration and region restrictions without downloading anything. See the metadata API guide.
Pricing
You pay for bandwidth only, counted at the actual file size with a 20 MB minimum per download. There are no per-download fees, and failures, polling and webhooks are free.
- Free to start, no credit card.
- Plans from $99 a month for 400 GB ($0.25 per GB), down to $0.15 per GB on Scale.
A 4-minute 1080p video is around 30 to 60 MB, and a 4-minute 320 kbps MP3 is about 10 MB (billed as 20 MB). See pricing.
yt-dlp, or an API?
If you download a few videos for yourself, use yt-dlp. It's free and excellent. Our yt-dlp guide covers it.
If downloads are a feature of your product, the question is who keeps it working. Running yt-dlp in production means proxies, cookies, PO tokens, updates and on-call when YouTube changes something. An API makes that our problem. Vid Kraken's success rate over the last 30 days is above 99.99%, and the live reliability page shows the current number. More on the trade-off in yt-dlp alternatives.
Try Vid Kraken
Paste a YouTube URL and get a direct download link.
Paste a link. See it work.
Paste a YouTube link, pick a format, and hit download.
A YouTube URL in, a download link out.
MP4 up to 1080p, MP3 at 320 kbps, or untouched audio. No yt-dlp, no proxies, no cookies to maintain, and you only pay for what you download.
Frequently asked questions
Is there an API where I send a YouTube URL and get back a direct MP4 or MP3 link?+
Yes. Vid Kraken takes a YouTube URL and a format (1080, 720, 480 or 360 for MP4, audio-mp3 for a 320 kbps MP3, or audio for the original stream) and returns a direct link to the file on its CDN. The link comes back in the same response as the request, so it takes one call.
What's the best YouTube download API for a SaaS app?+
Look for three things: it handles bot detection, proxies and YouTube changes for you; it returns a machine-readable error code when a video can't be downloaded; and it doesn't charge for failures. Vid Kraken does all three and publishes its live success rate. Self-hosted yt-dlp is free but needs ongoing maintenance in production.
How do I embed YouTube to MP3 in my product without hosting anything?+
Call Vid Kraken's API with format audio-mp3 and you get a link to a 320 kbps MP3 on our CDN. There's nothing to host: no yt-dlp, no ffmpeg, no proxies, no storage. See also the YouTube to MP3 API page.
Does the API handle YouTube's bot detection?+
Yes. Bot detection, proxies and YouTube's changes are handled on our side, so your app never sees 'Sign in to confirm you're not a bot' or 403 errors. When a video genuinely can't be downloaded, you get a specific error code instead.
Can I get the video title and duration with the download?+
Yes. The title and duration come back in the first response, before the file is ready, and the finished download adds the file size. POST /info returns the same metadata without downloading anything.
What resolutions does the YouTube download API support?+
1080p, 720p, 480p and 360p as MP4, plus audio-only as MP3, M4A or the original stream. Up to 4K is available on request. If a video doesn't offer the resolution you ask for, you get the best one below it.
How much does a YouTube download API cost?+
Vid Kraken charges for bandwidth only: from $0.25 per GB on the $99 plan down to $0.15 per GB on Scale. There are no per-download fees and failed downloads are free. It's free to start with no credit card.