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 checking user permissions. Authentication uses Bearer tokens.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 8

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /projects List projects I can access · List Projects #
Ask an LLM
“Which Sanity projects can I access with my token?”
“Can I see all my projects ordered by when they were created?”
Tell an agent
List all projects I have access to.
Show every Sanity project my token can reach.
POST /projects Create a new project · Create Project #
Ask an LLM
“How do I create a new Sanity project?”
“Can I create a project under an organization?”
Tell an agent
Create a project named {displayName}.
Create project {displayName} under organization {organizationId}.
GET /projects/{projectId} Get a project's details · Get Project #
Ask an LLM
“What are the details of one Sanity project?”
“Can I look up a project by its ID?”
Tell an agent
Get project {projectId}.
Show the details of Sanity project {projectId}.
PATCH /projects/{projectId} Update a project's settings · Update Project #
Ask an LLM
“How do I rename a project or change its metadata?”
“Can I update a project's settings after it's created?”
Tell an agent
Rename project {projectId} to {displayName}.
Set the metadata of project {projectId} to {metadata}.
GET /projects/{projectId}/datasets List a project's datasets · List Datasets #
Ask an LLM
“Which datasets exist in a Sanity project?”
“Can I see all datasets for one project?”
Tell an agent
List the datasets in project {projectId}.
Show every dataset of Sanity project {projectId}.
PUT /projects/{projectId}/datasets Create a dataset in a project · Create Dataset #
Ask an LLM
“How do I add a new dataset to a project?”
“Can I set an ACL mode when creating a dataset?”
Tell an agent
Create dataset {datasetName} in project {projectId}.
Add dataset {datasetName} to project {projectId} with ACL mode {aclMode}.
GET /projects/{projectId}/tokens List a project's API tokens · List Tokens #
Ask an LLM
“What API tokens exist for a project?”
“Can I see all the tokens I've issued for a project?”
Tell an agent
List the API tokens for project {projectId}.
Show every token issued on Sanity project {projectId}.
POST /projects/{projectId}/tokens Create an API token for a project · Create Token #
Ask an LLM
“How do I issue a new API token for a project?”
“Is the token key ever returned after creation?”
Tell an agent
Create a {roleName} token labeled {label} for project {projectId}.
Issue a new API key for project {projectId} with label {label} and role {roleName}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/sanity:sanity-projects-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

sanity-projects-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Sanity HTTP Projects API
  description: The Sanity HTTP API provides access to the Sanity Content Lake platform, enabling querying, mutating, and managing structured content. The API supports GROQ queries, real-time event streaming, asset management, project management, webhooks, scheduling, and AI-powered content agents. Authentication uses Bearer tokens generated from Sanity project settings.
  version: v2024-01-01
  contact:
    name: Sanity Support
    url: https://www.sanity.io/docs
  license:
    name: Commercial
    url: https://www.sanity.io/legal/terms
servers:
- url: https://{projectId}.api.sanity.io/v{apiVersion}
  description: Sanity project-scoped API endpoint
  variables:
    projectId:
      description: Your Sanity project ID
      default: your-project-id
    apiVersion:
      description: API version date (YYYY-MM-DD)
      default: '2024-01-01'
- url: https://api.sanity.io/v{apiVersion}
  description: Sanity management API endpoint
  variables:
    apiVersion:
      description: API version date
      default: '2024-01-01'
security:
- BearerAuth: []
tags:
- name: Projects
  description: Project and dataset management
paths:
  /projects:
    get:
      operationId: listProjects
      summary: List Projects
      description: List all Sanity projects accessible to the authenticated user, ordered by creation date.
      tags:
      - Projects
      responses:
        '200':
          description: List of projects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Project'
    post:
      operationId: createProject
      summary: Create Project
      description: Create a new Sanity project.
      tags:
      - Projects
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - displayName
              properties:
                displayName:
                  type: string
                  description: Human-readable project name
                organizationId:
                  type: string
                  description: Organization to associate project with
      responses:
        '200':
          description: Project created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
  /projects/{projectId}:
    get:
      operationId: getProject
      summary: Get Project
      description: Retrieve details for a specific Sanity project.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Project details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
    patch:
      operationId: updateProject
      summary: Update Project
      description: Update a Sanity project's settings.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                displayName:
                  type: string
                metadata:
                  type: object
      responses:
        '200':
          description: Project updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Project'
  /projects/{projectId}/datasets:
    get:
      operationId: listDatasets
      summary: List Datasets
      description: List all datasets for a project.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: List of datasets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Dataset'
    put:
      operationId: createDataset
      summary: Create Dataset
      description: Create a new dataset in a project.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - datasetName
              properties:
                datasetName:
                  type: string
                aclMode:
                  type: string
                  enum:
                  - public
                  - private
      responses:
        '200':
          description: Dataset created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dataset'
  /projects/{projectId}/tokens:
    get:
      operationId: listTokens
      summary: List Tokens
      description: List all API tokens for a project.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: List of tokens
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Token'
    post:
      operationId: createToken
      summary: Create Token
      description: Create a new API token for a project. The token key is only returned at creation time and cannot be retrieved again.
      tags:
      - Projects
      parameters:
      - name: projectId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - label
              - roleName
              properties:
                label:
                  type: string
                roleName:
                  type: string
                  description: Role to assign to the token
      responses:
        '200':
          description: Token created with key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenWithKey'
components:
  schemas:
    Dataset:
      type: object
      properties:
        name:
          type: string
        aclMode:
          type: string
          enum:
          - public
          - private
        tags:
          type: array
          items:
            type: object
    Token:
      type: object
      properties:
        id:
          type: string
        label:
          type: string
        roleName:
          type: string
        createdAt:
          type: string
          format: date-time
    Project:
      type: object
      properties:
        id:
          type: string
          description: Unique project ID
        displayName:
          type: string
        organizationId:
          type: string
        isBlocked:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    TokenWithKey:
      allOf:
      - $ref: '#/components/schemas/Token'
      - type: object
        properties:
          key:
            type: string
            description: The API token key (only returned at creation)
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Sanity project API token