Querying the Prismic Graphql endpoint with fetch, results not updating

Hi Folks, I using Graphql to query my Prismic repo for all instances of a custom type. We would rather not install Apollo Client and Prismic Apollo for a request or two, so I am just making the requests using Fetch. I added a new instance of our Clue custom type and successfully queried it in the Graphql explorer.

I then temporarily installed Apollo Client and Prismic Apollo, made the request in our app with Apollo and the Graph query copied from the Graphql Explorer, and saw the data returned successfully. I then copied the request in the Network tab as a Fetch request, integrated that format into our app, and was able to retrieve the data using Fetch.

And then added a few more instances of this custom Clue type, but they are not coming back in my Fetch request. I am still seeing the older data. I see them returned in the Graphql explorer, and if I make the request in our app using Apollo as well. But I need to be using Fetch, is there something I am missing here? I newer to Graphql. Thanks!

Hi @anton1,

Thanks for reaching out.

Can you please check what is the ref you are using when doing your fetch such as what is illustrated in this screenshot:

Please let me know if you need any further help,

Thanks Fares, here is the ref I am using in my Fetch request.

'headers': {
    'authorization': 'auth token',
    "prismic-ref": "YTAQvhIAACIAAabS",

This looks to be the same one that is used in the Graphql explorer when I inspect the network request. Interestingly enough this morning my Fetch request looks to be returning the correct data. Is there some sort of delay from when I publish in Prismic to when the Graph endpoint returns the updated data? Or some sort of cache I have to invalidate or something else I have to do? Thanks!

Can you try to remove the ref in your query, as you know if you query Prismic without a ref then it will default to the master ref.
The ref changes dynamically so you don't want to hardcode it.

When I remove the ref from my Fetch request the response in the Network tab is Please specify Prismic-ref header

In case it helps, I making my Fetch request as follows.

fetch("https://befunky.cdn.prismic.io/graphql?query=%7BallClues%7Bedges%7Bnode%7Bclue_id%20video_caption%20knowledge_base_article_url%20clue_video%7B...%20on%20_FileLink%7Burl%20__typename%7D__typename%7D__typename%7D__typename%7D__typename%7D%7D&variables=%7B%7D", {
            'headers': {
                'prismic-ref': 'YTAQvhIAACIAAabS',
                'authorization': 'token here',

Fares, I think I may have this figured out, unless you have a better way. I saw in the docs I can make a query to get the master ref, so I just do that each time before making the Graphql request, then include it in the request.

Unless there is some way to tell it to use the master ref by default.

1 Like

Hi @anton1, I think the way you are doing 2 queries is the right way; in fact, I thought that master ref is provided by default which I found is not the case when I had discussed it with our dev team.

The first call to


It is necessary to get a ref even in the case of a master ref for many reasons, including handing cashing.

To learn more about the rest of API, you can follow this document.

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