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.
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.
It's not recommended you enable Public API Permissions for mutations, but instead use a Permanent Auth Token for mutating data.
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.
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.
Argument
Input Type
Description
where
ProductManyWhereInput
Filtering criteria for entries you want to update.
data
CreateInput!
An object that specifies the data you'd like to update matching entries with.
first
Int
Seek forwards from end of result set.
last
Int
Seek backwards from start of result set.
skip
Int
Skip result set by given amount.
before
ID
Seek backwards before specific ID.
after
ID
Seeks forwards after specific ID.
If you do not pass any filters, then the first 10 entries will be updated. See Pagination for updating pages.
For example, let's update all products where featured: true, to be featured: false.
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.
Argument
Input Type
Description
where
ProductManyWhereInput
Filtering criteria for entries you want to delete.
first
Int
Seek forwards from end of result set.
last
Int
Seek backwards from start of result set.
skip
Int
Skip result set by given amount.
before
ID
Seek backwards before specific ID.
after
ID
Seeks forwards after specific ID.
If you do not pass any filters, then the first 10 entries will be deleted. See Pagination for updating pages.
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.
It's not recommended you enable Public API Permissions for mutations, but instead use a Permanent Auth Token for mutating data.
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.
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.
Argument
Input Type
Description
where
ProductManyWhereInput
Filtering criteria for entries you want to update.
data
CreateInput!
An object that specifies the data you'd like to update matching entries with.
first
Int
Seek forwards from end of result set.
last
Int
Seek backwards from start of result set.
skip
Int
Skip result set by given amount.
before
ID
Seek backwards before specific ID.
after
ID
Seeks forwards after specific ID.
If you do not pass any filters, then the first 10 entries will be updated. See Pagination for updating pages.
For example, let's update all products where featured: true, to be featured: false.
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.
Argument
Input Type
Description
where
ProductManyWhereInput
Filtering criteria for entries you want to delete.
first
Int
Seek forwards from end of result set.
last
Int
Seek backwards from start of result set.
skip
Int
Skip result set by given amount.
before
ID
Seek backwards before specific ID.
after
ID
Seeks forwards after specific ID.
If you do not pass any filters, then the first 10 entries will be deleted. See Pagination for updating pages.