<h1>Resource Fetching</h1> <p>The `fetch` API allows you to send a fetch request that is authenticated with an [OpenID Connect ID Token](/docs/api/app-bridge-library/apis/id-token) from Shopify in the `Authorization` header. This is authenticated for your application domain and subdomains. See the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) documentation for more details. App Bridge injects automatic authorization into the global &lt;code&gt;fetch&lt;/code&gt; function. While this is transparent and should not interfere with existing fetch code, this injection can be disabled using the [&lt;code&gt;disabledFeatures&lt;/code&gt;](/docs/api/app-bridge-library/apis/config#setting-config-values-disabledfeatures) configuration option.</p> ```js fetch(&#39;/api/endpoint&#39;); ``` <h2>Examples</h2> <p>The `fetch` API allows you to send a fetch request that is authenticated with an [OpenID Connect ID Token](/docs/api/app-bridge-library/apis/id-token) from Shopify in the `Authorization` header. This is authenticated for your application domain and subdomains. See the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) documentation for more details. App Bridge injects automatic authorization into the global &lt;code&gt;fetch&lt;/code&gt; function. While this is transparent and should not interfere with existing fetch code, this injection can be disabled using the [&lt;code&gt;disabledFeatures&lt;/code&gt;](/docs/api/app-bridge-library/apis/config#setting-config-values-disabledfeatures) configuration option.</p> <h3></h3> <p>Fetch with custom headers</p> ```js fetch(&#39;/api/endpoint&#39;, { headers: {&#39;accept-language&#39;: &#39;fr&#39;}, }); ``` ```js fetch(&#39;/api/endpoint&#39;, { headers: {&#39;accept-language&#39;: &#39;fr&#39;}, }); ``` <h3></h3> <p>Fetch directly from the Admin API using Direct API access</p> ```js const res = await fetch(&#39;shopify:admin/api/graphql.json&#39;, { method: &#39;POST&#39;, body: JSON.stringify({ query: ` query GetProduct($id: ID!) { product(id: $id) { title } } `, variables: {id: &#39;gid://shopify/Product/1234567890&#39;}, }), }); const {data} = await res.json(); console.log(data); ``` ```js const res = await fetch(&#39;shopify:admin/api/graphql.json&#39;, { method: &#39;POST&#39;, body: JSON.stringify({ query: ` query GetProduct($id: ID!) { product(id: $id) { title } } `, variables: {id: &#39;gid://shopify/Product/1234567890&#39;}, }), }); const {data} = await res.json(); console.log(data); ```