ThumbAPI logoThumbAPI
Automation

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

Aldin Kozica
Aldin Kozica
9 min read
How to Auto-Generate YouTube Thumbnails with n8n (Step-by-Step) — ThumbAPI Blog

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

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

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

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

Set the JSON body:

{
  "title": "{{ $json.title }}",
  "format": "youtube",
  "imageStyle": "faceless",
  "outputFormat": "webp"
}

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

ParameterOptions
formatyoutube, instagram, x, blogpost, linkedin
imageStylefaceless, with-image, with-logo
outputFormatwebp (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
  }
}

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}`,
    },
  },
};

After this node, add a Google Drive node:

Operation:        Upload File
File Name:        {{ $json.title }}.webp
Binary Property:  data
Parent Folder:    YouTube Thumbnails

The thumbnail is now in Google Drive with the video title as the filename.

Step 6: Add a Slack Notification (Optional)

If you work with a team, a Slack notification makes the workflow visible. Add a Slack node after the Drive upload:

Resource:   Message
Operation:  Send
Channel:    #thumbnails
Text:       Thumbnail generated for: {{ $json.title }}
            Drive: {{ $json.webViewLink }}

The workflow now fully handles detection, generation, upload, and notification without any manual intervention.

Complete Workflow JSON

Here is the complete workflow you can import directly into n8n. Replace YOUR_CHANNEL_ID and YOUR_GOOGLE_DRIVE_FOLDER_ID before importing, and attach your ThumbAPI Header Auth credential to the HTTP Request node after import.

{
  "name": "YouTube Thumbnail Automation — ThumbAPI",
  "nodes": [
    {
      "parameters": {
        "url": "https://www.youtube.com/feeds/videos.xml?channel_id=YOUR_CHANNEL_ID",
        "pollTimes": { "item": [{ "mode": "everyMinute", "value": 15 }] }
      },
      "name": "RSS Feed — YouTube Channel",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [450, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.thumbapi.dev/v1/generate",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"title\": \"{{ $json.title }}\",\n  \"format\": \"youtube\",\n  \"imageStyle\": \"faceless\",\n  \"outputFormat\": \"webp\"\n}"
      },
      "name": "ThumbAPI — Generate Thumbnail",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [670, 300],
      "credentials": {
        "httpHeaderAuth": { "name": "ThumbAPI" }
      }
    },
    {
      "parameters": {
        "jsCode": "const base64String = $input.item.json.image;\nconst base64Data = base64String.includes(',') ? base64String.split(',')[1] : base64String;\nconst outputFormat = $input.item.json.outputFormat || 'webp';\n\nreturn {\n  json: {\n    title: $input.item.json.title,\n    format: $input.item.json.format,\n    outputFormat\n  },\n  binary: {\n    data: {\n      data: base64Data,\n      fileName: `thumbnail-${Date.now()}.${outputFormat}`,\n      mimeType: `image/${outputFormat}`\n    }\n  }\n};"
      },
      "name": "Decode Base64 Image",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [890, 300]
    },
    {
      "parameters": {
        "operation": "upload",
        "name": "{{ $json.title }}.webp",
        "parents": { "folderId": "YOUR_GOOGLE_DRIVE_FOLDER_ID" },
        "binaryPropertyName": "data"
      },
      "name": "Google Drive — Upload",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [1110, 300]
    }
  ],
  "connections": {
    "RSS Feed — YouTube Channel": {
      "main": [[{ "node": "ThumbAPI — Generate Thumbnail", "type": "main", "index": 0 }]]
    },
    "ThumbAPI — Generate Thumbnail": {
      "main": [[{ "node": "Decode Base64 Image", "type": "main", "index": 0 }]]
    },
    "Decode Base64 Image": {
      "main": [[{ "node": "Google Drive — Upload", "type": "main", "index": 0 }]]
    }
  }
}

Handling Multiple Platforms at Once

If you distribute the same content across YouTube, Instagram, and your blog, you can generate all three thumbnails in parallel from a single trigger. Add a Code node that fans out the request:

const title = $input.first().json.title;
const formats = ['youtube', 'instagram', 'blogpost'];

return formats.map((format) => ({
  json: { title, format },
}));

Connect this to a Loop Over Items node, then the HTTP Request node. Each iteration calls ThumbAPI with a different format, producing three platform-optimized thumbnails from one video title.

Platform dimensions ThumbAPI generates:

FormatDimensions
youtube1280 × 720
instagram1080 × 1080
blogpost1200 × 630
x1200 × 675
linkedin1200 × 627

Cleaning Titles Before Generation

YouTube titles sometimes contain HTML entities, emoji, or other characters that render poorly on thumbnails. Add a Code node before the HTTP Request to sanitize the input:

const title = $input.first().json.title;

const clean = title
  // Decode common HTML entities
  .replace(/&/g, '&')
  .replace(/&lt;/g, '<')
  .replace(/&gt;/g, '>')
  .replace(/&#39;/g, "'")
  .replace(/&quot;/g, '"')
  // Strip emoji (optional — depends on your thumbnail style)
  .replace(/[\u{1F600}-\u{1F64F}]/gu, '')
  // Trim to 80 characters for clean thumbnail text
  .trim()
  .substring(0, 80);

return [{ json: { ...$input.first().json, title: clean } }];

Titles over 80 characters tend to overflow on the generated thumbnail. ThumbAPI handles truncation internally, but providing a clean title gives the layout engine more room to lay out the design well.

Error Handling for Production Workflows

Automated workflows break silently if you do not add error handling. These are the minimum safeguards for a production n8n thumbnail pipeline:

Enable "Continue On Fail" on the HTTP Request node. If ThumbAPI returns an error for one item in a batch, the workflow continues processing the rest rather than halting entirely.

Add retry logic. In the HTTP Request node settings, enable Retry On Fail with 2 retries and a 3-second interval. This handles transient network issues without any manual intervention.

Add a Wait node between batch items. If you are processing several videos at once, add a Wait node (1–2 seconds) between iterations to avoid hitting rate limits on the ThumbAPI side.

Route errors to a Slack notification. Connect the error output of the HTTP Request node to a Slack node that posts the failed item's title to a #thumbnail-errors channel. You want to know about failures before they affect your publishing schedule.

Why n8n Over Other Automation Tools

n8n's main advantages for thumbnail automation come down to control and cost:

Self-hosted option. Your API keys and content titles stay on your own infrastructure. For teams with data governance requirements, this matters.

No per-execution fees. Self-hosted n8n has no task-based pricing. The only cost is your ThumbAPI plan and whatever server hosts n8n.

Code nodes. The ability to run arbitrary JavaScript between nodes makes title cleaning, conditional logic, and data transformation straightforward — things that require workarounds in purely visual automation tools.

Full request visibility. You can inspect the exact request body sent to ThumbAPI and the exact response received. When something goes wrong, debugging takes minutes instead of hours.

If you prefer a no-code setup, the same thumbnail automation pattern works in Make.com and Zapier, with slightly less flexibility in the transformation steps.

Getting Started

The fastest path from zero to working thumbnail automation:

  1. Sign up for ThumbAPI — the free tier gives you generations to test the integration
  2. Add your API key as a Header Auth credential in n8n
  3. Build the workflow from Step 2 in this guide (or import the JSON above)
  4. Run it against one video title and check the Drive output
  5. If the quality meets your bar, activate the workflow and let it run on every new upload

The entire setup takes under 30 minutes if you already have an n8n instance. The thumbnail generation itself runs in under 25 seconds per request. For most content operations, the time savings pay for the ThumbAPI plan within the first week.

For the canonical n8n setup — including a copy/paste test workflow that uses a public test key (no account required) — see the ThumbAPI + n8n integration guide.

Aldin Kozica

Written by

Aldin Kozica

Full-stack developer from Bosnia and Herzegovina. I built ThumbAPI because I kept watching content teams waste hours on thumbnail design when the patterns are predictable enough to automate. The API is the tool I wished existed when building content pipelines for my own projects.

Generate Thumbnails With an API

Try ThumbAPI free. 5 thumbnail generations per month, no credit card required. One API call, production-ready output.