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

# Sanity blog integration guide

> Sanity blog integration guide. Follow the original illustrated setup steps.

This guide walks you through connecting your Sanity project to RankAI so we can publish and manage your SEO and AEO content. You will need access to your Sanity project settings and your RankAI dashboard.

## Where to start in RankAI

In your RankAI project, open **Settings** in the sidebar. Under **Site Integration**, find **Connected CMS** and click **Configure**. On the next screen, select **Sanity** to continue.

## Step 1: Get your Sanity project ID

Open your Sanity Dashboard and go to **Organization Settings** using **Manage** (top-left). Select the project you want to connect, then copy the **Project ID** shown near the top of the page.

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-project-id.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=c1b61d964a5669dab6e081e274484d70" alt="Sanity dashboard highlighting the Project ID in the project overview" width="3456" height="1986" data-path="resources/sanity-integration/sanity-project-id.png" />

*Copy the Project ID from the top of the Sanity project overview.*

Paste the project ID into the **Sanity Project ID** field in RankAI.

## Step 2: Find your dataset name

In the same Sanity project, open the **Datasets** tab and copy the dataset name you want RankAI to publish to (for example, `production`).

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-dataset-name.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=a66a9563953292ebde8aef2577ad0d92" alt="Sanity Datasets tab showing the dataset name to copy" width="3456" height="1986" data-path="resources/sanity-integration/sanity-dataset-name.png" />

*Copy the dataset name from the Datasets tab.*

Paste the dataset name into the **Sanity Dataset Name** field in RankAI.

## Step 3: Create an API token and add a CORS origin

RankAI needs an API token with write access and an approved CORS origin for publishing. Follow the steps below in your Sanity project settings.

* Go to **API** > **Tokens** > **Add API token**. Give it a name, set the permission to **Developer** or **Editor**, then copy the token.

  <img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-add-api-token.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=35ffa23b59c7b2038d575a77dd55a1c1" alt="Sanity API Tokens page with the Add API token button highlighted" width="3456" height="1986" data-path="resources/sanity-integration/sanity-add-api-token.png" />

  *Add a new API token in the Sanity API settings.*

  <img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-token-config.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=a8e55630022e59d563c79e187c93a7a1" alt="Sanity API token configuration with Developer permissions selected" width="3456" height="1986" data-path="resources/sanity-integration/sanity-token-config.png" />

  *Configure the token name and select Developer or Editor permissions.*
* In **API** > **CORS origins**, click **Add CORS origin** and add your RankAI app URL (for example, `https://rankai.ai`). Save your changes.

  <img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-add-cors-origin.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=c5f8aa5f8f1315f54c39ab768a49acfd" alt="Sanity CORS origins page with the Add CORS origin button highlighted" width="3456" height="1986" data-path="resources/sanity-integration/sanity-add-cors-origin.png" />

  *Add a new CORS origin from the API settings.*

  <img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-cors-origin-config.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=84886220d6c90dfd5b515ff4fee48ba9" alt="Sanity CORS origin configuration with the RankAI URL entered" width="3456" height="1986" data-path="resources/sanity-integration/sanity-cors-origin-config.png" />

  *Enter your RankAI app URL and save the CORS origin.*
* Paste the token into the **Sanity API Access Token** field in RankAI, then click **Connect**.

  <img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/rankai-sanity-auth.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=017190f5d30f198595cc1cf14ded7c5d" alt="RankAI Sanity integration form with Project ID, Dataset Name, and API Access Token fields" width="2946" height="1986" data-path="resources/sanity-integration/rankai-sanity-auth.png" />

  *Enter your Sanity project ID, dataset name, and API token in RankAI.*

Note

If publishing fails, double-check that the API token has write permissions and that your RankAI app URL is listed in CORS origins.

## Optional: Add the RankAI schema to Sanity Studio

RankAI publishes to a schema type called `RankAIBlogPosts`. If you want to view the content in Sanity Studio, add the schema to your project:

1. Download the schema file at [https://rankai.ai/sanity/rankaiblog.txt](https://rankai.ai/sanity/rankaiblog.txt) (open the link in a new tab to download).
2. Save it as `rankai.ts` (or `rankai.js`) inside your `schemaTypes` folder.

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/rankai-schema.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=6d1eb3d832d611ef82b7bf9d856f9db1" alt="RankAI schema file added to a Sanity project in the schemaTypes folder" width="3456" height="2234" data-path="resources/sanity-integration/rankai-schema.png" />

*Save the RankAI schema file inside your schemaTypes folder.*
3\. Update your `schemaTypes/index.ts` to include the RankAI schema.

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/schema-index-file.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=25b5093b04ab2fd7b20d67105c7662ce" alt="Sanity schemaTypes index file importing the RankAI schema" width="3456" height="2234" data-path="resources/sanity-integration/schema-index-file.png" />

*Import the RankAI schema in your schemaTypes index file.*
4\. Deploy your schema changes (for example, `npx sanity deploy`).

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/sanity-deploy.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=5c86ea832654a7f70a1718d06c0f8254" alt="Terminal command showing Sanity schema deployment" width="3456" height="2234" data-path="resources/sanity-integration/sanity-deploy.png" />

*Deploy your updated schema to Sanity Studio.*
5\. Confirm the RankAI schema appears in Sanity Studio.

<img src="https://mintcdn.com/rank-ai/Y6IIR1ZQMun_fptm/resources/sanity-integration/ranki-sanity-studio.png?fit=max&auto=format&n=Y6IIR1ZQMun_fptm&q=85&s=d7e8dfff4c3f1f5758847bdb111937ef" alt="Sanity Studio showing the RankAI schema configured successfully" width="3456" height="1986" data-path="resources/sanity-integration/ranki-sanity-studio.png" />

*RankAI schema is now available in Sanity Studio.*

## FAQ

### Which permissions should the API token have?

Use a token with **Developer** or **Editor** permissions so RankAI can create and publish documents.

### What schema does RankAI publish to?

RankAI publishes to `RankAIBlogPosts`. You can add the schema to Sanity Studio to view and manage content there.

### Where can I get more support?

Contact your RankAI account team or check the help section in your dashboard.

## Install the technical SEO & AEO script

The CMS connection above handles articles. Follow the separate [illustrated technical SEO & AEO setup](/integrations/technical-seo/sanity) to install the RankAI script.

***

*Last reviewed: October 12, 2026.*


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