> ## Documentation Index
> Fetch the complete documentation index at: https://composio-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sanity

> Sanity is a headless CMS platform that provides structured content storage and APIs for modern applications

![Sanity logo](https://mintcdn.com/composio-preview/YYC5iurbUCUzEs77/images/toolkits/sanity.svg?fit=max\&auto=format\&n=YYC5iurbUCUzEs77\&q=85\&s=da9d9a24977a2971ff508bc02e0d2bb0)

* **Category:** developer tools
* **Auth:** API\_KEY
* **Composio-managed OAuth available?** N/A
* **Tools:** 21
* **Triggers:** 0
* **Slug:** `SANITY`
* **Version:** 20261101\_00

## Tools

> [accordion] Add Default Role to Users
>
> **Slug:** `SANITY_ADD_DEFAULT_ROLE_TO_USERS`
>
> Apply 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
>
> **resource\_id** `string` *required*
>
> The resource ID to scope the access request to. Must be a valid ID for the resource type.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Create Attribute Definition
>
> **Slug:** `SANITY_CREATE_ATTR_DEFINITION`
>
> Create a user attribute definition for a Sanity resource with a unique key and a string, number, or boolean type.
>
> #### Input Parameters
>
> **key** `string` *required*
>
> The unique key/name for the attribute definition. This must be unique within the resource.
>
> **list** `boolean`
>
> When true, the attribute accepts an array of values. When false or omitted, it accepts a single value.
>
> **type** `string ("string" | "number" | "boolean")` *required*
>
> The data type of the attribute. Must be one of: 'string', 'number', 'boolean'.
>
> **read\_only** `boolean`
>
> When true, the attribute value cannot be modified after creation. Defaults to false.
>
> **description** `string`
>
> An optional description explaining what this attribute is used for.
>
> **resource\_id** `string` *required*
>
> The unique identifier of the specific resource (e.g., organization ID, project ID).
>
> **resource\_type** `string` *required*
>
> The type of resource the attribute definition belongs to. Examples: 'organizations', 'projects', 'datasets'.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Create Prompt Post
>
> **Slug:** `SANITY_CREATE_PROMPT_POST`
>
> Send 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
>
> **config** `object`
>
> Agent configuration. Controls behavior, capabilities, and document access.
>
> **format** `string ("markdown" | "directives")`
>
> Controls how directives in the response are formatted.
>
> **message** `string` *required*
>
> The prompt message to send to the agent
>
> **instructions** `string`
>
> Custom instructions for the agent
>
> **organizationId** `string` *required*
>
> Your Sanity organization ID
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Delete User Attribute Definition
>
> **Slug:** `SANITY_DELETE_ATTR_DEFINITION`
>
> Delete 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
>
> **resource\_id** `string` *required*
>
> The unique identifier of the resource. For organizations, this is typically like 'oN7sjLEfL'. For projects, this is the project ID.
>
> **definition\_id** `string` *required*
>
> The unique identifier of the attribute definition to delete.
>
> **resource\_type** `string ("organization" | "project")` *required*
>
> The type of resource to scope the user attribute definitions to. Common values: 'organization' or 'project'.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Delete Document
>
> **Slug:** `SANITY_DELETE_DOCUMENT`
>
> Delete 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
>
> **purge** `boolean`
>
> If true, permanently removes the document from the history. If false or omitted, the document is soft-deleted and can be recovered.
>
> **query** `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.
>
> **params** `object`
>
> Optional parameters for the GROQ query when using query-based deletion. Use \$variableName syntax in the query.
>
> **dataset** `string` *required*
>
> The dataset name where the document resides.
>
> **dry\_run** `boolean`
>
> If true, simulates the deletion without actually modifying any documents. Useful for testing.
>
> **project\_id** `string` *required*
>
> The Sanity project ID where the document resides.
>
> **return\_ids** `boolean`
>
> If true, returns the IDs of deleted documents in the response.
>
> **document\_id** `string`
>
> The ID of the specific document to delete. Either document\_id or query must be provided, not both.
>
> **return\_documents** `boolean`
>
> If true, returns the full document content of deleted documents in the response.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Delete User Attributes
>
> **Slug:** `SANITY_DELETE_USER_ATTRIBUTES`
>
> Delete 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
>
> **attributes** `array` *required*
>
> List of attribute keys to delete from the user
>
> **sanity\_user\_id** `string` *required*
>
> Unique identifier of the Sanity user
>
> **organization\_id** `string` *required*
>
> Unique identifier of the organization
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Document by ID
>
> **Slug:** `SANITY_GET_DOCUMENT`
>
> Fetch 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
>
> **dataset** `string` *required*
>
> The Sanity dataset to fetch the document from.
>
> **project\_id** `string` *required*
>
> The Sanity project ID. This is the unique identifier for your Sanity project.
>
> **document\_id** `string` *required*
>
> The unique identifier of the document to retrieve. This is the \_id field of the document.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Invite By Token
>
> **Slug:** `SANITY_GET_INVITE_BY_TOKEN`
>
> Retrieve 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
>
> **resourceId** `string` *required*
>
> The resource ID to scope the access request to. Must be a valid ID for the resource type.
>
> **inviteToken** `string` *required*
>
> The public token for the invite. This token is shared with the invitee.
>
> **resourceType** `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
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Organization Role
>
> **Slug:** `SANITY_GET_ORG_ROLE`
>
> Retrieve 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
>
> **roleId** `string` *required*
>
> The unique identifier of the role to retrieve
>
> **organizationId** `string` *required*
>
> The unique identifier of the organization
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Permission
>
> **Slug:** `SANITY_GET_PERMISSION`
>
> Get 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
>
> **resource\_id** `string` *required*
>
> The resource ID to scope the access request to. Must be a valid ID for the resource type.
>
> **resource\_type** `string` *required*
>
> The resource to scope access requests to. Must be one of: 'organization' or 'project'.
>
> **permission\_name** `string` *required*
>
> The name of the permission. This is a unique identifier for the permission.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Project
>
> **Slug:** `SANITY_GET_PROJECT`
>
> Retrieve 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
>
> **project\_id** `string` *required*
>
> The unique ID of the project to retrieve.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Robots
>
> **Slug:** `SANITY_GET_ROBOTS`
>
> Tool 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
>
> **limit** `integer`
>
> The number of items to return per page. Defaults to 100.
>
> **next\_cursor** `string`
>
> The cursor for pagination. Use the nextCursor from the previous response to get the next page.
>
> **resource\_id** `string` *required*
>
> The resource ID to scope the access request to. Must be a valid ID for the resource type.
>
> **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.
>
> **include\_children** `boolean`
>
> Whether to include children resources in the response. Only applies to organization resources.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Get Role
>
> **Slug:** `SANITY_GET_ROLE`
>
> Retrieve 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
>
> **roleName** `string` *required*
>
> The name of the role to retrieve.
>
> **resourceId** `string` *required*
>
> The resource ID to scope the access request to. Must be a valid ID for the resource type.
>
> **resourceType** `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
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] List Resource Users
>
> **Slug:** `SANITY_GET_USERS`
>
> List 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
>
> **limit** `integer`
>
> Number of items to return per page. Defaults to 100. Maximum value is 100.
>
> **next\_cursor** `string`
>
> Cursor for pagination. Use the nextCursor from the previous response to get the next page of results.
>
> **resource\_id** `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).
>
> **resource\_type** `string ("organization" | "project")` *required*
>
> The resource to scope access requests to. Use 'organization' for organization-level access or 'project' for project-level access.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] List Datasets
>
> **Slug:** `SANITY_LIST_DATASETS`
>
> List datasets in the Sanity project configured on the connection, optionally including statistics or filtering by profile or add-on parent.
>
> #### Input Parameters
>
> **addon\_for** `string`
>
> Only return add-on datasets for this parent dataset.
>
> **project\_id** `string` *required*
>
> Project ID, which must match the connected Sanity project.
>
> **include\_stats** `boolean`
>
> Include dataset statistics when true; false and omitted leave statistics out.
>
> **dataset\_profile** `string`
>
> Only return datasets with this dataset profile.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] List Organization Roles
>
> **Slug:** `SANITY_LIST_ORG_ROLES`
>
> List 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
>
> **organization\_id** `string` *required*
>
> The unique identifier of the organization
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] List User Attributes
>
> **Slug:** `SANITY_LIST_USER_ATTRIBUTES`
>
> Tool 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
>
> **limit** `integer`
>
> Maximum number of attributes to return
>
> **cursor** `string`
>
> The last attribute key from the previous page (used for pagination)
>
> **sanity\_user\_id** `string` *required*
>
> Unique identifier of the Sanity user
>
> **organization\_id** `string` *required*
>
> Unique identifier of the organization
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Mutate Documents
>
> **Slug:** `SANITY_MUTATE_DOCUMENTS`
>
> Apply 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
>
> **tag** `string`
>
> A request tag included in Sanity logs.
>
> **dataset** `string` *required*
>
> The dataset in which to apply the mutations.
>
> **dry\_run** `boolean`
>
> Whether to validate and simulate the mutations without committing them.
>
> **mutations** `array` *required*
>
> Ordered create, create-or-replace, create-if-missing, delete, or patch operations. Non-dry-run batches commit all operations atomically.
>
> **project\_id** `string` *required*
>
> The Sanity project ID, which must match the connected project.
>
> **return\_ids** `boolean`
>
> Whether to return affected document IDs.
>
> **visibility** `string ("sync" | "async" | "deferred")`
>
> When the mutations become query-visible: sync, async, or deferred.
>
> **transaction\_id** `string`
>
> A caller-selected unique transaction ID.
>
> **return\_documents** `boolean`
>
> Whether to return changed document bodies.
>
> **auto\_generate\_array\_keys** `boolean`
>
> Whether to generate keys for array items that lack them.
>
> **skip\_cross\_dataset\_references\_validation** `boolean`
>
> Whether to treat cross-dataset references as weak during validation.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Query All Screening
>
> **Slug:** `SANITY_QUERY_ALL_SCREENING`
>
> Execute a GROQ query against a Sanity dataset, defaulting to screening documents. Supports optional query parameters; requests are sent without authentication headers.
>
> #### Input Parameters
>
> **query** `string`
>
> GROQ query string to execute. Defaults to querying all documents of type 'screening'.
>
> **params** `object`
>
> Optional parameters to pass to the GROQ query. Use \$variableName syntax in query.
>
> **dataset** `string`
>
> The Sanity dataset to query. Defaults to 'production'.
>
> **explain** `boolean`
>
> If true, returns query execution plan details.
>
> **resultSourceMap** `boolean`
>
> If true, includes source map information in the response.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Query Documents
>
> **Slug:** `SANITY_QUERY_DOCUMENTS`
>
> Execute 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
>
> **query** `string` *required*
>
> The GROQ query string to execute. GROQ is Sanity's query language for fetching and transforming documents.
>
> **params** `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'}).
>
> **useCdn** `boolean`
>
> Whether to use Sanity's CDN for faster response times. Recommended for read-heavy workloads with data that doesn't change frequently.
>
> **dataset** `string` *required*
>
> The dataset name to query within the project (e.g., 'production', 'staging').
>
> **project\_id** `string` *required*
>
> The Sanity project ID to query. This identifies which project's data to access.
>
> **perspective** `string ("published" | "previewDrafts" | "raw")`
>
> Perspective determines which version of documents to query.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Update Organization ACL
>
> **Slug:** `SANITY_UPDATE_ORG_ACL`
>
> Tool to assign a role to a member in a Sanity organization. Use when adding or modifying user roles within an organization.
>
> #### Input Parameters
>
> **role\_name** `string` *required*
>
> The role name to assign (e.g., 'administrator', 'member')
>
> **sanity\_user\_id** `string` *required*
>
> The Sanity user ID to assign the role to
>
> **organization\_id** `string` *required*
>
> The ID of the organization
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Update User Attributes Values
>
> **Slug:** `SANITY_UPDATE_USER_ATTRIBUTES_VALUES`
>
> Update 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
>
> **userId** `string` *required*
>
> The unique identifier of the user whose attributes to update.
>
> **attributes** `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.
>
> **resourceId** `string` *required*
>
> The unique identifier of the resource. For organizations, this is the organization ID.
>
> **resourceType** `string ("organization" | "project")` *required*
>
> The type of resource that scopes the user attributes (e.g., 'organization' or 'project').
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Upload Image Asset
>
> **Slug:** `SANITY_UPLOAD_IMAGE_ASSET`
>
> Upload raw image bytes to a dataset in the connected Sanity project.
>
> #### Input Parameters
>
> **tag** `string`
>
> Request tag for Sanity logs.
>
> **meta** `array`
>
> Metadata extractors such as palette, lqip, blurhash, and thumbhash.
>
> **image** `object` *required*
>
> Image file whose raw bytes are uploaded.
>
> **label** `string`
>
> Freeform asset label.
>
> **title** `string`
>
> Asset title.
>
> **dataset** `string` *required*
>
> Dataset in which to create the image asset.
>
> **filename** `string`
>
> Original filename override. Defaults to the uploaded file name.
>
> **source\_id** `string`
>
> Asset ID in the external source. Sanity ignores it unless source\_name is provided.
>
> **project\_id** `string` *required*
>
> Project ID, which must match the connected Sanity project.
>
> **source\_url** `string`
>
> Attribution URL for the external source. Sanity ignores it unless source\_name is provided.
>
> **credit\_line** `string`
>
> Required supplier credit.
>
> **description** `string`
>
> Asset description.
>
> **source\_name** `string`
>
> External source name. Must be provided with source\_id.
>
> #### Output
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not

> [accordion] Validate Credential
>
> **Slug:** `SANITY_VALIDATE_CREDENTIAL`
>
> Validate 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
>
> **data** `string` *required*
>
> Data from the action execution
>
> **error** `string`
>
> Error if any occurred during the execution of the action
>
> **successful** `boolean` *required*
>
> Whether or not the action execution was successful or not
