> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Sanity with Organization API Token – StackOne Hub

> Link a Sanity account in the StackOne Hub using Organization API Token. End-user guide to authorize the integration and start using Sanity actions.

> [!WARNING]
>
> Sanity says that "to create an organization token, you must have developer or equivalent role in the organization." A token with an expiry stops working on that date, and Sanity does not let you remove an expiry once it is set, so leave the expiry unset unless your policy requires one.

## Find your Organization ID

Sanity's CLI lists the organizations you belong to, with their IDs.

<ul>
  <li>Run `npx sanity@latest organizations list`.</li>
  <li>Find your organization in the output.</li>
  <li>Copy the **Organization ID** across.</li>
</ul>

## Create the organization token

An organization token belongs to the organization, not to a single project, so one connection covers every project the organization owns. The token must be able to read the organization's members, invitations and roles.

**1. Create the token**

Sign in as a member with the Developer role or an equivalent role, then use one of these two routes. StackOne only reads, so add no other grant.

<ul>
  <li>**Sanity CLI (8.19.0 or later):** Run `npx sanity@latest tokens create StackOne --organization <Organization ID> --grant access=viewer` with your **Organization ID** in place of `<Organization ID>`. The token never expires unless you add `--expires-at`.</li>
  <li>**Sanity Manage:** In [Sanity Manage](https://www.sanity.io/manage), open your organization, select **API** > **Tokens** > **Add new token**, name the token `StackOne`, grant only the access-management permission at its Viewer level (`access=viewer` in the CLI), and leave the expiry unset.</li>
</ul>

**2. Copy the token**

Sanity shows the token once, right after you create it.

<ul>
  <li>Copy the **Organization API Token** across.</li>
</ul>

## What this connection reads

The connection covers everyone who holds a role in the organization or in a project the organization owns, and pending invitations.

<ul>
  <li>Projects owned by a person and never moved into the organization are not included. Move them into the organization in sanity.io/manage to include their members.</li>
  <li>Robot tokens are not listed as users. Review them in sanity.io/manage under **API** > **Tokens**.</li>
</ul>

## Revoke access

To stop StackOne from reading your organization, delete the token.

<ul>
  <li>In [Sanity Manage](https://www.sanity.io/manage), open your organization and select **API** > **Tokens**.</li>
  <li>Delete the `StackOne` token. Sanity rejects it from then on.</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).

## Next Steps

> [card] [Webhooks setup](https://docs.stackone.com/connectors/sanity/guides/webhook-setup.md)
>
> Configure receiving Events for Sanity into StackOne.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.