Skip to main content
Sanity logo
  • Category: developer tools
  • Auth: API_KEY
  • Composio-managed OAuth available? N/A
  • Tools: 21
  • Triggers: 0
  • Slug: SANITY
  • Version: 20261101_00

Tools

Slug: SANITY_ADD_DEFAULT_ROLE_TO_USERSApply organization default role to all users. Use when you need to assign the organization’s default role to all existing users in the organization. Requires the resource ID of the organization.

Input Parameters

string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_CREATE_ATTR_DEFINITIONCreate a user attribute definition for a Sanity resource with a unique key and a string, number, or boolean type.

Input Parameters

string
required
The unique key/name for the attribute definition. This must be unique within the resource.
boolean
When true, the attribute accepts an array of values. When false or omitted, it accepts a single value.
string ("string" | "number" | "boolean")
required
The data type of the attribute. Must be one of: ‘string’, ‘number’, ‘boolean’.
boolean
When true, the attribute value cannot be modified after creation. Defaults to false.
string
An optional description explaining what this attribute is used for.
string
required
The unique identifier of the specific resource (e.g., organization ID, project ID).
string
required
The type of resource the attribute definition belongs to. Examples: ‘organizations’, ‘projects’, ‘datasets’.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_CREATE_PROMPT_POSTSend a one-shot prompt to the Sanity Content Agent without maintaining conversation context. HTTP errors are returned in the response’s raw_response field.

Input Parameters

object
Agent configuration. Controls behavior, capabilities, and document access.
string ("markdown" | "directives")
Controls how directives in the response are formatted.
string
required
The prompt message to send to the agent
string
Custom instructions for the agent
string
required
Your Sanity organization ID

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_DELETE_ATTR_DEFINITIONDelete a user attribute definition. Use when you need to remove a custom attribute definition from an organization or project in Sanity. The attribute definition controls how user attributes are structured and validated for a given resource. Deleting a definition does not delete existing user attribute values, but users will no longer be able to set values for that attribute.

Input Parameters

string
required
The unique identifier of the resource. For organizations, this is typically like ‘oN7sjLEfL’. For projects, this is the project ID.
string
required
The unique identifier of the attribute definition to delete.
string ("organization" | "project")
required
The type of resource to scope the user attribute definitions to. Common values: ‘organization’ or ‘project’.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_DELETE_DOCUMENTDelete a document from Sanity by ID or query. This action is irreversible when purge is true — the document cannot be recovered once permanently deleted. Use when you need to remove a specific document by ID or bulk delete documents matching a GROQ query (limited to 10,000 documents per operation). For large deletions, paginate by document ID. Set dry_run to true to test the operation without modifying data.

Input Parameters

boolean
If true, permanently removes the document from the history. If false or omitted, the document is soft-deleted and can be recovered.
string
GROQ query string to select documents for deletion. Query-based deletions are limited to 10,000 documents. Either document_id or query must be provided, not both.
object
Optional parameters for the GROQ query when using query-based deletion. Use $variableName syntax in the query.
string
required
The dataset name where the document resides.
boolean
If true, simulates the deletion without actually modifying any documents. Useful for testing.
string
required
The Sanity project ID where the document resides.
boolean
If true, returns the IDs of deleted documents in the response.
string
The ID of the specific document to delete. Either document_id or query must be provided, not both.
boolean
If true, returns the full document content of deleted documents in the response.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_DELETE_USER_ATTRIBUTESDelete specified custom attributes from a Sanity user within an organization. A 404 or empty response produces an empty attribute list, which does not establish the user’s remaining attributes.

Input Parameters

array
required
List of attribute keys to delete from the user
string
required
Unique identifier of the Sanity user
string
required
Unique identifier of the organization

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_DOCUMENTFetch a document by ID from a Sanity dataset in the project configured on the connection. The response may instead report that the document was omitted.

Input Parameters

string
required
The Sanity dataset to fetch the document from.
string
required
The Sanity project ID. This is the unique identifier for your Sanity project.
string
required
The unique identifier of the document to retrieve. This is the _id field of the document.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_INVITE_BY_TOKENRetrieve an invite by its public token for a specified resource. Returns invite details when found; an HTTP 404 is returned as found=false.

Input Parameters

string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type.
string
required
The public token for the invite. This token is shared with the invitee.
string ("organization" | "project" | "media-library" | "canvas" | "dashboard" | "view")
required
The resource type to scope the access requests to. Must be one of: organization, project, media-library, canvas, dashboard, view.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_ORG_ROLERetrieve a specific organization role by its ID. Use this action when you need to fetch details about an organization role including its permissions, title, description, and whether it applies to users or robots. The role must exist for the specified organization.

Input Parameters

string
required
The unique identifier of the role to retrieve
string
required
The unique identifier of the organization

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_PERMISSIONGet a permission for a specific resource. Use when you need to retrieve details about a particular permission including its actions, parameters, and scope. The action retrieves permission information based on the resource type, resource ID, and permission name provided in the path parameters.

Input Parameters

string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type.
string
required
The resource to scope access requests to. Must be one of: ‘organization’ or ‘project’.
string
required
The name of the permission. This is a unique identifier for the permission.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_PROJECTRetrieve details for the Sanity project configured on the connection by its ID, including available project information such as display name, organization, studio host, and timestamps.

Input Parameters

string
required
The unique ID of the project to retrieve.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_ROBOTSTool to get robots with access to a resource. Use when you need to retrieve a list of robots (service accounts) that have been granted access to a specific resource along with their assigned roles. This action supports pagination through the next_cursor parameter.

Input Parameters

integer
The number of items to return per page. Defaults to 100.
string
The cursor for pagination. Use the nextCursor from the previous response to get the next page.
string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type.
string ("organization" | "project" | "media-library" | "canvas" | "dashboard" | "view")
required
The resource type to scope the access requests to. One of: organization, project, media-library, canvas, dashboard, view.
boolean
Whether to include children resources in the response. Only applies to organization resources.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_ROLERetrieve a specific role for a given resource type and resource ID. Use this action when you need to fetch details about a role including its permissions, title, description, and whether it applies to users or robots. The role must exist for the specified resource.

Input Parameters

string
required
The name of the role to retrieve.
string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type.
string ("organization" | "project" | "media-library" | "canvas" | "dashboard" | "view")
required
The resource type to scope the access requests to. Must be one of: organization, project, media-library, canvas, dashboard, view.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_GET_USERSList all users of a resource and their assigned roles. Use when you need to retrieve user information and role assignments for a specific project or organization. Supports pagination via cursor.

Input Parameters

integer
Number of items to return per page. Defaults to 100. Maximum value is 100.
string
Cursor for pagination. Use the nextCursor from the previous response to get the next page of results.
string
required
The resource ID to scope the access request to. Must be a valid ID for the resource type (e.g., project ID or organization ID).
string ("organization" | "project")
required
The resource to scope access requests to. Use ‘organization’ for organization-level access or ‘project’ for project-level access.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_LIST_DATASETSList datasets in the Sanity project configured on the connection, optionally including statistics or filtering by profile or add-on parent.

Input Parameters

string
Only return add-on datasets for this parent dataset.
string
required
Project ID, which must match the connected Sanity project.
boolean
Include dataset statistics when true; false and omitted leave statistics out.
string
Only return datasets with this dataset profile.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_LIST_ORG_ROLESList all roles available for an organization. Use this action to retrieve all available roles that can be assigned to users within a specific Sanity organization. The organization_id is required to identify which organization’s roles to list.

Input Parameters

string
required
The unique identifier of the organization

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_LIST_USER_ATTRIBUTESTool to retrieve user attributes from a Sanity organization. Use when you need to get the attributes (such as roles, permissions, or custom properties) associated with a specific user in a Sanity organization. Supports pagination via the cursor parameter.

Input Parameters

integer
Maximum number of attributes to return
string
The last attribute key from the previous page (used for pagination)
string
required
Unique identifier of the Sanity user
string
required
Unique identifier of the organization

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_MUTATE_DOCUMENTSApply or dry-run one atomic batch of create, replace, conditional-create, patch, and delete mutations in a Sanity dataset. Calls commit unless dry_run is true; a delete with purge permanently removes document history.

Input Parameters

string
A request tag included in Sanity logs.
string
required
The dataset in which to apply the mutations.
boolean
Whether to validate and simulate the mutations without committing them.
array
required
Ordered create, create-or-replace, create-if-missing, delete, or patch operations. Non-dry-run batches commit all operations atomically.
string
required
The Sanity project ID, which must match the connected project.
boolean
Whether to return affected document IDs.
string ("sync" | "async" | "deferred")
When the mutations become query-visible: sync, async, or deferred.
string
A caller-selected unique transaction ID.
boolean
Whether to return changed document bodies.
boolean
Whether to generate keys for array items that lack them.
boolean
Whether to treat cross-dataset references as weak during validation.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_QUERY_ALL_SCREENINGExecute a GROQ query against a Sanity dataset, defaulting to screening documents. Supports optional query parameters; requests are sent without authentication headers.

Input Parameters

string
GROQ query string to execute. Defaults to querying all documents of type ‘screening’.
object
Optional parameters to pass to the GROQ query. Use $variableName syntax in query.
string
The Sanity dataset to query. Defaults to ‘production’.
boolean
If true, returns query execution plan details.
boolean
If true, includes source map information in the response.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_QUERY_DOCUMENTSExecute a GROQ query against a Sanity dataset in the project configured on the connection. Supports optional parameters, perspective control, and CDN use; results can be any JSON value, including arrays, objects, scalars, or null.

Input Parameters

string
required
The GROQ query string to execute. GROQ is Sanity’s query language for fetching and transforming documents.
object
Optional parameters for the GROQ query. Use $variableName syntax in the query string, then pass the values here (e.g., query=’*[_type == $type]’ with params={‘type’: ‘post’}).
boolean
Whether to use Sanity’s CDN for faster response times. Recommended for read-heavy workloads with data that doesn’t change frequently.
string
required
The dataset name to query within the project (e.g., ‘production’, ‘staging’).
string
required
The Sanity project ID to query. This identifies which project’s data to access.
string ("published" | "previewDrafts" | "raw")
Perspective determines which version of documents to query.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_UPDATE_ORG_ACLTool to assign a role to a member in a Sanity organization. Use when adding or modifying user roles within an organization.

Input Parameters

string
required
The role name to assign (e.g., ‘administrator’, ‘member’)
string
required
The Sanity user ID to assign the role to
string
required
The ID of the organization

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_UPDATE_USER_ATTRIBUTES_VALUESUpdate user attribute values for a resource. Use this action to set or update custom attributes for a user within an organization or project. When setting a value for an attribute key that also exists in SAML, the Sanity value will take precedence and shadow the SAML value.

Input Parameters

string
required
The unique identifier of the user whose attributes to update.
object
required
A dictionary of attribute key-value pairs to set for the user. Values can be strings, numbers, booleans, arrays, or nested objects. These will shadow any SAML values for the same keys.
string
required
The unique identifier of the resource. For organizations, this is the organization ID.
string ("organization" | "project")
required
The type of resource that scopes the user attributes (e.g., ‘organization’ or ‘project’).

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_UPLOAD_IMAGE_ASSETUpload raw image bytes to a dataset in the connected Sanity project.

Input Parameters

string
Request tag for Sanity logs.
array
Metadata extractors such as palette, lqip, blurhash, and thumbhash.
object
required
Image file whose raw bytes are uploaded.
string
Freeform asset label.
string
Asset title.
string
required
Dataset in which to create the image asset.
string
Original filename override. Defaults to the uploaded file name.
string
Asset ID in the external source. Sanity ignores it unless source_name is provided.
string
required
Project ID, which must match the connected Sanity project.
string
Attribution URL for the external source. Sanity ignores it unless source_name is provided.
string
Required supplier credit.
string
Asset description.
string
External source name. Must be provided with source_id.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not
Slug: SANITY_VALIDATE_CREDENTIALValidate Sanity API credentials by fetching the authenticated user’s information. Use this action when you need to verify that an API token is valid and has proper authentication. This action returns user information and accessible projects if the token is valid.

Output

string
required
Data from the action execution
string
Error if any occurred during the execution of the action
boolean
required
Whether or not the action execution was successful or not