CLI reference
GraphQL CLI command reference
Deploy, delete and list GraphQL APIs for Sanity projects
npx sanity graphql --help
pnpm dlx sanity graphql --help
yarn dlx sanity graphql --help
bunx sanity graphql --help
Commands
deploy
USAGE
$ sanity graphql deploy
FLAGS
--api=<API> Only deploy API with this ID. Can be specified multiple times.
-d, --dataset=<DATASET> Deploy API for the given dataset
--dry-run Validate defined GraphQL APIs, check for breaking changes, skip deploy
--force Deploy API without confirming breaking changes
--generation=<GENERATION> API generation to deploy (defaults to "gen3")
--non-null-document-fields Use non-null document fields (_id, _type etc)
--playground Enable GraphQL playground for easier debugging
--tag=<TAG> Deploy API(s) to given tag (defaults to "default")
--with-union-cache Enable union cache that optimizes schema generation for schemas with many self referencing types
DESCRIPTION
Deploy a GraphQL API from the current Sanity schema
EXAMPLES
Deploy all defined GraphQL APIs
sanity graphql deploy
Validate defined GraphQL APIs, check for breaking changes, skip deploy
sanity graphql deploy --dry-run
Deploy only the GraphQL APIs with the IDs "staging" and "ios"
sanity graphql deploy --api staging --api ios
Deploy all defined GraphQL APIs, overriding any playground setting
sanity graphql deploy --playgroundlist
USAGE
$ sanity graphql list
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to list GraphQL endpoints for (overrides CLI configuration)
DESCRIPTION
List all GraphQL endpoints deployed for this project
EXAMPLES
List GraphQL endpoints for the current project
sanity graphql list
List GraphQL endpoints for a specific project
sanity graphql list --project-id abc123undeploy
USAGE
$ sanity graphql undeploy
FLAGS
-p, --project-id=<PROJECT-ID> Project ID to undeploy GraphQL API from (overrides CLI configuration)
--api=<API> Undeploy API with this ID
-d, --dataset=<DATASET> Dataset to undeploy GraphQL API from (overrides CLI configuration)
--force Skip confirmation prompt
--tag=<TAG> Tag to undeploy GraphQL API from
DESCRIPTION
Remove a deployed GraphQL API
EXAMPLES
Undeploy GraphQL API for current project and dataset
sanity graphql undeploy
Undeploy API with ID "ios"
sanity graphql undeploy --api ios
Undeploy GraphQL API for staging dataset
sanity graphql undeploy --dataset staging
Undeploy GraphQL API for staging dataset with "next" tag
sanity graphql undeploy --dataset staging --tag next
Undeploy GraphQL API without confirmation prompt
sanity graphql undeploy --force
Undeploy GraphQL API for a specific project and dataset
sanity graphql undeploy --project-id abc123 --dataset production