Overview
Sanity is a headless CMS built around structured content and a powerful API. The Siftly–Sanity integration pushes content directly to your Sanity Content Lake as new documents, using Sanity’s GROQ-powered API under the hood. This integration is ideal for teams using Sanity to power content-heavy websites, documentation, or multi-channel publishing pipelines.Prerequisites
Before connecting, you’ll need:- A Sanity project with a schema that includes a document type for your content (e.g.,
post,article) - A Sanity API token with Editor or Deploy Studio write permissions
- Your Sanity Project ID and Dataset name
Step 1: Get your Sanity credentials
Project ID and Dataset
- Log in to sanity.io/manage
- Select your project
- Copy the Project ID from the project overview page
- Note your Dataset name (usually
production)
API Token
- In Sanity Manage, go to API → Tokens
- Click Add API Token
- Give it a descriptive name (e.g., “Siftly Integration”)
- Set the permission level to Editor
- Click Save and copy the token
Step 2: Connect Sanity in Siftly
- In Siftly, go to Settings → Integrations
- Click Connect next to Sanity
- Enter your:
- Project ID
- Dataset name
- API Token
- Click Verify Connection
Step 3: Select your document type
Choose the Sanity document type that Siftly should create when publishing. This is the schema type defined in yourschema.js (e.g., post, blogPost, article).
Siftly will inspect the schema of the chosen type and list its fields for mapping.
Step 4: Map content fields
Map Siftly’s generated fields to your Sanity document schema:| Siftly field | Typical Sanity field | Notes |
|---|---|---|
title | title | Plain text |
slug | slug.current | Sanity slugs are objects: {_type: "slug", current: "..."} |
body | body | Rich text — maps to Portable Text (see below) |
meta_description | seo.description | Path notation supported for nested fields |
published_at | publishedAt | ISO 8601 datetime |
tags | tags[] | Array of strings or references |
Portable Text
Sanity stores rich text as Portable Text — a structured JSON format. Siftly automatically converts generated HTML content to valid Portable Text when publishing to Sanity. Standard formatting is preserved:- Headings (H2, H3, H4)
- Bold, italic, and inline code
- Ordered and unordered lists
- Hyperlinks (including internal links generated by Siftly)
- Block quotes
Custom Portable Text block types (e.g., call-out cards, custom embeds) are not supported by the auto-converter. If your schema uses custom marks or types, those will be omitted and you’ll need to add them manually in Sanity Studio after publishing.
Step 5: Publish content to Sanity
- Open any draft in the Siftly content editor
- Click Publish → Sanity
- Confirm the document type and field mapping
- Click Send to Sanity
_type matching your selected document type and all mapped fields populated. It is created with no publishedAt date set by default — making it a draft in any Sanity-powered frontend that filters by publication date.
Open Sanity Studio to review, edit, and publish the document.
GROQ previewing
After publishing, you can verify the document was created correctly using a GROQ query in Sanity Studio’s Vision tool:Webhooks (optional)
For teams with automated publishing workflows, Siftly can call a Sanity webhook after creating a document — for example, to trigger a re-build of your Next.js or Remix frontend.- In Sanity Manage, go to API → Webhooks → Add Webhook
- Set the URL to your frontend’s webhook endpoint
- Copy the webhook URL
- In Siftly → Settings → Integrations → Sanity → Advanced, paste the webhook URL in Post-publish webhook
Troubleshooting
403 Forbidden on connection
403 Forbidden on connection
Your API token doesn’t have write access to the selected dataset. Regenerate the token with Editor permissions in Sanity Manage.
Document created but fields are empty
Document created but fields are empty
Check your field mapping in Settings → Integrations → Sanity → Configure. Fields that aren’t mapped are left null. Make sure you’ve mapped all required fields.
Slug field isn't saving correctly
Slug field isn't saving correctly
Sanity slugs must be saved as objects:
{_type: "slug", current: "your-slug"}. Make sure the slug field mapping uses the slug.current path, which Siftly handles automatically.Rich text appears as a string, not Portable Text
Rich text appears as a string, not Portable Text
If your body field is typed as
string in Sanity rather than array (Portable Text), the body will be saved as plain HTML. To use Portable Text, the field type in your schema must be array with block items.