HTTP API Reference

Actions

The Actions API is a higher-level alternative to the Mutations API. It is normally used by Studio in the course of regular authoring workflows, but can also be used directly if you wish. All requests have to be authenticated.

This API allows you to perform various operations on documents, versions, and releases in your Sanity dataset. Each request can contain multiple actions that will be executed in a single transaction.

Document Actions:

  • sanity.action.document.create: Creates a new document in the dataset.
  • sanity.action.document.delete: Deletes a document from the dataset.
  • sanity.action.document.edit: Modifies an existing document using a patch.
  • sanity.action.document.publish: Publishes a document, making it available in the published perspective.
  • sanity.action.document.unpublish: Unpublishes a document, removing it from the published perspective.
  • sanity.action.document.discard: [DEPRECATED] Discards a document (use version actions instead)
  • sanity.action.document.replaceDraft: [DEPRECATED] Replaces a draft document (use version actions instead)

Version Actions:

  • sanity.action.document.version.create: Creates a new version of a document in a release.
  • sanity.action.document.version.discard: Discards a version of a document, optionally purging its history.
  • sanity.action.document.version.replace: Replaces an existing version of a document.
  • sanity.action.document.version.unpublish: Marks a version for unpublishing when the release is published.

Release Actions:

  • sanity.action.release.create: Creates a new release with optional metadata.
  • sanity.action.release.edit: Modifies the metadata of an existing release.
  • sanity.action.release.publish: Publishes all documents in a release.
  • sanity.action.release.archive: Archives a release, removing it from active releases.
  • sanity.action.release.unarchive: Restores an archived release to its pre-archived state.
  • sanity.action.release.schedule: Schedules a release for publishing at a future time.
  • sanity.action.release.unschedule: Cancels a scheduled release.
  • sanity.action.release.delete: Deletes a published or archived release.
  • sanity.action.release.import: Imports a release document.

Note that it is not permitted to mix different types of actions, such as release and document actions, in a single API call.

Base API server URL

Parameterized base URL for Sanity API endpoints

https://{projectId}.api.sanity.io/{apiVersion}

Variables

  • projectIdstringdefault: "your-project-id"

    Your Sanity project ID. This can be found in your project settings or in the URL when accessing your project in the Sanity management interface.

  • apiVersionstringdefault: "v2025-02-19"

    The version of the API to use. This should match the version specified in the info.version field.