#Management SDK
The Hygraph Management SDK lets you programmatically manage your Hygraph project configuration, including schema, models, fields, taxonomies, workflows, webhooks, and editor UI elements. It provides a typed SDK that allows multiple schema-related actions to be executed in order and in a single transaction.
It is designed for automation and repeatability, enabling you to manage Hygraph configuration as code rather than through manual UI changes. Unlike the Content API, which handles data entry, the Management SDK defines the architecture of your project.
#Key benefits
The Management SDK is intended for use cases where manual configuration does not scale well. It enables you to:
- Apply multiple schema-related changes. It allows accepting a set of changes which are applied on an “all or none” basis. So if anything fails in one of the events along the process, everything is rolled back automatically.
- Bypass the web app, by allowing you to create a script that applies all the changes at once, without you having to procedurally create everything.
- Apply the scripts you create to different environments. So they can be used in test environments to test schema changes upfront. In this scenario, you would make all the schema changes in this migration script, test it, then apply the script to the master environment when everything works as intended.
- Store and review configuration changes in version control. Define schema and configuration changes as code and store them in a version control system alongside your application. This allows teams to review, audit, and apply changes consistently across environments using pull requests.
- Run migrations safely as part of CI/CD pipelines. Use the Management SDK in deployment pipelines to apply schema changes automatically before shipping dependent code. Batch migrations ensure changes are validated and applied atomically, reducing the risk of partial or inconsistent updates.
If you need to script or automate the Hygraph setup, the Management SDK is the recommended approach.
#How it works
The SDK works in two modes.
-
Write changes directly: You initialize a client, call the methods that describe the schema you want, and then submit them to the Management server through the SDK. For more information, see the quickstart guide.
-
Sync changes between environments: If you have a development environment where you've already made and tested schema changes, you can generate a diff and apply it directly to another environment. This mode replaces the target schema. It does not merge changes. Any schema changes that exist in the target environment but not in the source will be deleted. For more information, see the batch migration guide.
In the above cases, the underlying method is the submitBatchChanges mutation. If any single change fails, the entire batch is rolled back automatically.
submitBatchChanges(data: BatchMigrationInput!): AsyncOperationPayload!
This mutation takes an environmentId, an optional name, and a list of changes as arguments, then executes them in a single transaction.
#What you can manage
The Management SDK covers project configuration, not content.
You can use it to manage:
- Schema and models: Models, fields, relations, remote fields
- Taxonomies: Taxonomies and hierarchical taxonomy nodes
- Remote sources: REST and GraphQL remote sources
- Workflows: Content workflows and workflow stages
- Webhooks: Webhook configuration and triggers
- Editor UI: System and custom sidebar elements
#When to use the SDK
Use the Management SDK when you need to:
- Automate schema changes
- Synchronize configuration between environments, such as
development,staging, orproduction - Run schema migrations during deployments
- Enforce consistency in large or distributed teams
#When not to use the SDK
The Management SDK is not intended for:
- Creating or updating content entries
- Editorial workflows
- Querying published content
For content operations, use the Content API.
#Next steps
- To get started, take a look at our Quickstart.
- Learn how to migrate from the old SDK.