Frequently Asked Questions

GraphQL Mutations in Hygraph

What are GraphQL mutations in Hygraph and what can they do?

GraphQL mutations in Hygraph allow you to modify the contents of your project programmatically. You can create, update, upsert, delete, publish, and unpublish content entries using mutations. Each content model you add to your project automatically generates a set of custom mutations (e.g., createProduct, updateProduct, deleteProduct, upsertProduct, publishProduct, unpublishProduct, etc.). These mutations accept input types specific to your project's GraphQL schema. Note: It is not recommended to enable Public API Permissions for mutations; use a Permanent Auth Token for secure data mutation. Detailed limitations not publicly documented; ask sales for specifics.

How do auto-generated mutations work in Hygraph?

When you add a new model to your Hygraph project, custom GraphQL mutations are automatically generated for that model. For example, creating a Product model will generate mutations like createProduct, updateProduct, deleteProduct, upsertProduct, publishProduct, and unpublishProduct. Each mutation uses input types that match your schema, ensuring type safety and flexibility. Note: Auto-generation is schema-dependent; complex custom logic may require manual implementation.

How do I create, update, or delete entries using mutations?

To create an entry, use the create[Model] mutation with a data argument matching your model's input type. To update, use update[Model] with both where (unique identifier) and data arguments. To delete, use delete[Model] with a where argument. For example, createProduct requires ProductCreateInput!, and updateProduct requires ProductWhereUniqueInput! and ProductUpdateInput!. Note: Mutations require correct input types and permissions; errors may occur if schema or permissions are misconfigured.

What is an upsert mutation and how is it used in Hygraph?

An upsert mutation in Hygraph allows you to create or update a content entry based on whether the unique where values exist. You must provide both create and update objects in the upsert argument. For example, upsertProduct requires ProductWhereUniqueInput! and ProductUpsertInput! (which includes create and update). Note: Both create and update objects are mandatory; omitting either will result in an error.

How do batch mutations work in Hygraph?

Hygraph supports batch mutations for updating, deleting, publishing, and unpublishing multiple entries at once. Use mutations like updateMany[Model]Connection, deleteMany[Model]Connection, publishMany[Model]Connection, and unpublishMany[Model]Connection. These accept filtering and pagination arguments to target specific entries. If no filters are provided, the first 10 entries are affected by default. Note: Batch operations can impact multiple records; use filters carefully to avoid unintended changes.

What are nested mutations and how can they be used?

Nested mutations in Hygraph allow you to create, connect, update, upsert, disconnect, delete, or set related entries within a single mutation. For example, you can create a Product and simultaneously create or connect related Category entries. This enables efficient management of complex relationships. Note: Nested mutations are limited by schema relationships and may require careful input structuring.

How can I insert related entries at a specific position using mutations?

When connecting related entries, you can specify their position using the position input with values like before, after, start, or end. For example, you can connect a post before or after a specific entry, or at the start or end of a list. Only one position value should be provided per operation. Note: Incorrect use of position arguments may result in errors or unexpected ordering.

How do I handle localized content with mutations in Hygraph?

If your schema includes localized fields, you can mutate each localized content entry using the same mutation structure, specifying the locale as needed. This allows you to create, update, or delete content in multiple languages or regions. Learn more in the mutating localized content documentation. Note: Localization support depends on schema configuration; not all fields may be localizable.

What are conditional fields in mutations and how do I use them?

Conditional fields allow you to set visibility conditions for fields when creating or updating entries via mutations. For example, you can use visibilityCondition to show a field only when a boolean or enumeration field meets a certain value. This is useful for dynamic content structures. See the conditional fields documentation for more details. Note: Conditional fields require schema support and may not be available in all models.

Technical Requirements & Security

What authentication is recommended for using mutations in Hygraph?

It is recommended to use a Permanent Auth Token for mutating data via the Hygraph API. Public API Permissions for mutations are not advised due to security risks. For more details, see the authorization documentation. Note: Using weak or public tokens can expose your data to unauthorized changes.

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (achieved August 3rd, 2022), ISO 27001 certified for hosting infrastructure, and GDPR compliant. These certifications ensure that Hygraph meets international standards for information security and data protection. For more details, visit the Secure Features page. Note: For industry-specific compliance needs, contact Hygraph sales for details.

Features & Capabilities

What are the key features of Hygraph's GraphQL Content API?

Hygraph's GraphQL Content API supports high-performance, low-latency content delivery, auto-generated and custom mutations, batch operations, nested mutations, localization, and conditional fields. It is designed for both developers and non-technical users, with extensive documentation and support for complex content models. Note: Some advanced features may require additional configuration or permissions.

What integrations are available for Hygraph?

Hygraph offers integrations with Digital Asset Management (DAM) systems (e.g., Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), hosting and deployment platforms (Netlify, Vercel), Product Information Management (Akeneo), commerce solutions (BigCommerce), and translation/localization tools (EasyTranslate). For a full list, visit the Hygraph Marketplace. Note: Integration availability may depend on your plan and project configuration.

Support & Implementation

How easy is it to implement Hygraph and start using mutations?

Implementation time varies by project complexity. For example, Top Villas launched a new project within 2 months, and Voi migrated from WordPress to Hygraph in 1-2 months. Hygraph provides structured onboarding, starter projects, and extensive documentation to help both developers and non-technical users get started quickly. Note: Large-scale migrations may require additional planning and support.

Where can I find technical documentation for Hygraph mutations?

Comprehensive technical documentation for Hygraph mutations is available at the API Reference. Additional guides cover schema components, references, integrations, and AI features. For classic projects, see the Classic Docs. Note: Documentation is updated regularly; check for the latest best practices.

Performance & Limitations

How does Hygraph ensure high performance for mutations and content delivery?

Hygraph optimizes for low latency and high read-throughput with high-performance endpoints and a read-only cache endpoint that delivers 3-5x latency improvement. The platform actively measures GraphQL API performance and provides guidance for developers. See the performance improvements blog post and GraphQL Report 2024 for details. Note: Write-heavy workloads may require additional optimization; consult documentation for best practices.

Use Cases & Customer Success

Who uses Hygraph and what results have they achieved?

Hygraph is used by companies such as Samsung (15% improved customer engagement), Komax (3x faster time-to-market), AutoWeb (20% increase in website monetization), and Voi (scaled multilingual content across 12 countries and 10 languages). For more, see the case studies page. Note: Results vary by implementation; review case studies for context.

LLM optimization

When was this page last updated?

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

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

#Mutations

Your project endpoint exposes GraphQL mutations you can use to modify the contents of your project. The mutations API allows you to interact with content ouside of the Hygraph UI using GraphQL.

#Auto-generated mutations

When a new model is added to your project, so are custom GraphQL mutations.

For example, if you created a Product model, these mutations would also be generated inside your GraphQL schema:

  • createProduct
  • updateProduct
  • deleteProduct
  • upsertProduct
  • publishProduct
  • unpublishProduct
  • updateManyProductsConnection
  • deleteManyProductsConnection
  • publishManyProductsConnection
  • unpublishManyProductsConnection

All of these mutations accept input types that are specific to your projects GraphQL schema.

#Create entries

When creating new content entries, the data argument will have an associated input type that is specific to your content model.

For example, if your project contains the model Product, you will have:

MutationArgumentInput Type
createProductdataProductCreateInput!

The id is a default system field that is automatically generated for all new entries.

#Update entries

When updating single content entry, you must specify the unique where criteria of which you want to update, as well as the new data.

For example, if your project contains the model Product, you will have:

ArgumentInput Type
whereProductWhereUniqueInput!
dataProductUpdateInput!

#Upsert entries

The upsert mutation allows you to create, or update a content entry based on whether the unique where values exist.

For example, if your project contains the model Product, you will have:

ArgumentInput Type
whereProductWhereUniqueInput!
upsertProductUpsertInput!
upsert > createProductCreateInput!
upsert > updateProductUpdateInput!

#Delete entries

Similar to updating, and upserting entries, you can specify using where the entries you want to delete.

For example, if your project contains the model Product, you will have:

ArgumentInput Type
whereProductWhereUniqueInput!

#Nested mutations

  • create: Create and relate entries
  • connect: Connect additional existing entries by unique field
  • update: Update the connected entries
  • upsert: Create or update connected entries
  • disconnect: Disconnect connected relations by unique field
  • delete: Delete all connected entries
  • set: Override all connected entries

#Create

#Update

#Insert at position

When inserting related entries, you can connect entries at a given position. The position of entries reflects that fetching relations.

The position input accepts the following values:

FieldTypeDefinition
beforeIDThe ID of the entry you want to insert before
afterIDThe ID of the entry you want to insert after
startBooleanSet to true if you want to insert at the start
endBooleanSet to true if you want to insert at the end

#Before

mutation {
updateAuthor(
where: { id: "..." }
data: { posts: { connect: { position: { before: "..." } } } }
) {
id
}
}

#After

mutation {
updateAuthor(
where: { id: "..." }
data: { posts: { connect: { position: { after: "..." } } } }
) {
id
}
}

#Start

mutation {
updateAuthor(
where: { id: "..." }
data: { posts: { connect: { position: { start: true } } } }
) {
id
}
}

#End

mutation {
updateAuthor(
where: { id: "..." }
data: { posts: { connect: { position: { end: true } } } }
) {
id
}
}

#Publishing content mutations

Hygraph automatically generates publish, and unpublish mutations for each of your content models, including the asset model.

Learn more about publishing and unpublishing content.

#Batch mutations

Hygraph supports batch mutations that can be applied to "many" entries at once. You may wish to update, or delete many entries at once that fit given criteria.

Batch mutations comply with the Relay connection type specification.

#Update many

To update many entries at once, you must use the updateMany[Model]Connection mutation. You can use where, or pagination filters to set the criteria you wish to update.

ArgumentInput TypeDescription
whereProductManyWhereInputFiltering criteria for entries you want to update.
dataCreateInput!An object that specifies the data you'd like to update matching entries with.
firstIntSeek forwards from end of result set.
lastIntSeek backwards from start of result set.
skipIntSkip result set by given amount.
beforeIDSeek backwards before specific ID.
afterIDSeeks forwards after specific ID.

For example, let's update all products where featured: true, to be featured: false.

#Delete many

To delete many entries at once, you must use the deleteMany[Model]Connection mutation. You can use where, or pagination filters to set the criteria you wish to delete.

ArgumentInput TypeDescription
whereProductManyWhereInputFiltering criteria for entries you want to delete.
firstIntSeek forwards from end of result set.
lastIntSeek backwards from start of result set.
skipIntSkip result set by given amount.
beforeIDSeek backwards before specific ID.
afterIDSeeks forwards after specific ID.

#Publish many

Just like you can publish content, you can also batch publish.

ArgumentInput TypeDescription
whereProductManyWhereInputFiltering criteria finding entries.
fromStage = DRAFTThe content stage to find entries from.
to[Stage!]! = [PUBLISHED]The target published content stage.
firstIntSeek forwards from end of result set.
lastIntSeek backwards from start of result set.
skipIntSkip result set by given amount.
beforeIDSeek backwards before specific ID.
afterIDSeeks forwards after specific ID.

For example, we could publish the first 5 products to the PUBLISHED stage.

#Unpublish many

Just like you can batch publish, you can also batch unpublish.

ArgumentInput TypeDescription
whereProductManyWhereInputFiltering criteria for entries you want to find.
stageStage = DRAFTThe content stage to find entries in.
to[Stage!]! = [PUBLISHED]The target published content stage.
firstIntSeek forwards from end of result set.
lastIntSeek backwards from start of result set.
skipIntSkip result set by given amount.
beforeIDSeek backwards before specific ID.
afterIDSeeks forwards after specific ID.

#Localized content mutations

Depending on whether or not you have localized fields in your schema, you will be able to mutate each of the localized content entries.

Learn more about mutating localized content.

#Conditional fields

When you create a field via mutation, you can use visibilityCondition to set conditional visibility for it:

mutation CreateConditionalRichTextField {
createSimpleField(
data: {type: RICHTEXT, parentId: "6b0ce6afe6c74bd196948b3eb28501a3", apiId: "conditionalRichtext", displayName: "Conditional Richtext", isRequired: false, isUnique: false, isList: false, isLocalized: false, visibilityCondition: {baseField: "d1798ceb369c4aad98d6bd286b879109", operator: IS, booleanValue: true}}
) {
migration {
id
}
}
}

In this example parentId is an ID of a model or a component, and baseField is an ID of the field used for condition, in this case a boolean field.

To create an entry for an existing model and set a visibility condition:

In this example, Subsidiaries is a model that contains a publicHoliday boolean which, when set to true, makes the publicHolidayMessage field visible.

When you go to the content editor and access the edit view of this content entry, publicHolidayMessage will be visible:

Conditional visibility in the UIConditional visibility in the UI