Admin API endpoint for tags

I see in the Endpoints section of this page in the Admin API docs that the /tags/ endpoint is considered ‘Experimental’.

Does this mean it can be used? If so, is there any documentation explaining how to use it?

1 Like

I’m using the/tags/ endpoint for a while now and had no issues with it.
In my case, I’m fetching the most popular posts from Fathom Analytics and then tagging them with the most-popular tag.
To be able to tag popular posts, I need to get a tag object from the /tags/ endpoint, like this:

let tagToAdd = {}
// Ghost params
const key = `${process.env.GHOST_ADMIN}`;
const [id, secret] = key.split(':');
const token = jwt.sign({}, Buffer.from(secret, 'hex'), {
    keyid: id,
    algorithm: 'HS256',
    expiresIn: '5m',
    audience: `/admin/`
});

// Get the most-popular tag
await axios($, {
    method: 'get',
    url: `https://mydomain.ghost.io/ghost/api/admin/tags/slug/most-popular`,        
    headers: {
      Authorization: `Ghost ${token}`
    }
  }) 
  .then(response => tagToAdd = response.tags)
  .catch(error => console.error("Error: " + error));

Hope this helps.