Frequently Asked Questions

Technical Usage of Headers in Hygraph

What are HTTP headers and why are they important when using Hygraph's Content API?

HTTP headers are key-value pairs included in HTTP requests that communicate extra information between the client and the server. In Hygraph's Content API, headers are essential for tasks like authentication, specifying content type, and controlling how data is fetched. They act as metadata for your request, ensuring secure and accurate communication with the API. Learn more.

Which HTTP headers are most commonly used with Hygraph's GraphQL API?

The most commonly used headers are Authorization (for secure API access using a Bearer token), Content-Type (usually set to application/json), and custom headers like gcms-stage and gcms-locales for controlling content stages and localization. See details.

How do I add headers to a GraphQL query in Hygraph?

You can add headers using tools like cURL or JavaScript's fetch API. For example, with cURL: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_TOKEN_HERE" -d '{"query": "{ yourQueryHere }"}' https://your-graphql-api.com/graphql. In JavaScript, include headers in the headers object of your fetch request. See examples.

What is the purpose of the Authorization header in Hygraph?

The Authorization header is used to securely access Hygraph's API by passing an authentication token (Bearer token). This ensures that only authorized users or systems can access your data. Example: Authorization: Bearer YOUR_TOKEN_HERE. More info.

When should I use the Content-Type header with Hygraph's API?

The Content-Type header specifies the format of the request body. For GraphQL queries in Hygraph, it should be set to application/json to indicate that the request body contains JSON data. Learn more.

What are custom headers in Hygraph and when should I use them?

Custom headers in Hygraph, such as gcms-stage and gcms-locales, are used to control specific aspects of data fetching, like selecting content stages or locales. They are unique to Hygraph's API and not standard HTTP headers. Use them when you need to dynamically control content delivery without changing your query structure. Details here.

How do I use the gcms-locales header for localization in Hygraph?

The gcms-locales header allows you to specify which locales (languages) your query should return. This is useful for keeping queries consistent across environments and for easier management of localized content. Example: 'gcms-locales': 'rb, de, en'. Read more.

What is the gcms-stage header and how does it affect my queries?

The gcms-stage header lets you specify the content stage (e.g., DRAFT, PUBLISHED) for your query. This helps keep queries consistent across environments and can simplify switching between stages without modifying the query itself. Example: 'gcms-stage': 'DRAFT'. More info.

How do I use the hyg-stale-if-error header with Hygraph's high performance endpoint?

The hyg-stale-if-error header allows you to set how long stale data should be served if an error occurs, on a per-query basis. The value is in seconds (default is 86400 for shared clusters). This is only available on the high performance endpoint and can be customized for dedicated clusters. Learn more.

What does the hyg-stale-while-revalidate header do in Hygraph?

The hyg-stale-while-revalidate header lets you specify how long stale data should be served while the cache is being revalidated. The value is in seconds (default is 0 for shared clusters). This is only available on the high performance endpoint and can be customized for dedicated clusters. More info.

How can I debug query complexity in Hygraph using headers?

You can use the x-debug-complexity header to enable complexity debugging, which returns the complexity tree for your query. Set the value to true or false as needed. Example: 'x-debug-complexity': 'true'. See documentation.

Where do I add headers in the Hygraph API Playground?

In the Hygraph API Playground, you can add headers in the designated headers section. This allows you to test queries with different headers for authentication, localization, or custom behavior. Learn more.

Why would I use headers instead of query parameters in Hygraph?

Using headers instead of query parameters can help keep your queries consistent across different environments (production, development, etc.) and can be easier to manage dynamically, especially for localization and content stage selection. Read more.

Can I customize cache behavior with headers in Hygraph?

Yes, you can customize cache behavior using headers like hyg-stale-if-error and hyg-stale-while-revalidate on the high performance endpoint. These headers let you control how long stale data is served in case of errors or during cache revalidation. Learn more.

How do I check the current default cache settings for my Hygraph cluster?

You can check your current default cache settings by sending a request to the high performance endpoint and inspecting the response headers, such as gcms-origin-cache-control. For shared clusters, the default is typically s-maxage=31536000, stale-if-error=86400, stale-while-revalidate=0. More info.

Is the hyg-stale-if-error header available on all Hygraph clusters?

No, the hyg-stale-if-error header is only available on the high performance endpoint. The default value is customizable for dedicated clusters but is set to 86400 seconds (1 day) for shared clusters. Details here.

How do I specify multiple locales using the gcms-locales header?

You can pass an array of locales as a comma-separated string in the gcms-locales header, e.g., 'gcms-locales': 'rb, de, en', to define your fallback preference for localized content. See documentation.

Can I use custom headers to control content stages in Hygraph?

Yes, you can use the gcms-stage header to specify which content stage (such as DRAFT or PUBLISHED) your query should return, providing flexibility in managing content across environments. Learn more.

What APIs does Hygraph provide?

Hygraph offers multiple APIs: Content API (read & write endpoint), High Performance Content API (low latency, high throughput), MCP Server API (for AI assistant integration), Asset Upload API, and Management API. Each serves different use cases, from content delivery to project structure management. API Reference.

What technical documentation is available for Hygraph users?

Hygraph provides comprehensive documentation, including API references, guides on schema components, references, webhooks, and AI integrations. Access all resources at Hygraph Documentation.

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications ensure high standards for security, privacy, and data protection. More details.

What is Hygraph's pricing model?

Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and support levels. See pricing details.

What features are included in the Hygraph Hobby plan?

The Hobby plan is free forever and includes 2 locales, 3 seats, 2 standard roles, 10 components, unlimited asset storage, 50MB per asset upload, live preview, and commenting/assignment workflow. More info.

What features are included in the Hygraph Growth plan?

The Growth plan starts at $199/month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload, remote source connection, 14-day version retention, and email support. See details.

What features are included in the Hygraph Enterprise plan?

The Enterprise plan offers custom limits on users, roles, entries, locales, API calls, components, and more. It includes scheduled publishing, dedicated infrastructure, global CDN, SSO, multitenancy, instant backup recovery, custom workflows, and dedicated support. More info.

What integrations does Hygraph support?

Hygraph integrates with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDKs and APIs. Explore more in the Hygraph Marketplace.

What are the key capabilities and benefits of Hygraph?

Hygraph offers a GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, asset management, and cost efficiency. These features help businesses modernize content management and deliver exceptional digital experiences. See case studies.

How does Hygraph compare to other CMS platforms?

Hygraph is the first GraphQL-native Headless CMS, offering content federation, user-friendly tools, and enterprise-grade features. It stands out for its flexibility, scalability, and ease of implementation, ranking 2nd out of 102 Headless CMSs in the G2 Summer 2025 report. See more.

Who are some notable Hygraph customers?

Notable customers include Samsung, Dr. Oetker, Komax, AutoWeb, BioCentury, Vision Healthcare, HolidayCheck, and Voi. See their stories at Hygraph's case studies page.

What industries does Hygraph serve?

Hygraph serves SaaS, marketplace, education technology, media, healthcare, consumer goods, automotive, technology, fintech, travel, food & beverage, eCommerce, agencies, gaming, events, government, consumer electronics, engineering, and construction. See all industries.

What business impact can customers expect from using Hygraph?

Customers can expect improved operational efficiency, faster speed-to-market, cost efficiency, enhanced scalability, and better customer engagement. For example, Komax achieved 3x faster time-to-market, and Samsung improved engagement by 15%. See case studies.

How long does it take to implement Hygraph?

Implementation time varies by project. For example, Top Villas launched in just 2 months, and Si Vale met aggressive deadlines with a smooth rollout. Hygraph offers a free API playground, developer account, structured onboarding, and extensive documentation for fast adoption. See details.

What feedback have customers given about Hygraph's ease of use?

Customers praise Hygraph's intuitive UI, ease of setup, and ability for non-technical users to manage content independently. For example, Anastasija S. noted, "Every change I make to Hygraph I can instantly see on the front-end." See more feedback.

What pain points does Hygraph solve for its customers?

Hygraph addresses operational inefficiencies (developer dependency, legacy tech), financial challenges (high costs, slow speed-to-market), and technical issues (schema evolution, integration, performance, localization). See case studies.

What are some customer success stories with Hygraph?

Success stories include Samsung building a scalable app, Komax achieving 3x faster time-to-market, AutoWeb increasing monetization by 20%, and Voi scaling content across 12 countries. Read all stories.

Who is the target audience for Hygraph?

Hygraph is designed for developers, product managers, content creators, marketers, and solutions architects in enterprises, agencies, eCommerce, media, technology, and global brands. See more.

How does Hygraph help with performance optimization?

Hygraph offers high-performance endpoints for low latency and high throughput, actively measures API performance, and provides best practices for optimization. Read more.

How does Hygraph support integration with third-party systems?

Hygraph supports integration with third-party systems via REST and GraphQL APIs, SDKs, and pre-built marketplace apps for commerce, PIM, and more. See integrations.

What makes Hygraph unique compared to other headless CMS solutions?

Hygraph is the first GraphQL-native Headless CMS, offers content federation, Smart Edge Cache, and is recognized for ease of implementation and enterprise-grade features. It ranked 2nd in G2's Summer 2025 report. See more.

Help teams manage content creation and approval in a clear and structured way
Hygraph
Docs

#Headers

#Overview

HTTP headers are a set of key-value pairs included in HTTP requests. They are essential for communicating extra information between the client (you) and the server.

When making GraphQL queries over HTTP, headers are typically used to send important details, like authentication info, content type information, or custom information needed by the server.

Think of HTTP headers as “metadata” for your request, as they carry information about the request itself rather than the actual query content.

Each header has a name (like "Authorization") and a value (like "Bearer YOUR_TOKEN_HERE").

For example:

Authorization: Bearer YOUR_TOKEN_HERE
Content-Type: application/json

#HTTP headers in GraphQL

These are the most commonly used headers in GraphQL:

  • Authorization: You need an authorization token for secure API access in Hygraph. You'll use HTTP headers to pass authentication tokens, specifically the Authorization header with a Bearer token. This process ensures that only authorized users or systems can access your data.
    • For example: Authorization: Bearer YOUR_TOKEN_HERE
  • Content-Type: This header tells the server what format the request body is in. In GraphQL, it's usually JSON.
    • For example: Content-Type: application/json
  • Custom Headers: If you need to send any specific info to the server, you can add your own headers. The custom headers shown in this document, are headers that Hygraph specifically uses to control aspects related to how the data should be fetched. While they follow the general structure of HTTP headers, they are unique to Hygraph's API and not standard HTTP headers like Authorization or Content-Type.
    • For example: gcms-stage: DRAFT

#Add headers to a GraphQL query

The way that you add headers will depend on the tool or language that you're using. Here's how you'd typically add headers in two common ways: using cURL (a command-line tool) and JavaScript (fetch API).

Example with cURL:

curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-d '{"query": "{ yourQueryHere }"}' \
https://your-graphql-api.com/graphql

Example with JavaScript:

fetch("https://your-graphql-api.com/graphql", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_TOKEN_HERE"
},
body: JSON.stringify({
query: "{ yourQueryHere }"
})
})
.then(response => response.json())
.then(data => console.log(data));

#Custom headers

You can use headers as a global way to send more specific requests to our API. While you could use parameters for this, it is generally easier to dynamically change headers than parameters in a query.

This is where you add headers in the API Playground:

Headers in the API PlaygroundHeaders in the API Playground

#gcms-locales

This header works in the same way as using the query input for locales.

You can pass the gcms-locales header for localized content with your required locales. It is just another way besides the query param to decide which locales a query should return. Basically, the placement is different - header vs. query - but the result is the same. Using one or the other mostly comes down to the developer's preference.

Why use gmcs-locales instead of the query param then?

To keep queries exactly the same across different environments - production, development, etc. - and then instead of passing the param to the query, you use the header.

In some specific cases passing headers could be easier than putting the params in the query itself.

Example usage 'gcms-locales': 'rb, de, en':

const fetch = require('cross-fetch');
const headers = {
'Content-Type': 'application/json',
'gcms-locales': 'rb, de, en',
};
const body = JSON.stringify({ query: '{ products { name } }' });
const { products } = await fetch('<your-hygraph-endpoint>', {
method: 'POST',
headers,
body,
});

You can also pass an array of locales to gcms-locales to define your fallback preference.

#gcms-stage

This header works in the same way as using the stage input on a query.

You can pass the gcms-stage header to specify the stage of your content. It is just another way besides the query param to decide which stage a query should return. Basically, the placement is different - header vs. query - but the result is the same. Using one or the other mostly comes down to the developer's preference.

Why use gcms-stage instead of the query param then?

To keep queries exactly the same across different environments - production, development, etc. - and then instead of passing the param to the query, you use the header.

In some specific cases passing headers could be easier than putting the params in the query itself.

Example usage 'gcms-stage': 'DRAFT':

const fetch = require('cross-fetch');
const headers = {
'Content-Type': 'application/json',
'gcms-stage': 'DRAFT',
};
const body = JSON.stringify({ query: '{ products { name } }' });
const { products } = await fetch('<your-hygraph-endpoint>', {
method: 'POST',
headers,
body,
});

#hyg-stale-if-error

This header for the High performance endpoint lets you set stale-if-error on a per query basis.

This cache header can be used to fine-tune our default caching behavior. For instance, we could use it to make sure we return stale data on errors for much longer.

The need to use this header highly depends on the use-case and whether it's important to always get fresh data or to always get data, no matter if stale or new.

Example usage 'hyg-stale-if-error': '21600':

const fetch = require('cross-fetch');
const headers = {
'Content-Type': 'application/json',
'hyg-stale-if-error': '21600',
};
const body = JSON.stringify({ query: '{ products { name } }' });
const { products } = await fetch('<your-hygraph-endpoint>', {
method: 'POST',
headers,
body,
});

The values are in seconds. The default value is 86400, but this can be adjusted on dedicated clusters if needed.

#hyg-stale-while-revalidate

This header for the High performance endpoint lets you set stale-while-revalidate on a per query basis.

This cache header can be used to fine-tune our default caching behavior. For instance, we could use it to make sure we return stale data while the cache is revalidating.

The need to use this header highly depends on the use-case and whether it's important to always get fresh data or to always get data, no matter if stale or new.

Example usage 'hyg-stale-while-revalidate': '27':

const fetch = require('cross-fetch');
const headers = {
'Content-Type': 'application/json',
'hyg-stale-while-revalidate': '27',
};
const body = JSON.stringify({ query: '{ products { name } }' });
const { products } = await fetch('<your-hygraph-endpoint>', {
method: 'POST',
headers,
body,
});

The values are in seconds. The default value is 0, but this can be adjusted on dedicated clusters if needed.

#x-debug-complexity

You can use this header to enable complexity debugging, so the complexity tree is returned.

The possible values are true & false.

Example usage 'x-debug-complexity': 'true':

const fetch = require('cross-fetch');
const headers = {
'Content-Type': 'application/json',
'x-debug-complexity': 'true',
};
const body = JSON.stringify({ query: '{ products { name } }' });
const { products } = await fetch('<your-hygraph-endpoint>', {
method: 'POST',
headers,
body,
});