Online Tools Directory

How to Post a Feature Image to Ghost CMS Using n8n and JWT

Learn how to post feature images to Ghost CMS using n8n automation and JWT authentication. Step-by-step setup guide for smooth publishing.
Feature Images in Ghost with n8n & JWT
Feature Images in Ghost with n8n & JWT

Publishing automation is one of the biggest time-savers when running a modern blog. If you’re using Ghost CMS with n8n automation, you might have noticed a limitation: the built-in Ghost node does not support uploading feature images.

Luckily, there’s a solution. By combining JWT authentication with Ghost’s Admin API, you can attach feature images to your posts automatically. In this guide, I’ll walk you through the exact process.

Why the Ghost Node Falls Short

The Ghost node in n8n lets you create and publish posts, but there’s a catch:

It doesn’t support the feature_image field.

That means your blog posts are published without a main image unless you add it manually. For anyone automating content, that’s a major setback.

The workaround? Use n8n’s HTTP Request node with a JWT token to talk directly to Ghost’s Admin API.

Step 1: Generate a JWT Token

Ghost uses Admin API keys in the format id:secret. You can create one under Ghost Admin → Settings → Integrations.

Here’s a snippet that shows how to generate a token with JavaScript and the JOSE library:

import * as jose from 'jose';

function fromHex(hex) {
  return new Uint8Array(
    hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16))
  );
}

async function genToken(key) {
  const [id, secret] = key.split(':');
  return await new jose.SignJWT({})
    .setProtectedHeader({ alg: 'HS256', kid: id })
    .setIssuedAt()
    .setAudience('/admin/')
    .setExpirationTime('5m')
    .sign(fromHex(secret));
}

When you send requests, add this token in your headers as:

Authorization: Ghost <JWT_TOKEN>

Step 2: Prepare a Public Feature Image URL

Ghost’s API doesn’t accept direct binary uploads. Instead, it needs a publicly accessible image URL.

That means links from Google Drive or other private services won’t work. Instead:

  • Upload the image to your Ghost media library, or
  • Host it on a public CDN or image service.

Step 3: Make the API Call with n8n

Now comes the fun part—connecting it all in n8n.

Add an HTTP Request node with the following settings:

  • Method: POST (create) or PUT (update)
  • Headers:
    • Authorization: Ghost <JWT_TOKEN>
    • Content-Type: application/json
  • Body (JSON):

URL:

https://yourdomain.com/ghost/api/admin/posts/
{
  "posts": [
    {
      "title": "My Automated Blog Post",
      "feature_image": "https://your-image-url.jpg",
      "html": "<p>This is my automated content.</p>",
      "status": "published"
    }
  ]
}

Common Issues & Fixes

  • Invalid HTTP Token error → Check your Authorization header formatting.
  • Image not showing → Ensure your image URL is public and ends with .jpg, .png, etc.
  • JWT expired → Tokens only last a few minutes; generate fresh ones for each run.

Workflow Recap

Step Action
1 Generate JWT with your Ghost Admin API key
2 Host your feature image at a public URL
3 Use n8n HTTP Request node with feature_image field

Final Thoughts

Automating posts to Ghost CMS with feature images might seem tricky at first, but with the JWT + HTTP Request method, it’s surprisingly straightforward.

This setup makes your workflow fully automated: posts go live with the right title, body content, and a feature image—without touching the Ghost dashboard.

If you’re already automating content with n8n, this little trick will make your blog look polished and professional while saving you even more time. 🚀

About the author
Decoge

Decoge

Decoge is a tech enthusiast with a keen eye for the latest in technology and digital tools, writing reviews and tutorials that are not only informative but also accessible to a broad audience.

Online Tools Directory

Discover the Online Tools Directory, your ultimate resource for top digital tools. Enhance productivity, foster collaboration, and achieve business success. Subscribe for updates!

Online Tools Directory

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Online Tools Directory.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.