Skip to main content

Sanity

Headless CMS platform for managing projects, datasets, documents, and webhooks via the Sanity HTTP API.

Categories: Content Management, Developer Tools

What you can ask​

  • List documents in the blog.post schema published in the last 30 days.
  • Update the homepage document to use the new Q2 hero image.
  • Find draft documents older than 60 days for cleanup.

Set up​

Sanity connects with credentials from your Sanity account. Have these values ready:

  • Project ID
  • Dataset name
  • API token
  1. Go to Organization > Connectors and find Sanity.
  2. Click Enable and choose which tools to allow.
  3. Each member enters their own values the first time they use it.

To use one account for the whole organization, turn on Share one connection with everyone. Every member's agents then act as that account, with exactly the access it has.

Tools​

Sanity offers 25 tools. Admins choose which ones agents can use. See Tool permission groups.

Read (12)​

View and search information without changing it.

ToolWhat it does
get_documentFetch one or more documents by ID, bypassing any CDN cache.
get_document_historyRetrieve a document's state at a specific revision or point in time.
get_projectGet details for a specific Sanity project.
get_webhookGet a webhook's full configuration including filter, projection, and headers.
list_cors_originsList CORS origins allowed to call the project's API from a browser.
list_datasetsList all datasets in a project with their ACL mode and creation time.
list_project_featuresList feature flags enabled for a project, such as private datasets or scheduled publishing.
list_projectsList all Sanity projects the authenticated user is a member of.
list_webhook_attemptsList delivery attempts for a webhook including HTTP status codes.
list_webhooksList all webhooks configured for a project.
query_documentsRun a GROQ query over a dataset.
validate_credentialValidate Sanity API token and project ID by fetching the configured project.

Write (4)​

Create or send data.

ToolWhat it does
create_cors_originWhitelist an origin (e.g., https://example.com) to call the API from a browser.
create_datasetCreate a new dataset in a project.
create_documentCreate a new document.
create_webhookCreate a webhook that fires on document create/update/delete events matching a GROQ filter.

Delete or overwrite (9)​

Remove or replace existing data.

ToolWhat it does
create_or_replace_documentCreate a document, or fully replace an existing document with the same _id.
delete_cors_originRemove a CORS origin by its numeric ID.
delete_datasetDelete a dataset permanently.
delete_documentDelete a document by ID.
delete_webhookDelete a webhook permanently.
patch_documentApply a partial update (set / unset / inc / dec / setIfMissing) to an existing document.
update_datasetUpdate a dataset's ACL mode to 'public' or 'private'.
update_projectUpdate a project's display name, studio host, or metadata.
update_webhookUpdate a webhook's configuration.
⌘J