Sanity · GraphQL Specification

Sanity GraphQL API

Sanity provides a project-scoped GraphQL API that exposes Content Lake documents as a typed, queryable schema. The API is deployed per-project and per-dataset: you generate and deploy the schema from your Sanity Studio using the CLI (`sanity graphql deploy`), which introspects your studio's schema definitions and produces a GraphQL schema with PascalCase type names (e.g., a `bookAuthor` type becomes `BookAuthor`). For each document type in your schema, two root query fields are generated — `all` for list queries with filtering, sorting, and pagination, and `` for fetching a single document by its `_id`.

Documentation Endpoint View on GitHub Headless CMSContent ManagementGROQReal-TimeStructured ContentDeveloper PlatformGraphQL

Overview

Sanity GraphQL API is a GraphQL API specification published by Sanity on the APIs.io network.

Sanity provides a project-scoped GraphQL API that exposes Content Lake documents as a typed, queryable schema. The API is deployed per-project and per-dataset: you generate and deploy the schema from your Sanity Studio using the CLI (sanity graphql deploy), which introspects your studio’s schema definitions and produces a GraphQL schema with PascalCase type names (e.g., a bookAuthor type becomes BookAuthor). For each document type in your schema, two root query fields are generated — all<TypeName> for list queries with filtering, sorting, and pagination, and <TypeName> for fetching a single document by its _id.

The GraphQL endpoint is available at https://{projectId}.api.sanity.io/v2025-02-19/graphql/{dataset}/default. documentation is published at https://www.sanity.io/docs/graphql.

The specification includes 2 reference links.

Tagged areas include Headless CMS, Content Management, GROQ, Real-Time, and Structured Content.

Endpoint

`https://{projectId}.api.sanity.io/v2025-02-19/graphql/{dataset}/default`

References

Related API Specs

Sanity Query API (OpenAPI) Sanity Webhooks API (AsyncAPI)
Back to Sanity · All GraphQL Specs · GitHub