Authentication
Communicating with the GraphQL endpoint requires an access token. Send authenticated requests as shown below:
const url = "https://gapi.storyblok.com/v1/api";const headers = { Token: "YOUR_PREVIEW_TOKEN", Version: "draft", "Content-Type": "application/json",};const body = JSON.stringify({ query: "query { PageItems { items { name } } }",});
fetch(url, { method: "POST", headers: headers, body: body,}) .then((response) => response.json()) .then((data) => console.log(data)) .catch((error) => console.error("Error:", error));
Thanks! We received your feedback.
An error occurred. Please try again.
Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy. Terms of Service apply.
Get in touch with the Storyblok community