Frequently Asked Questions

GraphQL Mutations & Technical Capabilities

What are GraphQL Mutations and how are they used in Hygraph?

GraphQL Mutations are entry points on a GraphQL server that provide write access to data sources. In Hygraph, mutations allow you to create, update, and delete data efficiently. For example, you can use mutations to manage users, contacts, and labels in a Contact Manager system. Hygraph's API playground provides interactive documentation and examples for defining and executing mutations. Learn more in the Hygraph documentation.

What types of mutations does Hygraph support?

Hygraph supports three main types of mutations: Create, Update, and Delete. Additionally, advanced mutations such as Bulk Mutations (modifying multiple records in one request) and Nested Mutations (performing operations on related entities in a single request) are available. These capabilities help improve efficiency and reduce the number of client-server round-trips. See mutation examples in the documentation.

Does Hygraph provide an API for managing content and schemas?

Yes, Hygraph offers a variety of APIs, including the GraphQL Content API for querying and managing content, the GraphQL Management API for schema changes, and both REST and GraphQL APIs for integration with external systems. Developers can access and manage content programmatically, with options for public exposure and selective permissions. Explore Hygraph's API documentation.

Where can I find technical documentation and resources for Hygraph?

Hygraph provides comprehensive technical documentation, including guides, API references, and interactive API playgrounds. Key resources include the Hygraph Documentation, API Playground, and workflow guides. These resources support both technical and non-technical users in exploring and utilizing Hygraph effectively.

Features & Capabilities

What are the key features and benefits of Hygraph?

Hygraph is a GraphQL-native Headless CMS with features such as Smart Edge Cache for fast content delivery, Content Federation to integrate data from multiple sources, Rich Text SuperPowers for advanced formatting, Custom Roles for granular access control, and Project Backups for data safety. Business benefits include speed-to-market, scalability, lower total cost of ownership, improved content workflows, and robust security and compliance (SOC 2 Type 2, ISO 27001, GDPR). Learn more about Hygraph's features.

What integrations are available with Hygraph?

Hygraph supports integrations with digital asset management (Aprimo, AWS S3, Bynder, Cloudinary, Mux, Scaleflex Filerobot), hosting and deployment (Netlify, Vercel), headless commerce (BigCommerce, commercetools, Shopify), localization (Lokalise, Crowdin, EasyTranslate, Smartling), personalization (Ninetailed), AI (AltText.ai), and more. See the full list of integrations.

How does Hygraph perform in terms of speed and scalability?

Hygraph leverages state-of-the-art caching and robust edge services for low latency and high read-throughput. It supports rapid content delivery, 7X higher content velocity, 125% traffic growth, and 120% more website clicks. Hygraph is used in 40+ global markets and by 100+ stakeholders, making it suitable for large-scale operations. Read more about performance.

Use Cases & Business Impact

Who can benefit from using Hygraph?

Hygraph is designed for developers, IT decision-makers, content creators, project managers, agencies, and technology partners. It is valuable for modern software companies, enterprises seeking to modernize, brands scaling across geographies, and organizations re-platforming from legacy solutions. Explore use cases.

What business impact can customers expect from Hygraph?

Customers report up to 3X faster time-to-market (Komax), 20% increase in website monetization (AutoWeb), 15% higher customer engagement (Samsung), 7X higher content velocity, and 125% traffic growth. Hygraph enables efficient scaling, improved workflows, and measurable growth. See customer success stories.

What industries are represented in Hygraph's case studies?

Hygraph's case studies span eCommerce, automotive, healthcare, consumer electronics, media and publishing, food and beverage, travel and hospitality, engineering, government, and SaaS. Browse industry case studies.

Can you share specific customer success stories using Hygraph?

Yes. Komax achieved 3X faster time-to-market and managed 20,000+ product variations across 40+ markets. Samsung saw a 15% increase in customer engagement. Dr. Oetker ensured global consistency with MACH architecture. Sennheiser increased e-commerce conversions by 136.7% in 4 months. Stobag improved online revenue share from 15% to 70%. Read more customer stories.

Ease of Use & Implementation

How easy is it to get started with Hygraph?

Hygraph is recognized as the #1 easiest to implement headless CMS. Customers can start building for free with a developer account, and enterprise users can request a demo. The onboarding process includes introduction calls, account provisioning, business and technical kickoffs, and content schema planning. Top Villas launched a new project in just 2 months. Try Hygraph for free.

What resources and training are available for new Hygraph users?

Hygraph provides structured onboarding, comprehensive documentation, technical training sessions, webinars, live streams, and hands-on guidance. Customers can access a resource hub, developer hub, and community Slack channel for support. See onboarding resources.

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

Customers praise Hygraph's intuitive editor UI, logical workflows, and accessibility for non-technical users. The platform is described as super easy to set up and use, with positive sentiments from both technical and non-technical teams. Customization features and streamlined collaboration are frequently highlighted. Read customer feedback.

Support, Maintenance & Troubleshooting

What customer support options are available after purchasing Hygraph?

Hygraph offers 24/7 support via chat, email, and phone. Enterprise customers receive a dedicated Customer Success Manager and SLAs for critical issues (resolved in less than an hour). Extensive documentation, onboarding assistance, community Slack, Intercom chat, and training resources are available. See support details.

How does Hygraph handle maintenance, upgrades, and troubleshooting?

Hygraph's cloud-based infrastructure manages server updates, security patches, and performance optimizations automatically. Upgrades are delivered continuously, and troubleshooting is supported by audit logs, monitoring, and performance reporting. Customers have access to 24/7 support and self-service documentation. Learn more about maintenance and troubleshooting.

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (since August 3, 2022), ISO 27001 certified, and GDPR compliant. Security features include granular permissions, audit logs, encryption at rest and in transit, SSO integrations, and automatic backups. Enterprise-grade compliance is supported with dedicated hosting, custom SLAs, and penetration testing. View Hygraph's security report.

Pain Points & Solutions

What common pain points does Hygraph solve for its customers?

Hygraph addresses operational bottlenecks (such as developer dependency for content updates), outdated legacy tech stacks, high maintenance costs, slow speed-to-market, limited integration capabilities, and technical challenges like evolving schemas and cache issues. It streamlines workflows, reduces costs, and enables editorial autonomy. Learn more about Hygraph's solutions.

Customer Proof & Recognition

Who are some of Hygraph's customers?

Hygraph is trusted by leading brands such as Sennheiser, HolidayCheck, Ancestry, JDE, Dr. Oetker, Ashley Furniture, Lindex, Hairhouse, Komax, Shure, Stobag, Burrow, G2I, Epic Games, Bandai Namco, Gamescom, Leo Vegas, Codecentric, Voi, and Clayton Homes. See more customer stories.

Meet Hygraph AI Agents - Your Autonomous Teammates

GraphQL

Mutations

GraphQL Mutations are a GraphQL server's entry points that provide write access to our data sources.

What are GraphQL Mutations?

Just like GraphQL Queries provide entry points for reading data, GraphQL Mutations are entry points on a GraphQL server that provides write access to our data sources. Basically, whenever we need to modify data (i.e. create, update, delete data) on your data source, we will do so through GraphQL mutations. Please go through the GraphQL Queries article before reading this article if you are new to GraphQL. In this article, we will cover the fundamentals of GraphQL Mutations.

This is how a basic mutation is defined like in a GraphQL Schema, here we are defining a mutation that will take userInput variable of type User! and returns the newly created User.

# GraphQL Schema
type Mutation {
createUser(userInput: User!): User
}

The structure of a GraphQL Mutation is very similar to a GraphQL Query. Instead of the keyword query, you will be using the keyword mutation in the request. This is how a sample request and response for the above mutation schema will look like

# Mutation Request Sent By Client
mutation CreateUser($userInput: User!) {
createUser(userInput: $userInput) {
id
name
email
}
}
# Variables
{
"userInput": {
"name": "John Doe",
"email": "johndoe@hygraph.com"
}
}
# Response
{
"data": {
"createUser": {
"id": "1",
"name": "John Doe",
"email": "johndoe@hygraph.com"
}
}
}

Again, just like queries, the exact syntax is not fixed and will depend on the implementation of the GraphQL server. The exact syntax will be available in the schema documentation in the API playground.

Types of Mutations

At a high level, there are three types of write operations that we will often come across when wanting to modify data on our data source; Create, Update, and Delete. We will learn from examples throughout this article and use Hygraph’s API playground to fire our mutations. Let us take a small real-world use case and build a HyGraph schema around it.

A Contact Manager system with the following requirements:

  • A User can have multiple Contacts
  • A Contact can have multiple Labels
  • A Label can be used by multiple Contacts

From these requirements we can see that user-contact is a one-to-many relationship and contact-label is a many-to-many relationship.

We will need 4 models to support this use case:

  • User Model
  • Contact Model
  • Label Model
  • Contact Label Model

ERDiagram

If you have your own GraphQL server implementation, you can set up your database tables, GraphQL schema, and resolvers and follow along, we would not be exploring that option as it will diverge the scope too much. We will directly use the Hygraph API you can refer to this article to set up the models and create these relationships.

Try Hygraph, the GraphQL native headless CMS

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

Create Mutation

In our Contact Manager system when we need to create a user, we can define a createUser mutation with input fields for the user's name and email. Here's an example of using a mutation

# Request
mutation createCMUser($cmUser: CmUserCreateInput!) {
createCmUser(data: $cmUser) {
id
name
email
}
}
# Variables
{
"input": {
"name": "Jane Doe",
"email": "janedoe@hygraph.com"
}
}

CreateMutation

This mutation creates a user with the name "John Doe" and email "johndoe@example.com" and returns the user's id, name, and email fields.

Update Mutation

In the Contact Manager system, you may want to update the information for an existing contact. This can be achieved using the update mutation. For simplicity, we will avoid passing variables but in a real-world app, always pass variables.

# Request
mutation updateContact {
updateCmContact(where: {id: "clgj88ayl367u0bpjcps4in22"}, data: {name: "Bob"}) {
id
name
}
}
# Response
{
"data": {
"updateCmContact": {
"id": "clgj88ayl367u0bpjcps4in22",
"name": "Bob"
}
}
}

Delete Mutation

Delete mutations are used to delete an existing record from the database. In the Contact Manager system, we may want to delete a contact, label, or user as per needs.

To delete a record, we first need to identify the unique identifier of the record. In GraphQL, this is typically done using the ID scalar type. Once we have the ID, we can pass it as an argument to the delete mutation.

# Request
mutation deleteLabel {
deleteCmLabel(where: {id: "clgtm0o8d1ux80bpf82eltzn3"}){
id
name
}
}
# Response
{
"data": {
"deleteCmLabel": {
"id": "clgtm0o8d1ux80bpf82eltzn3",
"name": "unused label"
}
}
}

Advanced Mutations

Bulk Mutations

Bulk mutations allow us to modify multiple records in a single request. This significantly reduces the number of round-trips between client and server hence improving the efficiency of the application. For example, if you want to make a request wherein you want to update the company name of multiple users that have hygraph.com as a part of their email, here’s how a bulk mutation for the same would look like

# Request
mutation bulkUpdateUsers {
updateManyCmUsersConnection(
where: { email_contains: "hygraph.com" }
data: { company: "Hygraph" }
) {
aggregate {
count
}
}
}
# Response
{
"data": {
"updateManyCmUsersConnection": {
"aggregate": {
"count": 2
}
}
}
}

Nested Mutations

Nested mutations allow you to perform operations on related entities in one request. It allows you to insert/update data in multiple database tables in one client request only so that you do not have to make multiple trips to the server. For example in our contact manager system: We have a one-to-many relationship between our user-contact entities, if we want to create a user, two contacts for that user also connect them via the foreign key, you can do it using nested mutations.

The example below creates a new user named John Wick and also creates two contacts named Alice and Bob in Hygraph.

# Request
mutation createUserAndContacts {
createCmUser(
data: {
name: "John Wick",
email: "john@test.com",
cmContacts: {
create: [
{ name: "Alice", phone: "789654123" },
{ name: "Bob", phone: "123654798" }
]
}
}) {
name
cmContacts {
name
phone
}
}
}
# Response
{
"data": {
"createCmUser": {
"name": "John Wick",
"cmContacts": [
{
"name": "Alice",
"phone": "789654123"
},
{
"name": "Bob",
"phone": "123654798"
}
]
}
}
}

NestedMutation.png

Best Practices For GraphQL Mutations

Variables, Named Mutations

Just like queries, we should always use named mutations and variables in our mutations too. Named mutations enable us to debug issues by using the operation name and variables allow us to reuse the mutations by passing different values as required.

Mutation Design

We saw how to use pre-designed mutations that were generated by Hygraph, but in case you maintain your own GraphQL server and have resolvers on top of it that power your mutations and queries, here are a few points to keep in mind while creating the design for a mutation.

A mutation should respond back with the data that it modified on the data source. This is not mandatory but it makes things much easy for the client as it doesn’t have to query again to ensure the data has changed on the data source. For instance: A mutation to update a user, should take input for updating the user, make the changes in the database and then respond with the new user object.

# Schema
type Mutation {
UpdateUser(updateUserInput: UpdateUserInput!): User
}
# Request
mutation updateUser {
updateCmUser(
data: { name: "John", email: "john@hygraph.com"},
where: { id: "clgv03rhk08k70bocb648fydz"}
){
id
name
email
}
}
# Response
{
"data": {
"updateCmUser": {
"id": "clgv03rhk08k70bocb648fydz",
"name": "John",
"email": "john@hygraph.com"
}
}
}

A mutation should preferably take in an object instead of multiple scalar fields.

# Recommended
type Mutation {
createUser(createUserInput: CreateUserInput!): User
}
# Not Recommended
type Mutation {
createUser(name: String!, email: String!, ...otherInputFields): User
}

Conclusion

To conclude, GraphQL mutations are the entry points on a GraphQL server that provides write access to data sources. They enable modifications to be made to data sources such as creating, updating, and deleting data. Bulk mutations allow you to make changes to multiple records in a single request, nested mutations allow you to make changes in more than one database entity, and both bulk and nested mutations help improve the efficiency of the application when used correctly. Following best practices of mutations is important to ensure the right mutation design and help with debugging when needed.