Frequently Asked Questions

Management SDK: Installation & Usage

How do I install the Hygraph Management SDK?

You can install the Hygraph Management SDK by running the following command in your project directory: npm install @hygraph/management-sdk. This will add the SDK to your Node.js project and allow you to interact with Hygraph's management APIs. For more details, see the official installation guide.

How do I create a client with the Hygraph Management SDK?

To create a client, instantiate the Client class from @hygraph/management-sdk and provide the following parameters:

For more details, see the client creation documentation.

How do I run a migration using the Hygraph Management SDK?

To run a migration, use the run method on your client instance. By default, migrations run in the foreground, returning the results of all executed actions. You can pass false as an argument to run the migration in the background, which schedules actions but does not execute them immediately. For more details, see the migration documentation.

Can I preview changes before running a migration?

Yes, you can use the dryRun method to preview what changes would be applied by a migration. This allows you to review the planned modifications before executing them. For more details, see the dry run documentation.

Where can I find the list of supported operations for the Management SDK?

All supported operations for the Management SDK are documented in the TypeScript type definitions file Client.d.ts. This file provides a comprehensive overview of available methods and their usage.

How does Hygraph handle migration metadata retention?

Hygraph stores metadata for the last 30 migrations per environment. When a new migration is applied, metadata for older migrations exceeding 30 (sorted by creation time) are deleted. The changes performed by older migrations remain in place, but their metadata (such as name and related information) will no longer be available.

Features & Capabilities

What are the key features of Hygraph's Management SDK?

Hygraph's Management SDK enables programmatic management of your content models, migrations, and schema changes. Key features include:

For more details, see the Management SDK Quickstart.

Does Hygraph offer high-performance endpoints for management operations?

Yes, Hygraph provides high-performance endpoints for management operations. You can access the new regional endpoint for programmatic management by navigating to Project Settings > API Access and copying the URL under the Management API. For more details, see the product roundup.

Security & Compliance

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 demonstrate Hygraph's commitment to providing a secure and compliant platform. For more details, visit the security features page and security and compliance report.

What security features are available in Hygraph?

Hygraph offers granular permissions, SSO integrations, audit logs, encryption (at rest and in transit), regular backups, and enterprise-grade compliance features such as dedicated hosting and custom SLAs. These features ensure robust data protection and regulatory compliance. For more details, visit Hygraph's security page.

Support & Implementation

What support is available for developers using the Management SDK?

Hygraph provides 24/7 support via chat, email, and phone, as well as real-time troubleshooting through Intercom chat. Developers can also access extensive documentation, webinars, live streams, and how-to videos. Enterprise customers receive a dedicated Customer Success Manager (CSM) for personalized guidance. For more resources, visit Hygraph Documentation and join the community Slack channel.

How easy is it to get started with Hygraph and the Management SDK?

Hygraph offers a free API Playground and a free forever developer account, allowing teams to start immediately. The onboarding process includes introduction calls, account provisioning, business and technical kickoffs, and content schema guidance. Training resources such as webinars and documentation are available for step-by-step instructions. For more details, see Hygraph Documentation.

Performance & Reliability

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

Hygraph uses Smart Edge Cache for enhanced performance and faster content delivery, especially for high-traffic and global audiences. The platform features high-performance endpoints and regularly improves its infrastructure for reliability and speed. For more details, see the blog post on endpoint improvements.

Use Cases & Benefits

Who can benefit from using Hygraph and its Management SDK?

Hygraph is ideal for developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, and manufacturing. It is especially beneficial for organizations modernizing legacy tech stacks, requiring scalable content management, and seeking localization, asset management, and content federation capabilities. For more details, see the Management SDK Quickstart.

What problems does Hygraph solve for businesses?

Hygraph addresses operational inefficiencies (eliminating developer dependency, modernizing legacy tech stacks), financial challenges (reducing costs, accelerating speed-to-market), and technical issues (simplifying schema evolution, resolving integration difficulties, optimizing performance, and improving localization and asset management). For more details, see the blog on CMS KPIs.

Customer Success & Metrics

Can you share some customer success stories with Hygraph?

Yes. For example, Komax achieved a 3X faster time-to-market, Autoweb saw a 20% increase in website monetization, and Samsung improved customer engagement by 15% with a scalable platform. Stobag increased online revenue share from 15% to 70% after transitioning to a digital-first approach. More stories are available on the customer stories page.

What KPIs and metrics are associated with the pain points Hygraph solves?

Key metrics include:

For more details, visit the blog on CMS KPIs.

Maintenance & Upgrades

How does Hygraph handle maintenance, upgrades, and troubleshooting?

Hygraph is a cloud-based platform, so all deployment, updates, security, and infrastructure maintenance are managed by Hygraph. Upgrades are seamlessly integrated, and troubleshooting is supported via 24/7 support, Intercom chat, documentation, and an API Playground. Enterprise customers receive a dedicated Customer Success Manager. For more details, see Hygraph Documentation.

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

#Management SDK quickstart

This quickstart shows how to install the Hygraph Management SDK, authenticate against your project, and apply schema changes programmatically.

You will start with a simple schema change, then learn how to group changes using a batch migration, which is the recommended approach for most production workflows.

By the end of this guide, you will learn how to:

  • Install the Management SDK
  • Create a Management SDK client
  • Apply a schema change
  • Apply multiple changes using a batch migration

#Prerequisites

Before you begin, make sure you have:

#Install the SDK

Install the Management SDK package via npm:

npm install @hygraph/management-sdk

#Create a Management SDK client

Create a new file, for example management.ts, and initialize the client with the following parameters:

import { Client } from '@hygraph/management-sdk';
const client = new Client({
authToken,
endpoint,
name, // optional
});
OptionDescription
authTokenPermanent auth token for your project. This can be retrieved from your Hygraph project in Project Settings > Permanent Auth Tokens > Token. Make sure the token has proper Management API permissions depending on what you plan to execute via the SDK.
endpointEndpoint of the High Performance Content API that belongs to the environment that you will work with. The URL can be retrieved from your Hygraph project in Project Settings > Endpoints > High Performance Content API.
nameOptional identifier used for logging and debugging. Every migration has a unique name within an environment. If unspecified, a name will be generated and will be part of the response of a successful migration. Subsequent migrations with the same name in the same environment will fail.

For more information, read this document.

#Add a model

The Management SDK schedules changes when methods are called. Changes are applied when you call run().

The following example creates a simple content model:

client.createModel({
apiId: 'Product',
apiIdPlural: 'Products',
displayName: 'Product'
})

If the model already exists, this call will fail.

#Add a field to the model

Next, add a field to the model:

client.createSimpleField({
parentApiId: 'Product',
apiId: 'name',
displayName: 'Name',
type: SimpleFieldType.STRING,
isRequired: true
})

#Dry run a migration

The SDK supports a dryRun mode. We highly recommend using this to inspect the changes array and validate your logic before committing changes to a production environment. A migration can be dry run to preview what changes would be applied.

const changes = client.dryRun();
console.log(changes);

Inspect the changes array and validate the list of operations that will be applied to the target environment.

#Run a migration in production

The run() method submits all scheduled operations. It collects operations from createModel(), createSimpleField(), applySchemaChanges(), and submits them as a batch. The run() method executes all operations atomically. All operations succeed or fail together.

async run(foreground: boolean = true): Promise<MigrationInfo>
ParameterTypeDescription
foregroundbooleanWhether to run the migration in the foreground. If true, the SDK client will return the results of all actions that were executed. If false, a successful result only means that the actions were successfully scheduled, but not executed. Default is true.

Returns a MigrationInfo object with the following properties:

PropertyDescription
nameThe name of the migration.

You can call the run() method only once per client instance. A subsequent call returns an error: Migration has already been executed.

#Full example

import { Client, SimpleFieldType } from '@hygraph/management-sdk';
const client = new Client({
authToken: '<Permanent auth token>',
endpoint: '<Content API endpoint>',
});
client.createModel({
apiId: 'Product',
apiIdPlural: 'Products',
displayName: 'Product',
});
client.createSimpleField({
parentApiId: 'Product',
apiId: 'name',
displayName: 'Name',
type: SimpleFieldType.STRING,
isRequired: true,
});
const result = await client.run(true);
if (result.errors) {
throw new Error(result.errors);
}
console.log(result);

#Check migration status

  1. Navigate to the API Playground in your Hygraph project.
  2. In the API selector dropdown, select the Management API.
  3. Run the following query to check migration status:
query MyQuery {
viewer {
project(id: "<project-id>") {
environment(name: "<environment-name>") {
migrations {
id
status
name
errors
createdAt
}
}
}
}
}

#Verify changes in Studio

After running the script, to verify the changes:

  1. Open your Hygraph project.
  2. Navigate to Schema.
  3. Confirm that the Product model with the name field exists.

#Supported operations

All operations that can be executed by the SDK are listed in the TypeScript Type Definitions, Client.d.ts file.

#Migrate from the previous SDK

To migrate from the previous SDK, which can be found here, there are a couple of changes that need to be made in order to use it with existing migration scripts.

The old SDK has been deprecated but won't be removed from NPM, so old scripts using it will still work in the future. New features, though, will only be available in the new SDK.

First of all the import of the NPM package has to be changed. For this, the package name needs to be changed to @hygraph/management-sdk. In the previous version, the SDK offered a named export newMigration that could be used to create a new migration. This changed with the new version, so a new migration must be created as follows:

import { Client } from '@hygraph/management-sdk';
const migration = new Client({
authToken: '...',
endpoint: '...',
});

The general methods on the migration class stayed the same. So running or performing a dryRun will still work as before.

The major change are the operations that are supported to actually execute changes:

Before, the SDK was built in a fluent API style. This means you could chain operations like the following:

migration
.createModel({
apiId: 'Author',
apiIdPlural: 'Authors',
displayName: 'Author',
})
.addSimpleField({
apiId: 'firstName',
displayName: 'First Name',
type: FieldType.String,
});

The new SDK version no longer supports chaining. The reason behind that is that the SDK is now fully generated by the schema it is using to execute the migration. The previous example needs to be changed as follows:

migration.createModel({
apiId: 'Post',
apiIdPlural: 'Posts',
displayName: 'Post',
});
migration.createSimpleField({
apiId: 'firstName',
displayName: 'First Name',
type: SimpleFieldType.STRING,
modelApiId: 'Post',
});

To link the second operation to the first one, that is, to create the field on the created model in the first operation, you need to pass the modelApiId into the operation.