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));
Get in touch with the Storyblok community