Ghost 4: Delete All Empty Tags Script
1 min read

Ghost 4: Delete All Empty Tags Script

Table of contents

Learn to delete empty tags in Ghost via the Admin API. Sadly, for whatever reason the creators of Ghost, even in version 4, have not provided us with an interface way of bulk editing things. As such, the only way to do something in bulk is via the API.

The Content API doesn't allow for deletion (of tags) and so, we'll be using the Admin API /tags/ route (which currently is in beta according to their documentation) in-order to do what we want.

At the bottom of this article, I've embedded a link to the script I wrote. All you'll need is:

  1. Python 3 (I used py3.9)
  2. Python module: requests
  3. Python module: pyjwt
Do NOT use the jwt module. It does not have the functions to handle security and authorization stuffs so it will not work. pyjwt is the module you need to install for this to work.

Once you have all your pieces here are the four (4) easy steps to delete all your blog's empty post tags:

  1. Get your Ghost ADMIN API key (not the content api, the admin api key)
  2. Download the script from the GIST below
  3. Edit lines 6 and 7. Line 6 is the admin key, put yours there, and then add your domain for line 7. Save.
  4. Run the script.


The script does the following:

  1. Generated a JWT token from your provided Admin API key
  2. Authenticates into your Ghost instance using said token
  3. Gets the IDs of all your EMPTY tags
  4. Then deletes all of said tags

Feel free to check out the comments on the script for more details.