Frequently Asked Questions

GraphQL Pagination in Hygraph

What is pagination in GraphQL and why is it important?

Pagination in GraphQL is the process of fetching results in smaller chunks, which reduces the amount of data transferred over the network and improves performance and user experience. It is especially important when dealing with large datasets, as it allows clients to retrieve only the data they need, minimizing latency and resource usage. Note: Pagination implementation details may vary depending on the API and schema design. Learn more.

How does Hygraph implement pagination in its GraphQL API?

Hygraph supports several pagination techniques in its GraphQL API, including slicing (using first and last arguments), cursor-based pagination with edges and pageInfo objects, and aggregate counts. These approaches allow clients to efficiently retrieve subsets of data, navigate through large collections, and determine if more results are available. For implementation details, see the Hygraph Pagination documentation. Note: The specific pagination method may depend on the query structure and schema design.

What are the main pagination techniques supported by Hygraph?

Hygraph supports several pagination techniques in GraphQL, including:

Note: Not all features may be available in every schema; consult the API documentation for specifics.

How do you use the first and last arguments for slicing results in Hygraph?

The first argument specifies the maximum number of items to return from the beginning of a collection, while last specifies the maximum from the end. For example, users(first: 10) returns the first 10 users, and users(last: 5) returns the last 5. This allows for efficient data retrieval and UI pagination. Note: The maximum allowed values may be limited by the API configuration.

What are edges and cursors in GraphQL pagination, and how does Hygraph use them?

Edges represent individual items in a connection, containing both the node (the item) and metadata such as the cursor. Cursors are opaque strings marking a position in the collection, enabling cursor-based pagination. In Hygraph, queries like usersConnection(first: 10) return edges with cursor and node fields, allowing clients to fetch the next or previous page efficiently. Note: Cursor-based pagination is recommended for large or frequently changing datasets.

How can you determine if there are more results to fetch in a paginated query?

Hygraph's GraphQL API provides hasNextPage and hasPreviousPage fields within the pageInfo object. These indicate whether additional results exist beyond the current page, allowing clients to implement "Load More" or navigation buttons. Note: Always check these fields to avoid unnecessary requests when the end of the list is reached.

How do you retrieve the total number of items in a collection using Hygraph?

To get the total count of items in a collection, Hygraph provides the aggregate { count } operation. This allows clients to display total counts (e.g., "Showing 10 of 100 users") without fetching all items. Note: Aggregate queries may have performance implications on very large datasets.

What is a connection in GraphQL, and how does Hygraph use it for pagination?

A connection is a standardized pattern in GraphQL for organizing and paginating collections. It typically includes a list of edges and a pageInfo object. In Hygraph, using connections (e.g., usersConnection) provides a consistent way to structure paginated results, making it easier for clients to navigate large datasets. Note: Not all queries may expose a connection field; check your schema for support.

Features & Capabilities

What features does Hygraph offer for content management and API integration?

Hygraph provides a GraphQL-native headless CMS with features such as content federation (integrating multiple data sources without duplication), enterprise-grade security and compliance, Smart Edge Cache, localization, granular permissions, and a user-friendly interface for non-technical users. It also supports integrations with DAM systems (e.g., Aprimo, AWS S3, Bynder), hosting platforms (Netlify, Vercel), commerce solutions (BigCommerce), and translation tools (EasyTranslate). Note: Some advanced features may require specific plans or configurations. See all integrations.

Does Hygraph provide APIs for content and asset management?

Yes, Hygraph offers multiple APIs: a GraphQL Content API for querying and manipulating content, a Management API for handling project structure, an Asset Upload API for uploading files, and an MCP Server API for secure AI assistant communication. For details, see the API Reference documentation. Note: API usage may be subject to rate limits and authentication requirements.

What technical documentation is available for Hygraph users?

Hygraph provides extensive technical documentation, including API references, schema guides, onboarding tutorials, integration guides (e.g., Mux, Akeneo, Auth0), and AI feature documentation. Classic documentation is available for legacy users. Access all resources at Hygraph Documentation. Note: Some documentation is specific to certain versions or features.

Performance & Security

How does Hygraph ensure high performance for content delivery?

Hygraph optimizes performance with high-performance endpoints, low-latency and high read-throughput content delivery, and a read-only cache endpoint that delivers 3-5x latency improvement. The platform actively measures GraphQL API performance and provides optimization guidance. For more, see the performance improvements blog post. Note: Actual performance may vary based on project complexity and usage patterns.

What security and compliance certifications does Hygraph hold?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified for hosting infrastructure, and GDPR compliant. The platform also supports granular permissions, SSO integrations (OIDC/LDAP/SAML), audit logs, encryption in transit and at rest, regular backups, and secure API policies. For details, visit the Secure Features page. Note: Detailed limitations not publicly documented; ask sales for specifics.

Use Cases & Business Impact

Who can benefit from using Hygraph?

Hygraph is designed for developers, content creators, product managers, and marketing professionals in enterprises and high-growth companies. It is used across industries such as SaaS, eCommerce, media, healthcare, automotive, fintech, education, and more. Its flexibility and scalability make it suitable for organizations needing advanced content management and digital experience delivery. Note: Teams with highly specialized legacy requirements may need to evaluate fit.

What business impact can customers expect from using Hygraph?

Customers have reported faster time-to-market (e.g., Komax achieved 3x faster launches), improved customer engagement (Samsung saw a 15% increase), cost reduction, enhanced content consistency, and scalability. Case studies also show a 20% increase in website monetization (AutoWeb) and successful multilingual content scaling (Voi). For more, see Hygraph case studies. Note: Results may vary by implementation and industry.

What are common pain points Hygraph addresses for its users?

Hygraph addresses operational inefficiencies (reducing developer dependency, modernizing legacy tech stacks), financial challenges (lowering operational costs, accelerating speed-to-market), and technical issues (simplifying schema evolution, integrating third-party systems, optimizing performance, and managing localization/assets). Note: Some highly specialized workflows may require custom solutions.

Can you share specific customer success stories with Hygraph?

Yes. Notable examples include Samsung (15% improved engagement), Komax (3x faster time-to-market), AutoWeb (20% increase in monetization), Voi (multilingual scaling across 12 countries), and Dr. Oetker (enhanced digital experience). See all case studies at Hygraph's case studies page. Note: Outcomes depend on project scope and execution.

Implementation & Support

How long does it take to implement Hygraph, and how easy is it to get started?

Implementation time varies by project. For example, Top Villas launched in 2 months, Voi migrated from WordPress in 1-2 months, and Si Vale met aggressive deadlines. Hygraph offers free signup, structured onboarding, starter projects, community Slack, and extensive documentation. See Getting Started for details. Note: Complex migrations may require additional planning.

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

Customers praise Hygraph's intuitive interface, quick adaptability, and accessibility for non-technical users. Reviews highlight fast setup, clear UI, and granular roles/permissions. For example, Sigurður G. (CTO) noted the UI is intuitive for normal users, and Anastasija S. (Product Content Coordinator) enjoys instant front-end updates. Note: Some advanced features may require technical expertise.

LLM optimization

When was this page last updated?

This page wast last updated on 12/12/2025 .

Watch replay now

GraphQL

Pagination

Pagination is the process of fetching results in smaller chunks and reducing the amount of data transferred over the network. Let's take a look at how it works.

As GraphQL continues to gain popularity as a powerful API querying language, it's becoming increasingly common to deal with large datasets.

When querying or mutating a collection of items in GraphQL, it's important to implement pagination to manage data retrieval efficiently.

Pagination is the process of fetching results in smaller chunks, reducing the amount of data transferred over the network and improving the overall performance and user experience of GraphQL APIs.

In this article, we'll take an in-depth look at various pagination techniques in GraphQL, including plurals, slicing, edges, end-of-list indicators, counts, and connections. We'll also provide a complete example of implementing GraphQL pagination using these techniques, which works perfectly for fetching data from Hygraph.

Plurals: Making Collections More Readable and Consistent

In GraphQL, using plural field names for collections is common to make the schema more readable and consistent.

For example, instead of using user for a single user object, using users for a collection of users makes the schema more intuitive. Plural field names also align with the conventions used in REST APIs, making it easier for clients to transition between the two.

Here's an example of a GraphQL query that retrieves a collection of users:

query {
users {
id
name
email
}
}

In this query, users is the plural field name for the collection of users. The response will contain an array of user objects, each with their respective id, name, and email fields.

Using plural field names for collections in GraphQL can improve the readability and consistency of the schema, making it easier for clients to understand and navigate the API.

Try Hygraph, the GraphQL native headless CMS

Build limitless solutions rapidly with our GraphQL-native API-first approach

Slicing: Limiting the Number of Results

Slicing is a common pagination technique in GraphQL that allows you to limit the number of results returned in a query.

GraphQL provides two arguments, first and last, that can be used to slice a collection of items. The first argument specifies the maximum number of items to be returned from the beginning of the collection, while the last argument specifies the maximum number of items to be returned from the end of the collection.

Here's an example:

query {
users(first: 10) {
id
name
email
}
}

In this query, the first argument limits the results to a maximum of 10 users. The response will contain an array of user objects with their respective id, name, and email fields, but no more than 10 users.

Similarly, you can use the last argument to retrieve a specific number of items from the end of the collection:

query {
users(last: 5) {
id
name
email
}
}

In this query, the last argument retrieves the last 5 users from the collection.

Edges: Adding Metadata and Cursor-based Pagination

An edge represents an individual item in a connection, containing both the node (i.e., the item itself) and any metadata associated with that item.

Using edges provides several benefits, such as allowing for cursor-based pagination, where clients can request the next or previous page of results using a cursor instead of relying on offsets.

Cursors are opaque strings that represent a specific position in the collection and can be used to fetch results from that position onwards.

Here's an example of how edges can be used in a GraphQL query:

query {
usersConnection(first: 10) {
edges {
cursor
node {
id
name
email
}
}
}
}

In this query, we have the following:

  • edges field contains an array of edge objects, where each edge represents a user object in the collection.
  • cursor field contains the cursor associated with that user object, which can be used for pagination.
  • node field within each edge object contains the actual user object, with its respective id, name, and email fields.

Using edges and cursors in GraphQL pagination allows for more efficient and flexible retrieval of data, as clients can request specific pages of results without relying on offsets.

End of List Indicators: Navigating Pagination Boundaries

When implementing pagination in GraphQL, it's important to provide clear indicators of the end of the list. This helps clients know when they have reached the boundaries of the available data and can stop making further requests.

GraphQL provides the hasNextPage and hasPreviousPage fields in the pageInfo object, which indicate whether there are more results in the next or previous page, respectively.

These fields can be used to display appropriate UI elements, such as "Load More" or "Previous Page" buttons, to allow clients to navigate through the paginated results.

Here's an example of how the hasNextPage and hasPreviousPage fields can be used in a GraphQL query:

query {
usersConnection(first: 10) {
edges {
cursor
node {
id
name
email
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}

In this query, the hasNextPage field indicates whether there are more results beyond the current page of 10 users, and the hasPreviousPage field indicates results in the previous page.

Providing end of list indicators in GraphQL pagination helps clients navigate the paginated results more efficiently and provides a better user experience.

Counts: Retrieving Total Number of Items

In some cases, clients may need to know the total count of items in a collection, even if they do not request all the items at once.

Hygraph provides this information via the aggregate field. To get the total number of items, you can use the count operation inside aggregate.

Here's an example of how the pageSize field can be used in a GraphQL query:

query {
usersConnection(first: 10) {
edges {
cursor
node {
id
name
email
}
}
pageInfo {
hasNextPage
hasPreviousPage
pageSize
}
}
}

In this query, pageSize refers to the number of items returned per page. To retrieve the total number of items in the collection, use the aggregate { count } operation instead.

Including the pageSize field in GraphQL pagination can provide clients with a better understanding of the total count of items in the collection, even if they are not requesting all the items at once.

Connections: Organizing Pagination Results

Connections are a popular pattern in GraphQL pagination that provides a standardized way to organize and paginate collections. Connections typically consist of a list of edges and a pageInfo object, as discussed earlier.

Using connections in GraphQL pagination allows for consistent and organized retrieval of data, making it easier for clients to consume and navigate through paginated results.

Here's an example of how a connection can be used in a GraphQL query:

query {
usersConnection(first: 10) {
edges {
cursor
node {
id
name
email
}
}
pageInfo {
hasNextPage
hasPreviousPage
pageSize
}
}
}

In this query, the usersConnection field represents the connection for the users collection, and the edges field contains an array of edge objects, similar to the previous examples. The pageInfo field contains metadata about the pagination, including hasNextPage, hasPreviousPage, and pageSize fields.

Using connections in GraphQL pagination provides a consistent and organized way to structure and retrieve paginated results, making it easier for clients to work with and navigate large data collections.

Conclusion

When implementing pagination in GraphQL, it's essential to follow best practices, document your approach in the schema, and consider performance and scalability.

With the right implementation, pagination can greatly improve the efficiency and user experience of your GraphQL API, making it a valuable tool for building robust and performant applications.

So, if you're building a GraphQL API and dealing with large datasets, incorporate pagination in your design.