Integrations / Sanity

Publish to Sanity

Content Lake mutate API. The body is sent as Portable Text; images and tables are not carried over.

How it works

Publishes through Sanity's Content Lake mutate API using an API token. Sanity content is normally structured Portable Text rather than plain markdown, so content lands as a single plain-text block unless your schema is mapped more precisely.

Before you start

  • A Sanity project with a document schema suitable for blog posts
  • An API token with write access (manage.sanity.io, then API, then Tokens)
  • Your Project ID and target dataset name

Setup

  1. 1

    Get your API token

    manage.sanity.io → your project → API → Tokens → Add API token, with Editor or Write permissions.

  2. 2

    Open Setup in your client portal

    Setup shows the connection form for Sanity. If it says no integration is set up yet, message us in Questions and we’ll switch it on. Then fill in:

    FieldRequiredNotes
    Project IDYesmanage.sanity.io → your project → Project ID is on the overview page.
    DatasetYesmanage.sanity.io → your project → Datasets tab.Example: production
    Document typeNoThe _type value your schema uses for blog posts: check schemaTypes/ in the client's Sanity Studio project.Example: post
    API versionNoExample: 2024-01-01
    API tokenYesFrom step 1. Stored encrypted; it can’t be viewed again once saved.
  3. 3

    Click Connect account

    This tests the details against Sanity without creating anything. When it passes, the portal shows “Connected successfully”; if it fails, it shows the error Sanity returned.

  4. 4

    Publish

    Once a piece has passed review, it is sent to Sanity through this connection. No export, import, or copy-pasting into a CMS.

After publishing

If a published piece is revised and pushed again, the same post in Sanity is updated rather than duplicated.

Troubleshooting

If this happensCheck this
Connection test fails with a permission errorSanity tokens are scoped per-project with a role (Viewer, Editor, Administrator). A Viewer-role token will authenticate but can't create documents.
Body content looks unformatted in Sanity's StudioThis is expected without a tightened schema mapping. Since Portable Text is structured JSON specific to your schema, the safe default sends plain text; ask to have the mapping refined once your schema is known.

Frequently asked questions

It ships with a safe plain-text fallback. If your schema expects real Portable Text formatting like bold, links, or embeds, that mapping can be tightened once we know your schema.

You tell it which dataset to target (production, staging, or otherwise) during setup.

They're created live by default; if your Studio workflow expects a draft first, that can be set during the field mapping step.

Credentials are encrypted at rest and only ever used server-side to publish. Nobody, including us, can view them again once saved.

Nothing changes on Sanity itself. Everything already published stays exactly as it is. New posts just stop syncing until it's reconnected.

Want Sanity set up with you?

Book a call and we’ll connect it together.

Book a call