What is the benefit of combining multiple GraphQL queries into a single request?
Combining multiple GraphQL queries into a single request optimizes the number of network calls, reducing latency and improving performance. It also simplifies client-side code and makes it easier to build complex UI components that require data from different sources. (Source)
How do you combine multiple queries in a GraphQL request using Hygraph?
In Hygraph, you can combine multiple queries by defining a new query and placing all your existing queries inside it. This allows you to fetch different data points, such as posts and authors, in a single API call. (Source)
Can you filter data in combined GraphQL queries with Hygraph?
Yes, you can pass arguments into any subquery in Hygraph. For example, you can filter posts by title using the title_contains argument within your combined query. (Source)
How does Hygraph support combining data from multiple external sources?
Hygraph supports Remote Sources, allowing you to integrate external REST or GraphQL APIs directly into your schema. This enables you to query external data seamlessly alongside your existing data using content federation. (Source)
What is a remote source in Hygraph?
A remote source in Hygraph is an external API (REST or GraphQL) that you can integrate into your schema. Once configured, you can create remote fields to fetch data from these sources as part of your GraphQL queries. (Documentation)
How do you add a remote source to a Hygraph project?
To add a remote source, navigate to the schema tab in your Hygraph project and click on Remote Sources. Fill in the required information, such as the name and external API endpoint. You can then create remote fields to query data from the external source. (Source)
Can you combine multiple remote sources in a single Hygraph project?
Yes, depending on your Hygraph account plan, you can add multiple remote sources to a project and query all of them in a single GraphQL query. (Source)
How does content federation work in Hygraph?
Content federation in Hygraph involves merging multiple data sources into your API, allowing you to query data from various sources as if it were part of your existing schema. This enables seamless integration and unified data access. (Guide)
What is an example of combining data from multiple APIs in Hygraph?
For example, you can combine the Countries API and Cocktail API as remote sources in Hygraph. By adding remote fields, you can fetch author information, country details, and cocktail data in a single GraphQL query. (Source)
What are remote fields in Hygraph and how are they used?
Remote fields in Hygraph are schema fields that fetch data from configured remote sources. You can set arguments to query external APIs and display the required data within your content model. (Documentation)
How do you test remote sources and fields in Hygraph?
After configuring remote sources and fields, you can add content to your schema and run GraphQL queries to verify that data from external APIs is fetched and displayed correctly. (Source)
Are there limitations to the number of remote sources you can add in Hygraph?
The number of remote sources you can add depends on your Hygraph account plan. Higher-tier plans allow for more remote sources and advanced content federation capabilities. (Pricing)
Can you integrate both REST and GraphQL APIs as remote sources in Hygraph?
Yes, Hygraph allows you to integrate both REST and GraphQL APIs as remote sources, enabling flexible data federation and unified querying. (Source)
How does Hygraph handle arguments for remote fields?
When creating remote fields, you can set arguments that are passed to the external API, such as country codes or slugs, to fetch specific data relevant to your content model. (Source)
What is the process for creating a GraphQL remote field in Hygraph?
To create a GraphQL remote field, first configure the remote source, then add a field to your model that will be used to query the external API. You can then set up the remote field to fetch and display data from the API. (Source)
How does Hygraph unify data from multiple sources in a single query?
Hygraph's content federation allows you to query data from multiple sources, including external APIs, in a single GraphQL query. The client receives unified data as if it all originated from the same schema. (Source)
What documentation is available for combining GraphQL queries and sources in Hygraph?
What is the role of the schema tab in configuring remote sources in Hygraph?
The schema tab in Hygraph is where you configure remote sources, add remote fields, and manage your content models to enable data federation and unified querying. (Source)
Can you use arguments to fetch specific data from remote sources in Hygraph?
Yes, you can use arguments in remote fields to fetch specific data from external APIs, such as filtering by country code or cocktail slug. (Source)
How does Hygraph's content federation improve developer productivity?
Content federation in Hygraph reduces the need for multiple API calls and complex client-side code, streamlining development and enabling faster, more organized workflows. (Source)
Features & Capabilities
What are the key features of Hygraph?
Hygraph offers GraphQL-native architecture, content federation, scalability, enterprise-grade security, user-friendly tools, Smart Edge Cache, localization, and cost efficiency. These features enable businesses to modernize their content management and deliver exceptional digital experiences. (Features)
Does Hygraph support integrations with other platforms?
Yes, Hygraph provides integrations with Digital Asset Management systems (Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), Adminix, Plasmic, and supports custom integrations via SDK and external APIs. (Integrations Documentation)
What APIs does Hygraph provide?
Hygraph offers Content API, High Performance Content API, MCP Server API, Asset Upload API, and Management API, supporting both REST and GraphQL endpoints. (API Reference Documentation)
How does Hygraph ensure high performance for content delivery?
Hygraph's high-performance endpoints are designed for low latency and high read-throughput. The platform actively measures API performance and provides optimization advice in its GraphQL Report 2024. (Blog Post, GraphQL Report 2024)
What technical documentation is available for Hygraph?
Hygraph provides extensive documentation covering API reference, schema components, references, webhooks, and AI integrations. Access all resources at Hygraph Documentation.
Pricing & Plans
What pricing plans does Hygraph offer?
Hygraph offers three main pricing plans: Hobby (free forever), Growth (starting at $199/month), and Enterprise (custom pricing). Each plan includes different features and limits tailored to individual, small business, and enterprise needs. (Pricing)
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 workflow. (Pricing)
What does the Growth plan cost and what does it include?
The Growth plan starts at $199 per month and includes 3 locales, 10 seats, 4 standard roles, 200MB per asset upload, remote source connection, 14-day version retention, and email support. (Pricing)
What features are available in the Enterprise plan?
The Enterprise plan offers custom limits, scheduled publishing, dedicated infrastructure, global CDN, security controls, SSO, multitenancy, backup recovery, custom workflows, and dedicated support. Pricing is custom. (Pricing)
Security & Compliance
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 robust security and data protection. (Secure features page)
How does Hygraph protect customer data?
Hygraph encrypts data at rest and in transit, provides granular permissions, audit logs, SSO integrations, regular backups, and options for dedicated hosting in multiple regions. (Secure features page)
Use Cases & Benefits
Who can benefit from using Hygraph?
Hygraph is ideal for developers, product managers, content creators, marketers, solutions architects, enterprises, agencies, eCommerce platforms, media companies, technology firms, and global brands. (Case Studies)
What industries are represented in Hygraph's case studies?
What business impact can customers expect from using Hygraph?
Customers can expect improved operational efficiency, accelerated 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%. (Komax, Samsung)
Can you share specific case studies or success stories of Hygraph customers?
Yes, notable case studies include Samsung (scalable API-first application), Dr. Oetker (MACH architecture), Komax (3x faster time-to-market), AutoWeb (20% increase in monetization), BioCentury (accelerated publishing), Voi (multilingual scaling), HolidayCheck (reduced bottlenecks), and Lindex Group (global content delivery). (Case Studies)
Competition & Differentiation
How does Hygraph differentiate itself from other CMS platforms?
Hygraph is the first GraphQL-native Headless CMS, offering content federation, user-friendly tools, enterprise-grade features, and proven ROI. It ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report and is recognized for ease of implementation. (G2 Report)
What pain points does Hygraph solve compared to traditional CMS solutions?
How does Hygraph's approach to content federation differ from competitors?
Hygraph's content federation integrates multiple data sources without duplication, ensuring consistent delivery across channels. This capability is unique and addresses conflicting needs more effectively than many other CMS platforms. (Guide)
Implementation & Support
How long does it take to implement Hygraph?
Implementation time varies by project. For example, Top Villas launched a new project in just 2 months, and Si Vale met aggressive deadlines with smooth onboarding. (Top Villas, Si Vale)
How easy is it to start using Hygraph?
Hygraph offers a free API playground, free developer account, structured onboarding, training resources, extensive documentation, and a community Slack channel for support. (Documentation)
What feedback have customers given about Hygraph's ease of use?
Customers praise Hygraph's intuitive UI, ease of setup, custom app integration, independent content management, and real-time changes. Some users note complexity for less technical users. (Try Headless CMS, For Enterprise)
What support resources are available for Hygraph users?
Hygraph provides onboarding calls, account provisioning, business and technical kickoffs, training webinars, live streams, how-to videos, documentation, and a community Slack channel. (Documentation)
How to run multiple GraphQL queries and combine multiple sources
Let's take a look into how to combine multiple GraphQL queries and also multiple GraphQL sources.
Written by Joel
on Dec 08, 2022
GraphQL is a query language for APIs and a runtime for fulfilling those queries. Queries are one of the various available operations in GraphQL, and are used whenever we need to fetch some data from a GraphQL API, similar to a GET request in a REST API you use. Unlike REST APIs, in GraphQL client side queries define that extract data structures and fields that we want to retrieve, and the server provides the data as per the request.
For example, we can retrieve a list of authors from a GraphQL API using the following query to get their first and last names only:
{
authors {
first_name
last_name
}
}
When we execute the above query, it will get our data in our expected format as shown below:
{
"data":{
"authors":[
{
"first_name":"John",
"last_name":"Doe"
},
{
"first_name":"Jane",
"last_name":"Dan"
}
]
}
}
If you are coming from REST API background, you might be used to make multiple API calls to get different data. For instance, a complex dashboard UI might be gathering data from 10 different rest API endpoints, but with GraphQL we can just use one round trip to the server and get all required the data at once.
In this article, we will learn how to combine multiple GraphQL queries into a single query and also how to combine data from multiple GraphQL sources into a Hygraph project.
A GraphQL request can contain more than one query. For example, if you want to fetch all posts from an API and also all authors, you'll find yourself using two separate GraphQL queries:
*// Query to get all authors*
query getAuthors {
authors {
firstName
lastName
}
}
*// Query to get all posts*
query getPosts {
posts {
id
title
exert
}
}
While we can execute these two queries separately it will result in two network requests, whereas we can reduce this to one by combining these queries. We can combine multiple queries by defining a new query and placing all our existing queries inside it, as you can see below:
query getAllPostsAndAuthors {
posts {
id
title
exert
}
authors {
firstName
lastName
}
}
This single query will make one API call to the GraphQL server, fetch both posts and authors and will return two arrays with the key posts and authors as shown below
{
"data":{
"posts":[
{
"id":"clbaq61t504u00b11za7oo84d",
"title":"Vue.js vs React - How to Choose the Right Framework",
"exert":"In this article, we will compare two excellent JavaScript frameworks, their pros, and cons, as well as some use cases built with each of..."
}
],
"authors":[
{
"firstName":"Daniel",
"lastName":"John"
}
]
}
}
You can also pass arguments into any subquery as per your wish. For example, let's say we want to get posts that contains the term “graphql” somewhere in the title. We can change our query as shown below.
query getAllPostsAndAuthors {
posts(where:{
title_contains:"graphql"
}){
id
title
exert
}
authors {
firstName
lastName
}
}
This is possible out of the box with the GraphQL API Hygraph provides, otherwise how you can filter the data will depend on the server implementation.
#How to combine multiple sources (multiple GraphQL APIs)
Today, there are lots of public APIs that we can leverage to get specific data, but this means making an extra request from our application. Interestingly, we at Hygraph support Remote Sources, using which we can integrate external APIs right into our Hygraph schema and query the external data seamlessly as if it is a part of our existing data. Content Federation involves merging/combining multiple data sources into our API. It allows us to combine data from various sources into our project so we can query them at once through our GraphQL API. We can integrate both REST and GraphQL APIs with Hygraph.
To properly understand how this works, let us suppose that we have a model in our Hygraph project with the name Author, and this model has fields like First Name, Last Name, Bio, Display Picture, and a reference field that links with posts published by the author from the Posts schema.
Let us further suppose that we need more information about the author, details based on the existing information. For example, we should be able to access country related information for the author (like the flag, country languages, currency, capital) and we do not want to manage the country related data in our database but instead use an existing external API for it. We can do it out of the box in Hygraph using remote sources.
We will learn how to combine two external GraphQL APIs (Countries API and Cocktail API) into our Hygraph project and query all the data with a single GraphQL query from client side. Basically, the client would not even know that the data is coming from different places.
Let's add a new field to the Author schema. This field will be the Country code; we will use this code to query for data related to that country from the Countries API that we'll be adding as a remote source.
Let's now proceed to add a remote source to the Hygraph project. This can be done by navigating to the schema tab and clicking on Remote sources. A form will appear in which we can fill in the required information, such as the name and external API ( REST or GraphQL API). For this article, both remote sources would be GraphQL APIs.
After adding a remote source, it's time to add a remote field to a model. This will help us to set arguments that can be used to query the external API and show the data that we need. For example, we would want to send the country code to the external API to fetch country information.
Editor's Note
We can only add a remote field after at least one remote source of the corresponding type has been configured. If it is a GraphQL API, you can only create a GraphQL remote field; the same applies to REST.
In the above demo, a GraphQL remote field is added for the remote country API. We will receive a list of entry points in the query field. We can select the entry point from which we want to get data and pass arguments. In the above example, we are getting a particular country from the list of countries whose country code matches the author's country code.
We can now test if it works by adding content to the author schema, so it fetches the author's country info based on the county code.
In Hygraph, we are not just limited to one remote source. Depending on our account plan, we can add as many remote sources as required. Let's add a second remote source to this project to illustrate that we can add multiple sources and also query all the sources with one GraphQL query.
This second remote source would be a Cocktail API. The authors can provide the name of their favorite cocktail, and we can use the data supplied to get more information about the cocktail, such as the ingredient, instructions on how to make it, and lots more. This is done using the same process.
Step 1: Add a remote source
Like we added the remote source country API, we can also add the Cocktail API by following the same steps.
Step 2: Create a GraphQL remote field
Before creating the remote field, we can create a field for the data we will use to query for a particular cocktail. For this, we will create two fields, the "Best cocktail" field for the author to submit the best cocktail of his/her choice, then a slug field (Cocktail Slug) that will automatically convert the "Best cocktail" data to slug.
We can now create the GraphQL remote field to query for a particular cocktail with the slug value.
Step 3: Test the remote source
We have created a GraphQL remote field for the cocktail Info. Let's now test it by adding the author's best cocktail, which would generate a slug value, and then we can use it to get the particular cocktail information.
At this point, we have successfully added and combined multiple remote sources into our Hygraph project. Let's now create a GraphQL query to fetch the author's data, including the name, country name, and flag alongside the author's best cocktail, its ingredients, and the instructions for making it.
query AuthorsInfo{
authors {
firstName
lastName
bio
bestCocktail
cocktailInfo {
info
ingredients
instructions
}
countryInfo {
name
emoji
capital
code
currency
}
}
}
This will return all the various values, including the ones from the remote sources in a single place
{
"data":{
"authors":[
{
"firstName":"John ",
"lastName":"Doe",
"bio":null,
"bestCocktail":"paloma",
"cocktailInfo":{
"info":"Alcoholic",
"ingredients":"Grape Soda Tequila",
"instructions":"Stir Together And Serve Over Ice."
},
"countryInfo":{
"name":"Brazil",
"emoji":"🇧🇷",
"capital":"Brasília",
"code":"BR",
"currency":"BRL"
}
}
]
}
}
This is one of the superpowers that Hygraph possesses, and GraphQL provides. You can explore more by reading the remote sources documentation and this guide and talk on content federation.
In this article, we have learned the advantages of running multiple GraphQL queries at once. Also, we went through how to add multiple sources to our Hygraph project and fetch data from external APIs alongside our original data using a single GraphQL query.
Thanks for reading, and have fun coding!
Blog Author
Joel Olawanle
Joel Olawanle is a Frontend Engineer and Technical writer based in Nigeria who is interested in making the web accessible to everyone by always looking for ways to give back to the tech community. He has a love for community building and open source.
Share with others
Sign up for our newsletter!
Be the first to know about releases and industry news and insights.