How do I create a new content model using the Hygraph Management SDK?
To create a new content model, use the createModel() method. You must provide unique apiId (PascalCase, starts with uppercase), apiIdPlural (must differ from apiId), and displayName. You can also add sidebar elements during creation. Use cases include setting up models like BlogPost, Product, or Author. Note: You cannot create required fields on system models/components, and apiId values must be unique within an environment. For more, see the official docs. Limitation: Permanent deletion of models cannot be undone.
What should I know before updating or deleting a model with the Management SDK?
When updating a model with updateModel(), you can rename models, update descriptions, and manage sidebar elements. Renaming with newApiId updates all references. Deleting a model with deleteModel() is permanent and deletes all entries and fields associated with the model. You cannot delete a model if other models depend on it. Limitation: This action cannot be undone and may cause data loss if not carefully managed.
Management SDK – Fields & Enumerations
How do I add or update simple fields to a model or component?
Use createSimpleField() to add fields like text, date/time, boolean, numeric, rich text, slug, email, or URL. Field apiId must be camelCase and unique. Reserved names (e.g., createdAt, id) cannot be used. When updating with updateSimpleField(), you can change display names, validations, and visibility, but field type is immutable. Limitation: Changing isList or field type may cause data loss; required fields need a migrationValue for existing null entries.
What are the rules for creating and managing enumerations and enum fields?
Enumerations are created with createEnumeration() and must use PascalCase for apiId and UPPER_SNAKE_CASE for values. Enum fields are added with createEnumerableField() and must reference an existing enumeration. Updating or deleting enumerations may break existing entries using those values. Limitation: Enum apiId and values must be unique; removing enum values may cause data loss.
Management SDK – Components & Taxonomies
How do I create and manage components in Hygraph?
Use createComponent() to define reusable field groups (e.g., SEO metadata, contact info). Components can be nested and must have unique PascalCase apiId and apiIdPlural. Updating components allows renaming and updating descriptions, but apiId changes require newApiId. Limitation: Components cannot have required fields if used in multiple places, and deletion is permanent if not referenced elsewhere.
What are taxonomies and how are they managed in the Management SDK?
Taxonomies organize content into hierarchical categories. Use createTaxonomy() to set up a taxonomy with nodes, and createTaxonomyNode() to add nodes. Taxonomy apiId must be PascalCase and unique. Deleting a taxonomy or node is permanent and deletes all children. Limitation: Cannot delete a taxonomy if referenced by fields; must remove all references first.
Management SDK – Relational, Union, and Remote Fields
How do I create and manage relational fields between models?
Use createRelationalField() to link models (e.g., Post → Author). Cardinality (one-to-one, one-to-many, many-to-many) is set at creation and cannot be changed later. For asset relations, isRequired is supported; for regular relations, it is not. Limitation: Changing cardinality requires deleting and recreating the relation, which may cause data loss.
What are union fields and how are they used?
Union fields allow a model to reference multiple other models (e.g., Post can reference Author or Organization). Use createUnionField() to set up, specifying all target model apiIds. Limitation: The list of referenced models replaces the entire list on update; cannot change the entire reverseField structure.
How do I integrate remote sources and fields in Hygraph?
To integrate external APIs, use createGraphQLRemoteSource() or createRESTRemoteSource() to register the remote source, then createRemoteField() to fetch data from that source. The prefix for remote sources is immutable. Limitation: Deleting a remote source is permanent and cannot be undone; must remove all referencing fields first.
Management SDK – Workflows, Locales, and Webhooks
How can I set up content workflows and approval processes?
Use createWorkflow() to define multi-step content approval processes. Each step can specify allowed roles, colors, and publish stages. Steps are created in order, and the first step cannot have returnToStep. Limitation: Deleting a workflow is permanent and may affect entries in progress; consider disabling before deletion.
How do I manage locales for content localization?
Locales are managed with createLocale(), updateLocale(), and deleteLocale(). Locale codes must follow ISO 639-1 (e.g., en, de). Only one locale can be default per environment. Limitation: Deleting a locale is permanent and may affect localized content; cannot delete the default locale.
What are the best practices for creating and updating webhooks in Hygraph?
Webhooks notify external systems of content changes. Use createWebhook() to set up, specifying models, stages, trigger actions, and sources. Updating a webhook replaces entire lists for models, stages, and actions. Limitation: Deleting a webhook is permanent and uses the webhook's UUID, not API ID.
Management SDK – Conditional Visibility & Sidebar Elements
How does conditional visibility work for fields in Hygraph?
Conditional visibility allows fields to be shown or hidden based on another field's value. The visibilityCondition parameter is available for simple, enumerable, component, relational, union, and taxonomy fields. Operators include IS, IS_NOT, CONTAINS_ANY, CONTAINS_ALL, and CONTAINS_NONE. Limitation: Removing a controlling field may break dependent visibility conditions.
How can I add custom sidebar elements or app integrations to models?
Use createCustomSidebarElement() to add app-based sidebar elements to models. Requires appApiId and appElementApiId. For bulk management, use updateModel() to create, update, or delete sidebar elements and set their positions. Limitation: Deleting a sidebar element is permanent and may affect app integrations.
Security, Compliance & Support
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 high standards for data security and privacy. For more details, visit the Hygraph Secure Features page. Limitation: Detailed limitations not publicly documented; ask sales for specifics.
Where can I find technical documentation and support for the Management SDK?
Comprehensive technical documentation is available at Hygraph Management SDK Reference. For onboarding, guides, and community support, visit Hygraph Documentation and join the Slack community at slack.hygraph.com. Limitation: Some advanced scenarios may require direct support from Hygraph.
Setting up one-to-many relations (Author → Posts).
Important notes:
Cardinality is immutable. It is set at creation and cannot be changed later.
isRequired: true is ONLY supported for ASSET type, not RELATION type.
reverseField.modelApiId is the TARGET model being referenced.
For unidirectional relations, reverseField.position should be negative.
For components, reverseField.isList must be true to allow reconnection.
Relation cardinality is set at creation and cannot be changed later. You cannot convert:
One-to-one → One-to-many
One-to-many → Many-to-many
Any other cardinality changes
If you need a different cardinality, you must delete and recreate the relation (which may cause data loss).
For components and unidirectional relations: The reverse side must have isList: true to allow reconnecting entries to the same component instance. Setting isList: false will prevent reconnection and may require recreating the relation.
Steps are created in the order provided unless position is specified. If a position conflicts, the new step is inserted at the next available position.
First step cannot have returnToStep.
roleOverrides at workflow level bypasses all steps.
allowedRoles at step level controls who can work at that step.
publishStages determines which stages can be published from a step.
Steps with conflicting positions are inserted at next available slot.
You can modify the visibility conditions for a number of field types, such as simple, enumerable, component, relational, union, and taxonomy fields. The visibilityCondition parameter is available in the following methods:
createSimpleField()
createEnumerableField()
createComponentField()
createRelationalField()
createUnionField()
createTaxonomyField()
updateSimpleField()
updateEnumerableField()
updateComponentField()
updateTaxonomyField()
visibilityCondition?:{// Optional: Show/hide field based on another field's value
baseField:string,// Required: API ID of the field that controls visibility
When an app is installed via the createAppInstallation method, it is always installed with the PENDING status. Users with the necessary permissions (usually the ADMIN or DEVELOPER roles) must complete the app installation process in Hygraph Studio.
Currently, to use the createAppInstallation method, the app needs to exist in at least one environment within the project. Users can't use this method to install new apps, only apps that they've previously installed in an existing environment.
To create a simple field with custom table and form renderers in an environment, first retrieve the appApiId and appElementApiId using the Management API.
querytest{
viewer{
project(id:"<projectId>"){
environment(name:"<environment_name>"){
appInstallation(appApiId:"<app_name>"){
id
app{
id
apiId
elements{
id
apiId
type
}
}
}
}
}
}
}
Now, create the simple field with custom table and form renderers in the specified environment.
Setting up one-to-many relations (Author → Posts).
Important notes:
Cardinality is immutable. It is set at creation and cannot be changed later.
isRequired: true is ONLY supported for ASSET type, not RELATION type.
reverseField.modelApiId is the TARGET model being referenced.
For unidirectional relations, reverseField.position should be negative.
For components, reverseField.isList must be true to allow reconnection.
Relation cardinality is set at creation and cannot be changed later. You cannot convert:
One-to-one → One-to-many
One-to-many → Many-to-many
Any other cardinality changes
If you need a different cardinality, you must delete and recreate the relation (which may cause data loss).
For components and unidirectional relations: The reverse side must have isList: true to allow reconnecting entries to the same component instance. Setting isList: false will prevent reconnection and may require recreating the relation.
Steps are created in the order provided unless position is specified. If a position conflicts, the new step is inserted at the next available position.
First step cannot have returnToStep.
roleOverrides at workflow level bypasses all steps.
allowedRoles at step level controls who can work at that step.
publishStages determines which stages can be published from a step.
Steps with conflicting positions are inserted at next available slot.
You can modify the visibility conditions for a number of field types, such as simple, enumerable, component, relational, union, and taxonomy fields. The visibilityCondition parameter is available in the following methods:
createSimpleField()
createEnumerableField()
createComponentField()
createRelationalField()
createUnionField()
createTaxonomyField()
updateSimpleField()
updateEnumerableField()
updateComponentField()
updateTaxonomyField()
visibilityCondition?:{// Optional: Show/hide field based on another field's value
baseField:string,// Required: API ID of the field that controls visibility
When an app is installed via the createAppInstallation method, it is always installed with the PENDING status. Users with the necessary permissions (usually the ADMIN or DEVELOPER roles) must complete the app installation process in Hygraph Studio.
Currently, to use the createAppInstallation method, the app needs to exist in at least one environment within the project. Users can't use this method to install new apps, only apps that they've previously installed in an existing environment.
To create a simple field with custom table and form renderers in an environment, first retrieve the appApiId and appElementApiId using the Management API.
querytest{
viewer{
project(id:"<projectId>"){
environment(name:"<environment_name>"){
appInstallation(appApiId:"<app_name>"){
id
app{
id
apiId
elements{
id
apiId
type
}
}
}
}
}
}
}
Now, create the simple field with custom table and form renderers in the specified environment.