How to Download YouTube Videos in n8n, Even on n8n Cloud

8 min read Summarize with Claude ChatGPT Gemini Perplexity
Download YouTube videos in an n8n workflow

Why n8n can't download YouTube videos on its own

Most n8n users try one of three things first, and each one stops short:

  • The YouTube node. It talks to the YouTube Data API, which manages channels, playlists, video details and uploads. The Data API never returns the video file itself.
  • yt-dlp in an Execute Command node. The Execute Command node isn't available on n8n Cloud. On self-hosted n8n it works, but your server's IP address is a data-centre address, and YouTube often answers those with "Sign in to confirm you're not a bot".
  • A scraper or "YouTube to MP4" site. They break without warning, rate-limit you, and rarely return captions or metadata in a form a workflow can use.

A download API moves the download off your n8n server. n8n only sends a URL and receives a link or a file, which is exactly what the HTTP Request node is built for.

What the workflow looks like

Five nodes cover a single video. You'll build them in this order:

  1. Trigger: a Manual Trigger to test, later a Google Sheets row, a form or a webhook.
  2. Start download: HTTP Request, POST /api/start-download. Returns a worker_id.
  3. Wait: pauses for the number of seconds the API suggests.
  4. Check status: HTTP Request, GET /api/download-status.
  5. Switch: downloaded goes on to save the file, error goes to your error handling, and anything else loops back to Wait.

You need a VideoDL API key from your dashboard. The free trial includes 100 videos.

Step 1: store your API key as a credential

Don't paste the key into each node. In n8n, create one credential and reuse it:

  1. In any HTTP Request node, set Authentication to Generic Credential Type, then Generic Auth Type to Header Auth.
  2. Create a new credential. Set Name to X-API-Key and Value to your API key.
  3. Save it as "VideoDL API". Both HTTP Request nodes below use it.

Step 2: start the download

Add an HTTP Request node and name it Start download:

  • Method: POST
  • URL: https://api.videodl.app/api/start-download
  • Authentication: the "VideoDL API" credential
  • Send Body: on. Body Content Type: JSON. Specify Body: Using JSON.

Use this as the body. The url comes from the incoming item, so the same node works for one video or a whole sheet:

JSON
{
  "url": "{{ $json.url }}",
  "resolution": "1080",
  "captions": true
}

For audio only, replace resolution with "audio_only": true, "audio_format": "mp3". Captions depend on your plan; see downloading YouTube subtitles by API for the language and format options.

Under Options, add Response and turn on Never Error. Without it, n8n stops the workflow on any non-2xx response, and you lose the error_code that tells you what to do. A successful start returns HTTP 202 with {"worker_id": "...", "status": "queued"}.

Step 3: wait, check, and loop until it's done

Add a Wait node after Start download:

  • Resume: After Time Interval
  • Wait Amount: {{ $json.retry_after || 10 }}
  • Wait Unit: Seconds

Then an HTTP Request node named Check status:

  • Method: GET
  • URL: https://api.videodl.app/api/download-status
  • Send Query Parameters: on, with worker_id set to the expression below
  • Options → Response → Never Error: on
n8n expression
{{ $('Start download').item.json.worker_id }}

The status moves through queued, downloading and downloaded, or ends in error. While a job runs, the response includes retry_after, so the Wait node above always waits as long as the API suggests.

Finish the loop with a Switch node:

  • Rule 1: {{ $json.status }} is equal to downloaded. This output goes to Step 4.
  • Rule 2: {{ $json.status }} is equal to error. This output goes to your error handling.
  • Turn on Fallback Output (Extra Output) and connect it back to the Wait node. That's the loop.

The status endpoint allows 300 checks a minute, so a loop like this never gets near the limit.

Step 4: save the file

When the status is downloaded, the response includes a download_url, the title, the resolution and an expires_in time. The link expires after about an hour, so save the file in the same run. You have two options.

Option A: send it through n8n

  1. Add an HTTP Request node, method GET, URL {{ $json.download_url }}. Under Options → Response, set Response Format to File. The file arrives in the binary field data.
  2. Add a Google Drive node with the Upload operation. Set Input Data Field Name to data and the file name to {{ $('Check status').item.json.title }}.mp4. An S3 node works the same way.

This is fine for short videos. Large files have to fit in n8n's memory, which is limited on n8n Cloud.

Option B: deliver straight to your storage

Connect Amazon S3, Google Cloud Storage, Cloudflare R2 or Google Drive once in the VideoDL dashboard. Finished files land there directly, and n8n only receives the status. Your workflow can then write the result to a sheet or send a Slack message, without handling gigabytes of video. This is the better choice for long videos and large batches. See downloading YouTube videos to S3, GCS and R2.

Download a whole list from Google Sheets

Put one YouTube URL per row in a column called url, then:

  1. Google Sheets node, Get Row(s), to read the list.
  2. Loop Over Items with a batch size of 1, so each video runs through Steps 2 to 4 on its own.
  3. At the end of each pass, a Wait node before the next item, so you start downloads at your plan's pace: at least 60 seconds on Starter, 20 seconds on Growth.
  4. A Google Sheets node, Update Row, to write the status, title or error back next to each URL.

Starting jobs faster than your plan allows doesn't speed anything up; the API answers with a 429 and asks you to wait. For thousands of videos, it's simpler to paste the list into the dashboard or use the bulk download service, which is also cheaper per video. More on pacing in bulk downloads within rate limits.

Handle errors without stopping the workflow

Errors come back as a number in error_code. Branch on the number with an If or Switch node after the error output:

CodeMeaningWhat the workflow should do
1, 2, 3Deleted, unavailable or privateWrite it to the sheet and move on
4, 60Geo-restrictedWrite it to the sheet and move on
55Too many requestsWait retry_after seconds, then send the same video again
52No stream matches your settingsLoosen the request, for example a lower resolution
51, 54Monthly video or bandwidth quota usedStop the workflow and notify yourself
40, 41Missing or invalid API keyCheck the credential

The full list is in YouTube download API error codes. Temporary download failures are retried on other servers before a job reports an error, so you don't need retry logic for those.

Using it from an n8n AI Agent

The same two calls work as a tool for n8n's AI Agent node. Add an HTTP Request Tool for start-download and another for download-status, with the same credential, and describe each one in plain words so the agent knows when to call it. Why this beats running yt-dlp inside an agent is covered in a YouTube download API for AI agents.

Use it on content you're allowed to use

Automation makes it easy to download a lot quickly. The API only fetches publicly available videos, and our acceptable use policy applies to workflows the same as to people: use videos you own, have permission for, or are licensed to use.

FAQ

Can n8n download YouTube videos?

Not on its own. The built-in YouTube node works with the YouTube Data API: channels, playlists, video details and uploads. It doesn't download video files. To download, call a download API from n8n's HTTP Request node.

Can I run yt-dlp in n8n Cloud?

No. The Execute Command node isn't available on n8n Cloud. On a self-hosted n8n you can run it, but downloads from a server IP address often hit YouTube's "Sign in to confirm you're not a bot" check.

How do I wait for a download to finish in n8n?

Start the job with an HTTP Request node, then loop: a Wait node, an HTTP Request that checks the status, and a Switch node. Send "downloaded" and "error" onward and loop everything else back to the Wait node.

How do I save a YouTube video to Google Drive with n8n?

Fetch the finished file with an HTTP Request node set to return a file, then upload it with the Google Drive node. For large files, connect Google Drive in the VideoDL dashboard instead, so files land there without passing through n8n.

How many videos can an n8n workflow download?

As many as your plan allows. Starter starts 1 new download a minute (200 videos a month) and Growth 3 a minute (500 a month). Add a Wait node between items to stay within the rate. Custom plans go higher.

Give your n8n workflows a YouTube download step

One API key, no proxies or cookies. Video, audio, captions and metadata from $12/month, starting with 100 free videos.