GraphQL API query gives 403 Status code.

Hello,

i sell on a marketplace and want to fetch the orders from an XML link they provided and create orders in Shopify via API automatically. I have set up a cloudflare worker with a cron job. I created also a custom app to get an admin api key. I have read_products and write_orders scope

Problem is that a get a 403 Code when doing the GraphQl query through code. When using Postman, everything is fine with the response and so on.

I have read that 403 means Store is fraudulent.. 403 is what i get from graphRes.status, see below.

Anyone knows what i can do?

Here is my example code:

    let query;

    query = \`{ productVariants(first: 1, query: "barcode:123456789545") { edges { node { id } } } }\`;

    let graphRes;

    try {

      graphRes = await fetch(

        \`https://${env.SHOPIFY_SHOP_DOMAIN}/admin/api/2026-04/graphql.json\`,

        {

          method: "POST",

          headers: {

            "X-Shopify-Access-Token": env.SHOPIFY_ACCESS_TOKEN,

            "Content-Type": "application/json",

          },

          body: JSON.stringify({ query }),

        },

      );

      console.log("Fetch succesfull, Status:", graphRes.status);

    } catch (e) {

      console.log("Fetch crashed: ", e.message);

      return; // Stop, damit wir sehen, was passiert ist

    }

403 is forbidden, so your access token is most likely no longer valid.

Thank you for your answer. The token is working when i do a POST-Request on Postman right now. So it did not expire.. Could there be something else blocking my Post Request?

Hey @Ali_Bayrakdar if you can share the x-request-id from the response headers of a request that returns 403, I’ll be happy to take a look at our logs and see what’s happening!

I somehow got it to work. I double checked everything and I think that there was a mistake on the access token. Creating orders and reading products is now working.

Thank you very much.