Skip to main content
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. Sanity dashboard highlighting the Project ID in the project overview 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). Sanity Datasets tab showing the dataset name to copy 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. Sanity API Tokens page with the Add API token button highlighted Add a new API token in the Sanity API settings. Sanity API token configuration with Developer permissions selected 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. Sanity CORS origins page with the Add CORS origin button highlighted Add a new CORS origin from the API settings. Sanity CORS origin configuration with the RankAI URL entered 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. RankAI Sanity integration form with Project ID, Dataset Name, and API Access Token fields 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 (open the link in a new tab to download).
  2. Save it as rankai.ts (or rankai.js) inside your schemaTypes folder.
RankAI schema file added to a Sanity project in the schemaTypes folder Save the RankAI schema file inside your schemaTypes folder. 3. Update your schemaTypes/index.ts to include the RankAI schema. Sanity schemaTypes index file importing the RankAI schema Import the RankAI schema in your schemaTypes index file. 4. Deploy your schema changes (for example, npx sanity deploy). Terminal command showing Sanity schema deployment Deploy your updated schema to Sanity Studio. 5. Confirm the RankAI schema appears in Sanity Studio. Sanity Studio showing the RankAI schema configured successfully 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 to install the RankAI script.
Last reviewed: October 12, 2026.