DEV Community

Cover image for How to Auto-Generate YouTube Thumbnails with n8n (Step-by-Step)
Aldin Kozica
Aldin Kozica

Posted on • Originally published at thumbapi.dev

How to Auto-Generate YouTube Thumbnails with n8n (Step-by-Step)

Thumbnail creation is the last manual step in most content pipelines. You write the video title, edit the footage, write the description — and then you open Canva or Photoshop and spend 20 minutes designing an image you could have generated in under 30 seconds.

This guide shows you how to close that gap entirely. By the end, you will have an n8n workflow that detects new YouTube uploads, sends the video title to ThumbAPI, and saves a production-ready thumbnail to Google Drive automatically. No design software, no manual steps.

The guide is written for developers and technically comfortable creators. If you want a higher-level overview of content automation, the developer's guide to automating content creation covers the broader picture. This post is the n8n-specific deep dive.

What You Are Building

The core workflow is:

  1. Detect a new YouTube video (via RSS or webhook)
  2. Extract the video title
  3. Call ThumbAPI with the title and target format
  4. Receive a base64-encoded WebP thumbnail
  5. Upload the thumbnail to Google Drive (or your CMS)
  6. Optionally notify your team via Slack

This workflow runs entirely inside n8n. You can self-host it on your own server or use n8n Cloud — the node configuration is identical either way.

Prerequisites

Before starting, you need:

  • An n8n instance (self-hosted or n8n Cloud)
  • A ThumbAPI account with an API key — the free tier is enough to test
  • A YouTube channel ID (find it in YouTube Studio under Settings → Channel → Advanced settings)
  • A Google Drive account if you want to use the Drive destination in the examples

Step 1: Store Your ThumbAPI Key as a Credential

Never put API keys directly into HTTP Request nodes. n8n's credential manager encrypts them and keeps them out of your workflow JSON exports.

Go to Settings → Credentials → Add Credential and choose Header Auth:

Name:         ThumbAPI
Header Name:  x-api-key
Header Value: YOUR_THUMBAPI_KEY
Enter fullscreen mode Exit fullscreen mode

Save the credential. You will select it in every HTTP Request node that talks to ThumbAPI.

Why x-api-key? ThumbAPI authenticates via the x-api-key header, not a Bearer token. Make sure the header name matches exactly.

Step 2: Create the Workflow and Add a Trigger

Open n8n and click New Workflow. The trigger node determines what kicks off thumbnail generation. The two most useful options for YouTube content are:

Option A: RSS Feed Trigger (Recommended for YouTube)

YouTube publishes an RSS feed for every channel. The RSS Feed Read node polls it on a schedule and fires when a new video appears.

Node:          RSS Feed Read
Feed URL:      https://www.youtube.com/feeds/videos.xml?channel_id=YOUR_CHANNEL_ID
Poll Every:    15 minutes
Enter fullscreen mode Exit fullscreen mode

Replace YOUR_CHANNEL_ID with your actual channel ID. n8n will pass the video title as $json.title to downstream nodes.

Option B: Webhook Trigger (For CMS or Custom Pipelines)

If you publish video metadata to a CMS before uploading to YouTube, use a Webhook trigger instead. Your CMS fires a POST request to the n8n webhook URL when content is ready.

Node:     Webhook
Method:   POST
Path:     /new-video
Enter fullscreen mode Exit fullscreen mode

The webhook payload should include at minimum a title field. Everything else is optional.

Step 3: Add the ThumbAPI HTTP Request Node

Click + after your trigger and add an HTTP Request node. This is the node that calls ThumbAPI to generate the thumbnail.

Configure it as follows:

Method:              POST
URL:                 https://api.thumbapi.dev/v1/generate
Authentication:      Generic Credential Type → Header Auth
Credential:          ThumbAPI (the one you created in Step 1)
Send Body:           true
Body Content Type:   JSON
Enter fullscreen mode Exit fullscreen mode

Set the JSON body:

{
  "title": "{{ $json.title }}",
  "format": "youtube",
  "imageStyle": "faceless",
  "outputFormat": "webp"
}
Enter fullscreen mode Exit fullscreen mode

The {{ $json.title }} expression pulls the video title from the trigger output. If your trigger uses a different field name, adjust the expression accordingly.

Format and Style Options

Parameter Options
format youtube, instagram, x, blogpost, linkedin
imageStyle faceless, with-image, with-logo
outputFormat webp (default), png

For YouTube, faceless generates text-and-graphic designs optimized for click-through. If you have uploaded a profile photo to the ThumbAPI dashboard, switch to with-image to include your face in every generated thumbnail.

Step 4: Test the HTTP Request Node

Before building out the rest of the workflow, test this node in isolation. Click Execute Node. If the request succeeds, you will see the response in n8n's output panel:

{
  "image": "data:image/webp;base64,UklGR...",
  "format": "youtube",
  "outputFormat": "webp",
  "dimensions": {
    "width": 1280,
    "height": 720
  }
}
Enter fullscreen mode Exit fullscreen mode

The image field is the full base64-encoded WebP. A typical YouTube thumbnail is 50–150 KB encoded, which n8n handles without issues.

If the node fails, check:

  • The credential header name is exactly x-api-key (not Authorization)
  • The API key is correct and active in your ThumbAPI dashboard
  • The title field in your request body is not empty

Step 5: Decode the Image and Upload to Google Drive

The base64 string needs to be converted into n8n binary data before you can upload it. Add a Code node between the HTTP Request node and your destination:

const base64String = $input.item.json.image;

const base64Data = base64String.includes(',')
  ? base64String.split(',')[1]
  : base64String;

const outputFormat = $input.item.json.outputFormat || 'webp';

return {
  json: {
    title: $input.item.json.title,
    format: $input.item.json.format,
    outputFormat,
  },
  binary: {
    data: {
      data: base64Data,
      fileName: `thumbnail-${Date.now()}.${outputFormat}`,
      mimeType: `image/${outputFormat}`,
    },
  },
};
Enter fullscreen mode Exit fullscreen mode

This blogpost image is generated by ThumbAPI

Top comments (0)