Sanity website screenshot

Sanity

Sanity is a composable content platform providing a headless CMS with a real-time collaborative editor (Sanity Studio) and a powerful HTTP API for managing structured content. The Sanity Content Lake stores content as flexible documents queryable via GROQ (Graph-Relational Object Queries). Key API capabilities include document querying, mutations, real-time listening, asset management, project management, webhooks, scheduling, roles and permissions, vector embeddings, and AI-powered content agents.

9 APIs 0 Features
Headless CMSContent ManagementGROQReal-TimeStructured ContentDeveloper Platform

APIs

Sanity Query API

The Sanity Query API enables querying Content Lake documents using GROQ (Graph-Relational Object Queries). Supports GET for queries under 11 KB and POST for larger queries. Avai...

Sanity Mutation API

The Sanity Mutation API enables creating, updating, patching, and deleting documents in Content Lake. Mutations are submitted as arrays of operations (create, createOrReplace, c...

Sanity Assets API

The Sanity Assets API handles uploading, retrieving, and managing file and image assets in Content Lake. Assets are stored as documents and referenced from content documents.

Sanity Projects API

The Sanity Projects API enables programmatic management of Sanity projects including creating projects, managing datasets, configuring CORS origins, managing access tokens, and ...

Sanity Webhooks API

The Sanity Webhooks API enables configuring event-driven notifications for content changes. Webhooks can be created to trigger on document create, update, delete, and publish ev...

Sanity Listen API

The Sanity Listen API provides real-time event streaming via Server-Sent Events (SSE) for content changes in a dataset. Clients can subscribe to a GROQ query and receive real-ti...

Sanity Roles API

The Sanity Roles API provides endpoints for managing user roles and permissions within Sanity projects. Supports predefined roles (Administrator, Read+Write, Read, Viewer) and c...

Sanity Scheduling API

The Sanity Scheduling API enables scheduling content for future publication or unpublication at specific times, supporting editorial workflows and content calendars.

Sanity Embeddings Index API

The Sanity Embeddings Index API enables creating and managing vector embedding indexes for Content Lake documents, supporting semantic search and AI-powered content retrieval wo...

Collections

Arazzo Workflows

Sanity Bootstrap Project

Create a project, add an initial dataset, then list the project datasets.

ARAZZO

Sanity Bulk Delete by Query

Count documents matching a GROQ filter, then delete them in one mutation.

ARAZZO

Sanity Compare Draft and Published

Read a document's draft and published perspectives to inspect its history.

ARAZZO

Sanity Create and Verify Document

Create a document with a mutation, then confirm it exists with a GROQ query.

ARAZZO

Sanity Discover Project Datasets

List accessible projects, then enumerate the datasets of a chosen project.

ARAZZO

Sanity Issue Token for Project

Confirm a project exists, mint an API token on it, then list its tokens.

ARAZZO

Sanity Provision Dataset

Create a dataset in a project, then list datasets to confirm it exists.

ARAZZO

Sanity Publish Draft Document

Read a draft, promote it to a published document, then verify the result.

ARAZZO

Sanity Query Then Patch Document

Find a document with GROQ, then patch it when a match is found.

ARAZZO

Sanity Register Webhook for Query

Validate a GROQ filter, register a webhook on it, then list webhooks.

ARAZZO

Sanity Rename Project

Read a project, update its display name and metadata, then re-read it.

ARAZZO

Sanity Replace Document Asset

Upload a new image, find the target document, then point it at the new asset.

ARAZZO

Sanity Upload Asset and Reference

Upload an image asset, then create a document that references it.

ARAZZO

Sanity Upsert Document

Find a document by a GROQ key match and patch it, otherwise create it.

ARAZZO

GraphQL

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 ...

GRAPHQL

Pricing Plans

Sanity Plans Pricing

3 plans

PLANS

Rate Limits

Sanity Rate Limits

6 limits

RATE LIMITS

FinOps

Sanity Finops

FINOPS

Event Specifications

Sanity GROQ-Powered Webhooks

AsyncAPI specification for Sanity's GROQ-powered webhook surface. Sanity delivers event-driven HTTP callbacks when documents in a Content Lake dataset are created, updated, or d...

ASYNCAPI

Semantic Vocabularies

Sanity Context

0 classes · 12 properties

JSON-LD

API Governance Rules

Sanity API Rules

7 rules · 3 errors 4 warnings

SPECTRAL

JSON Structure

Sanity Document Structure

0 properties

JSON STRUCTURE

Sanity Structure

0 properties

JSON STRUCTURE

Example Payloads

Resources

🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
Arazzo
Arazzo
🔗
LinkedIn
LinkedIn
🔗
Website
Website
🔗
Documentation
Documentation
🔗
HTTP API Reference
HTTP API Reference
🌐
DeveloperPortal
DeveloperPortal
👥
GitHubOrganization
GitHubOrganization
🚀
GettingStarted
GettingStarted
📦
JavaScript SDK
JavaScript SDK
💰
Pricing
Pricing
🔗
Community
Community
📰
Blog
Blog
🟢
StatusPage
StatusPage
🔗
Vocabulary
Vocabulary
🔗
SpectralRules
SpectralRules
🔗
Capabilities
Capabilities
🔗
JSONLD
JSONLD
🔗
MCPServer
MCPServer
🔗
AgentSkills
AgentSkills

Sources

Raw ↑
opencollection: 1.0.0
info:
  name: Sanity HTTP API
  version: v2024-01-01
request:
  auth:
    type: bearer
    token: '{{bearerToken}}'
items:
- info:
    name: Query
    type: folder
  items:
  - info:
      name: Query Documents
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/data/query/:dataset
      params:
      - name: dataset
        value: ''
        type: path
        description: Dataset name (e.g., production)
      - name: query
        value: ''
        type: query
        description: GROQ query string
      - name: perspective
        value: ''
        type: query
        description: Content perspective to query
      - name: explain
        value: ''
        type: query
        description: Include query execution plan in response
      - name: resultSourceMap
        value: ''
        type: query
        description: Include content source map metadata
    docs: Query Content Lake using GROQ syntax. For queries under 11 KB, submit the query as a URL parameter. Use the CDN
      endpoint ({projectId}.apicdn.sanity.io) for edge-cached results.
  - info:
      name: Query Documents (POST)
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/data/query/:dataset
      params:
      - name: dataset
        value: ''
        type: path
        description: Dataset name
      body:
        type: json
        data: '{}'
    docs: Query Content Lake using GROQ syntax via POST for queries exceeding 11 KB or when query parameters need to be passed
      in the body.
- info:
    name: Mutations
    type: folder
  items:
  - info:
      name: Mutate Documents
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/data/mutate/:dataset
      params:
      - name: dataset
        value: ''
        type: path
        description: Dataset name
      - name: returnIds
        value: ''
        type: query
        description: Return document IDs of created/modified documents
      - name: returnDocuments
        value: ''
        type: query
        description: Return full documents after mutations
      - name: visibility
        value: ''
        type: query
        description: Mutation visibility mode
      body:
        type: json
        data: '{}'
    docs: Apply a batch of mutations (create, createOrReplace, createIfNotExists, patch, delete) to documents in the dataset.
- info:
    name: Assets
    type: folder
  items:
  - info:
      name: Upload Image Asset
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/assets/images/:dataset
      params:
      - name: dataset
        value: ''
        type: path
      - name: filename
        value: ''
        type: query
        description: Original filename for the asset
      - name: label
        value: ''
        type: query
        description: Human-readable label for the asset
    docs: Upload an image asset to the Sanity Content Lake. Supports common image formats (JPEG, PNG, WebP, GIF, SVG).
- info:
    name: Projects
    type: folder
  items:
  - info:
      name: List Projects
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects
    docs: List all Sanity projects accessible to the authenticated user, ordered by creation date.
  - info:
      name: Create Project
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects
      body:
        type: json
        data: '{}'
    docs: Create a new Sanity project.
  - info:
      name: Get Project
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId
      params:
      - name: projectId
        value: ''
        type: path
    docs: Retrieve details for a specific Sanity project.
  - info:
      name: Update Project
      type: http
    http:
      method: PATCH
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId
      params:
      - name: projectId
        value: ''
        type: path
      body:
        type: json
        data: '{}'
    docs: Update a Sanity project's settings.
  - info:
      name: List Datasets
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId/datasets
      params:
      - name: projectId
        value: ''
        type: path
    docs: List all datasets for a project.
  - info:
      name: Create Dataset
      type: http
    http:
      method: PUT
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId/datasets
      params:
      - name: projectId
        value: ''
        type: path
      body:
        type: json
        data: '{}'
    docs: Create a new dataset in a project.
  - info:
      name: List Tokens
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId/tokens
      params:
      - name: projectId
        value: ''
        type: path
    docs: List all API tokens for a project.
  - info:
      name: Create Token
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/projects/:projectId/tokens
      params:
      - name: projectId
        value: ''
        type: path
      body:
        type: json
        data: '{}'
    docs: Create a new API token for a project. The token key is only returned at creation time and cannot be retrieved again.
- info:
    name: Webhooks
    type: folder
  items:
  - info:
      name: List Webhooks
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/hooks/projects/:projectId
      params:
      - name: projectId
        value: ''
        type: path
    docs: List all webhooks configured for a project.
  - info:
      name: Create Webhook
      type: http
    http:
      method: POST
      url: https://{projectId}.api.sanity.io/v{apiVersion}/hooks/projects/:projectId
      params:
      - name: projectId
        value: ''
        type: path
      body:
        type: json
        data: '{}'
    docs: Create a new webhook for event notifications.
- info:
    name: Listen
    type: folder
  items:
  - info:
      name: Listen for Changes
      type: http
    http:
      method: GET
      url: https://{projectId}.api.sanity.io/v{apiVersion}/data/listen/:dataset
      params:
      - name: dataset
        value: ''
        type: path
      - name: query
        value: ''
        type: query
        description: GROQ query defining which documents to listen to
      - name: includeResult
        value: ''
        type: query
        description: Include full document in change events
      - name: visibility
        value: ''
        type: query
    docs: Subscribe to real-time content changes via Server-Sent Events (SSE). The connection stays open and streams events
      when GROQ-matching documents are created, updated, or deleted.
bundled: true