# Get pages by custom tags

**URL:** <https://community.prismic.io/t/get-pages-by-custom-tags/16164>\
**Category:** Developing with Prismic\
**Tags:** fetch-linked-content\
**Created:** [June 20, 2024, 11:57am UTC](https://community.prismic.io/t/get-pages-by-custom-tags/16164 "2024-06-20T11:57:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![syndicateua](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@syndicateua](https://community.prismic.io/u/syndicateua)\
**Post date:** [June 20, 2024, 11:57am UTC](https://community.prismic.io/t/get-pages-by-custom-tags/16164/1 "2024-06-20T11:57:39Z")

</div>

Hi everyone!

**Issue**

I have a page type with a "blog\_page" name and want to create tags for them. I created a custom type "blog\_tags". After this, I added a "group field" with a "tags" name to a "blog\_page" and a "content relationship" with a "tag" name inside the "group field".

Now I want to make a request by uid of the "blog\_tags" and retrieve all related "blog\_page" pages but IDK how.

For reference I used this [topic](https://community.prismic.io/t/create-a-custom-tagging-system/5462)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/d/d202ea7f5ce646ecf64261547a4d0e053130873b.png)  
_This is a screenshot from the blog\_page:_  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/8/8a26a3b1e782f68a39188e7a7598a7ec8555f212.png)

**What steps have I taken?**

I asked ChatGPT4o and it gave me this answer.

```auto
 const blogPages = await client.getAllByType('blog_page', {
      filter: prismic.filter.at('my.blog_page.tags.tag', tagUID),
      fetchLinks: ['blog_page.title', 'blog_page.content'] // Adjust according to your blog_page custom type fields
    });

```

For tagUid I am using this code:

```auto
const newTags = await client.getByType("blog_tags");
const tagUID = newTags.results[0].uid;

```

**Problem:**  
I was trying to use this code but it is always returns empty results. How make it work?

**Prismic version:**  
"@prismicio/client": "^7.3.1",

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [June 20, 2024, 2:17pm UTC](https://community.prismic.io/t/get-pages-by-custom-tags/16164/2 "2024-06-20T14:17:05Z")

</div>

Hey @syndicateua,

The code from ChatGPT is almost correct. However, instead of the `uid`, you should use the `id`. Let me know if this works for you.

Sam

---

<div class="post-metadata">

**Author:** ![syndicateua](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@syndicateua](https://community.prismic.io/u/syndicateua)\
**Post date:** [June 21, 2024, 1:01am UTC](https://community.prismic.io/t/get-pages-by-custom-tags/16164/3 "2024-06-21T01:01:05Z")

</div>

Thanks!  
This is my mistake because I wrote this part of the code. ChatGPT gave me only the part with the **getAllByType**  
Maybe I missed somewhere in the docs that I should pass **id** for the **Content Relationship** type...

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [June 21, 2024, 8:08am UTC](https://community.prismic.io/t/get-pages-by-custom-tags/16164/4 "2024-06-21T08:08:43Z")

</div>

We'll take a look at making this more clear in the docs!
