Skip to main content
The Sanity integration connects Slate workflows to one dataset in a Sanity project. Use it to write AI-generated content into Sanity documents as drafts, then publish them when they’re ready.

Why connect Sanity to Slate?

Slate generates content through AI-powered workflows. Sanity stores your structured content. Connecting the two moves content from generation into your Sanity dataset in a single automated flow.

Prerequisites

  • The Admin role in your Slate workspace. Members can view integrations but can’t connect them.
  • A Sanity project ID and dataset name
  • A Sanity API token that can read and write documents in that dataset

Setup

Step 1: Gather your Sanity details

Have these values ready before you connect: Each connection covers one project and one dataset. To work with another dataset, add another connection.

Step 2: Connect Sanity in Slate

  1. Open Slate and go to Workspace settings → Integrations.
  2. Under More integrations, find Sanity and click Connect.
  3. Optionally, enter a Connection name (e.g., “Marketing Site” or “Blog”).
  4. Enter your project ID in ProjectId.
  5. Enter your dataset name in Dataset.
  6. Paste your API token into Access token.
  7. Click Connect.
Slate checks the token with a test read and a test write. The test write isn’t saved to your dataset. If both checks pass, the row shows Connected.

Step 3: Use the connection in a workflow

  1. Open or create a workflow.
  2. Add the Sanity block from the Apps section.
  3. Select your connection in Sanity connection.
  4. Choose an Action and enter a Document type.
  5. Map your workflow data to document fields.
For full details on configuring the Sanity block, see the Sanity Block guide.

What you can do

Once connected, the Sanity integration enables the following through the Sanity workflow block:

Use cases

AI-assisted blog drafts

Generate articles with the LLM block, then save them as Sanity drafts for your editors to review in Sanity Studio. Example flow: Input keywords → LLM generates article → Sanity block creates a draft post document

SEO landing pages at scale

Create one draft document per keyword. Map a slug field so each document gets a stable ID. Example flow: Keyword list → Loop block iterates keywords → LLM writes page copy → Sanity block creates a draft for each keyword

Publishing with approval

Use the Human Review block to get sign-off before content goes live. Example flow: LLM drafts case study → Human Review for approval → Sanity block creates the document with Save as draft turned off

Managing connections

View connections

Go to Workspace settings → Integrations to see your Sanity connections. Each connection shows Connected or Needs attention.

Fix a connection that needs attention

A connection shows Needs attention when Slate marks it invalid. For example, Slate marks a connection invalid when Sanity rejects its token. To fix it:
  1. Create a new API token in Sanity with read and write access to the dataset.
  2. Open the ⋮ menu on the Sanity row and choose Add another connection.
  3. Enter the project ID and dataset, paste the new token, and click Connect.
  4. In each Sanity block that used the old connection, select the new connection.
  5. Remove the old connection.
Selecting a different connection in a Sanity block clears the block’s document type, selected document, and field mappings. Set them again after you switch.

Remove a connection

Open the ⋮ menu on the Sanity row and choose Disconnect. If you have more than one connection, expand the row and click Remove next to the connection. Workflows that use the removed connection need a new one.

Troubleshooting

What’s next