The Sanity Actions API runs content authoring actions against a Sanity dataset, the same higher-level operations Sanity Studio uses for everyday editing. A single request carries an ordered list of actions that execute in one transaction and roll back together if any fails. Document actions create, edit with a patch, publish, unpublish, and delete documents, version actions stage document changes inside a release, and release actions create, edit, schedule, publish, archive, and delete releases. It is a higher-level alternative to the Sanity Mutations API and requires API version v2024-05-23 or later, with version and release actions needing v2025-02-19.
The Sanity Agent Actions API runs schema-aware LLM instructions against documents in a Sanity dataset. Generate writes new content into an existing or new document from an instruction, Transform rewrites a source document's fields, and Translate converts a document into another language with an optional style guide and protected phrases. Prompt returns a plain or JSON LLM response without touching documents, and Patch applies validated, schema-checked changes without using an LLM. By default the actions write to drafts rather than published documents, and noWrite lets you preview a result without saving it.
The Sanity Assets API uploads images and files into a dataset in Sanity's Content Lake and creates the matching sanity.imageAsset or sanity.fileAsset document with their metadata. Uploads can come from raw request bytes or from a public HTTPS URL that Sanity fetches itself, with optional title, description, label, credit line, and source attribution. Image uploads can extract metadata such as palette, lqip, blurhash, thumbhash, exif, and location. A separate operation links an existing Media Library asset to a dataset so it can be previewed and referenced from documents.
The Sanity Backups API turns backups on or off for a dataset, lists the backups that exist, and returns the files inside any one of them. Backup listings can be narrowed with after and before dates and return each backup's ID and creation time. Fetching a backup returns its total file count and a page of document, image, and file entries with signed download URLs that expire after 24 hours. It is the HTTP surface behind the sanity backups download command, which assembles those files into a tarball for sanity datasets import.
The Sanity CDN Cache Purge API clears cached content from Sanity's CDN for one dataset at a time. One operation purges the cached GROQ and GraphQL query results for a dataset, and the other purges every cached representation of a single image or file, identified by its asset ID such as image-<sha1>-<width>x<height>-<format>. Both accept an empty POST body and return 202 with a purgeId and acceptedAt time while the purge runs in the background. Self-service cache purging must be enabled for the project, and the token needs permission to update project datasets.
The Sanity Copy API, also known as Cloud Clone, copies an existing dataset into a new dataset inside Sanity's cloud, as an alternative to exporting and re-importing it. A copy request names the targetDataset and can leave out document history with skipHistory or content releases with skipContentReleases; scheduled releases arrive unscheduled in the copy. Starting a copy returns a jobId whose progress you follow through the Jobs API, and a second operation lists a project's copy jobs newest first, filtered by state. Copying is part of the Advanced Dataset Management offering on Sanity's enterprise plan, while listing jobs is not.
The Sanity Doc API fetches the latest version of one or more Sanity documents by ID straight from the backend, bypassing caching and the delay of the query index. A single request takes a comma-separated list of document IDs, and includeAllVersions can add the draft and every release version of each published ID. Any ID that is not returned is listed in omitted with the reason existence or permission, and excludeContent returns only that list to check whether documents exist. It is less scalable than the Query API, so it suits read-after-write checks rather than general content fetching.
The Sanity Embeddings Index API builds vector embeddings indexes over the documents in a Sanity dataset and runs semantic search queries against them. An index is defined by a GROQ filter that selects documents, such as _type=='movie', and a GROQ projection that picks the fields to embed, and a query returns matching documentId and type pairs with a relevance score between 0 and 1. Every operation in this spec is marked deprecated, and the API is described as a beta available on the Growth plan and above. Using it sends document data to OpenAI and Pinecone to store the vectors.
The Sanity Export API streams every non-deleted document in a dataset as newline-delimited JSON, including drafts, release versions, and asset documents the caller can access. The export reflects the dataset as it was when the request started, and the types parameter narrows it to specific document types such as post, author, or sanity.imageAsset. For large datasets, cursor mode returns documents ordered by _id in time-boxed batches that end with a nextCursor object to resume from. An error after streaming begins keeps the 200 status and ends the stream with an error object, so the last line must be checked before an export counts as complete.
The Sanity History API returns past revisions of documents in a Sanity dataset and the transactions that changed them. A document can be fetched as it was at a given timestamp, at a specific revision ID, or at its last revision, which for a deleted document is its final state before deletion. Transaction logs come back as NDJSON for the whole dataset or for a comma-separated list of document IDs, filtered by time range, transaction range, and author IDs, with effects expressed in the Mendoza diff format. Access follows the document's current permissions, so anyone who can read a document today can read all of its earlier revisions.
The Sanity Jobs API reports on long-running processes inside Sanity's infrastructure, such as dataset copy jobs. A status call returns a job's id, its state (pending, running, completed, failed, terminating, or terminated), the author IDs behind it, and its created and updated timestamps. A listen stream sends a welcome event, then job events carrying the state and a progress value from 0 to 100, and closes with a final event once the job reaches a terminal state. Errors after the stream opens, such as an unknown job ID or a stream open for 12 hours, arrive as channel_error and disconnect events rather than HTTP status codes.
The Sanity Listen API streams an event every time a document matching a GROQ filter is modified in a Sanity dataset, over a server-sent events connection the backend holds open. Each mutation event names the document ID, transaction ID, transition such as update, the identity that made the change, and the previous and resulting revisions, and can optionally include the resulting document, the document before the change, the mutations applied, and Mendoza effects. Listeners can wait until changes are visible to queries, include release version documents, and resume after a reconnect from the last event ID so no changes are missed. Sanity recommends its Live Content API for most new projects; Listen remains the way to receive per-document mutation detail.
The Sanity Live API streams sync tag invalidation events for a Sanity dataset, the signal underneath the Live Content API. Over a server-sent events connection it sends batches of sync tags on published documents as they become invalid, so a site or app knows which cached content to refetch without polling. Tokened requests can also include draft, version, and system document changes, and a stream can wait until a configured Sync Tag Invalidate Function has processed events. A client can restart from a previously returned event ID, and the stream signals restart, goaway, and error conditions as events.
The Sanity Mutations API creates, updates, and deletes documents in Sanity Content Lake, applying an array of mutations to a dataset as one transaction so either every mutation runs or none do. Mutation types are create, createOrReplace, createIfNotExists, delete, and patch, and delete and patch can target documents by ID or by a GROQ query, with patches applying set, setIfMissing, unset, inc, dec, and insert operations in a fixed order. Requests can return the changed document IDs or full documents, set their own transaction ID, auto-generate array item keys, validate without writing through a dry run, and choose whether to wait until changes are visible to queries. An ifRevisionID check gives optimistic locking so a write fails if the document changed since it was read.
The Sanity Query API runs GROQ queries against a dataset in Sanity Content Lake and returns the result along with the time taken and sync tags for cache invalidation. Queries can be sent as GET with the query in the URL or as POST for long queries and large parameter values, with GROQ parameters passed alongside. A perspective setting chooses whether the query sees published content, drafts, raw documents, or a custom stack of release IDs, and options add a query execution plan, content source maps for visual editing, and request tags for log filtering. The same endpoint is served from Sanity's API CDN for edge-cached results on the published and raw perspectives.
The Sanity Roles API controls who can do what in Sanity projects and organizations: it lists members and their roles, assigns or removes roles, and defines custom roles with their own grants. Grants pair a permission such as read or update with a permission resource, and custom permission resources of type sanity.document.filter use a GROQ filter to limit access to matching documents. It also reports the current user's grants at organization, project, and dataset level, and maps SAML SSO groups to project roles. Missing permissions return 401 with the code missing_grant rather than 403.
The Sanity Activity Log API returns the audit trail of activity events across Sanity organizations, projects, and users, newest first by timestamp. Events can be filtered by actor, target user, project, organization, action name such as organization.name.edit, and a start and end time window. The same filters drive a CSV export, which sorts its headers alphabetically and spreads event metadata into dynamic metadata columns. Results only include activity that the token's user is allowed to see.
The Sanity Collaboration API creates, edits, resolves, and deletes the comments and reactions that editors leave on Sanity documents and Canvas documents. Comments can target a whole document or a specific field, optionally anchored to a span of Portable Text, and replies join the parent comment's thread. Reads run as GROQ queries against the comments of a resource, and a listen operation streams comment changes as server-sent events. Dataset comments use the project host, Canvas comments use api.sanity.io, and the vX version is unstable and can change without notice.
REST API for the Sanity headless CMS platform. Query, mutate, and manage documents and datasets via GROQ queries and mutations. The API exposes 4 endpoints secured with apiKey, bearer authentication.
The Sanity Projects API administers Sanity projects and the datasets inside them. It lists, creates, updates, and deletes projects, and within a project creates datasets with a public, private, or custom ACL mode, updates or deletes them, copies one dataset into a new one, and lists the history of copy jobs. Projects also carry CORS origins, API tokens with assigned roles, tags that can be assigned to datasets, per-dataset embeddings index settings, active features, and the caller's own permissions. Role and permission management lives in Sanity's separate Access API.
The Sanity Scheduling API publishes or unpublishes documents in a Sanity dataset at a set UTC time, and can also publish or unpublish a batch of documents immediately in one transaction. Each schedule carries a name, an executeAt timestamp, a publish or unpublish action, and the document IDs it targets, and moves through the scheduled, executing, succeeded, and cancelled states. Schedules can be listed and filtered, renamed or retimed, cancelled before they run, or run straight away. Sanity marks this API as deprecated and recommends Content Releases for new work, and it requires a Growth or higher plan.
The Sanity Usage API reports how much of each metered resource a Sanity project, media library, organization, or context has consumed. A snapshot call returns a map of metric names such as apirequests, apicdnrequests, documents, or assets to their value for a day, month, or year, along with the latest timestamp recorded for each metric. A history call returns the same metrics over a date range, aggregated by period and optionally as a running total. For organizations, scoped calls break AI and embeddings metrics such as ai-usage and embeddings-reads down per user.
The Sanity Webhooks API sets up the webhooks that notify your services when content in a Sanity project changes, and shows how each delivery went. Document webhooks fire per document on create, update, or delete, narrowed by a GROQ filter and shaped by a GROQ projection, while transaction webhooks fire once per dataset transaction. Each webhook targets a URL and a dataset, or every dataset with *, and can set the HTTP method, custom headers, a secret, and whether drafts or all versions trigger it. Messages and delivery attempts record status, result codes, durations, and failure reasons for debugging.
BOOK A DEMO
Browse thousands of APIs and connect them all to your agent with Jentic One. One layer, one credential — every API your agent needs.
Step 1: Jentic One Host machine
# On the machine that will host your Jentic One instance:
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsanity.io" | shStep 2: Agent machine
# On the machine where your agent runs (keep this separate from the instance):
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsanity.io" | sh
jentic register # connects your agent to your Jentic One instanceJentic One is in public beta. The setup above keeps your agent separate from the instance, which is what you want before using real credentials: an agent running as the same OS user as Jentic One can read its stored keys directly. Just evaluating? A single local install is fine to start. See the secure deployment guide for the tiers.