# Fetching tags with content api

**URL:** <https://forum.ghost.org/t/fetching-tags-with-content-api/6580>\
**Category:** Developer help\
**Created:** [April 1, 2019, 7:26pm UTC](https://forum.ghost.org/t/fetching-tags-with-content-api/6580 "2019-04-01T19:26:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebeca](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@rebeca](https://forum.ghost.org/u/rebeca)\
**Post date:** [April 1, 2019, 7:26pm UTC](https://forum.ghost.org/t/fetching-tags-with-content-api/6580/1 "2019-04-01T19:26:41Z")

</div>

Hello, this is a question.

I’m using the content-api. Just created a few tags (not associated with any post), and tried to fetch them.:

```auto
ghostBlogApi.tags.browse({ limit: 'all' });

```

However, I get none of the tags I created. Does the content api only fetch tags related to posts?

- What version of Ghost are you using? 2.18.1

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [April 1, 2019, 9:15pm UTC](https://forum.ghost.org/t/fetching-tags-with-content-api/6580/2 "2019-04-01T21:15:47Z")

</div>

> [@rebeca](#):
>
> Does the content api only fetch tags related to posts?

Yep! Here’s an explanation of why 🙂

> <https://github.com/TryGhost/Ghost/issues/10433#issuecomment-458681571>
>
> \### Issue Summary
> 
> In an older version of Ghost after creating a completely ne…w tag, an automatic collection page was created with all the posts that were tagged with this particular tag.
> 
> If the tag that was just created didn't have any posts with it, the URL would still render correctly but without any tagged posts (200 - OK, successful).
> 
> After updating to the latest release I noticed that when you create a new tag and try to access the tag page, Ghost returns a 404 error. When troubleshooting I realized that after tagging any of my current posts with that new tag, only then the tag page rendered correctly. 
> 
> I believe this is a bug and if implemented intentionally, it only serves to cause confusion with Ghost users. 
> 
> \### To Reproduce
> 
> 1. Create a new tag with Ghost. 
> 2. Use a browser to access the new tag URL provided when creating the tag in Ghost admin panel.
> 3. Receive a 404 (Page not found.)
> 
> \-- Continues: 
> 5. Tag an already published post or publish a new one with the newly created tag.
> 6. Use a browser to access the tag URL. 
> 7. Receive a 200 (OK.)
> 
> \-- Reproduce Again:
> 8. Delete the tag from the published post and re-publish it without the newly created tag again. 
> 9. Use a browser to access the tag URL. 
> 10. Receive a 404 (Page not found.) -\> Although tag does exist in Ghost admin panel
> 
> \### Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?
> 
> I consider this to be a bug as the behaviour when creating new tags in Ghost before was different and made more sense. 
> 
> Sometimes I think that the users of Ghost want to create a new (empty) tag collections page without any posts in it. This is because after creating a new tag and the page, one may want to include it in the navigation for testing purposes (design-tab in the Ghost admin panel) before the initial post with this tag has even been published. Currently it will just return a 404 error although the post collection page should already exist. I believe thus that this is a bug. 
> 
> I think the older behaviour with Ghost rendering an empty tag page is the way to go but this is just my opinion. Your thoughts? 
> 
> \### Technical details:
> 
> \* Ghost Version: 2.13.1
> \* Node Version: 8.15.0
> \* Browser/OS: Any evergreen browser, Mac OS.
> \* Database: MySQL

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [April 15, 2019, 9:15pm UTC](https://forum.ghost.org/t/fetching-tags-with-content-api/6580/3 "2019-04-15T21:15:48Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
