Sanity is a headless content platform. Many teams use it to run their blog or website. The Sanity integration publishes Zerply blog posts straight into your Sanity project. You no longer copy finished content into Sanity Studio by hand.

Connect a project once. After that, a **Publish to Sanity** option appears next to your AI chat replies and inside the blog editor. You trigger each publish yourself. Zerply reads your Sanity schema to publish correctly, but it never pulls your existing content back into Zerply.

The WordPress integration works the same way and lives under **Settings → Integrations**. Connect either one, or both, based on where your site runs.

## Before you start

Gather these first:

- A **Zerply account** with at least one workspace. New to Zerply? Start with [Setting Up Your Workspace](/docs/setting-up-your-workspace/).
- Your Sanity **project ID** and **dataset** name. The dataset is usually `production`.
- An **API token** with Editor access. Create one in [Sanity Manage](https://www.sanity.io/manage), under **API → Tokens**.

A Studio URL is optional. Add it, and Zerply links straight to each document it publishes.

## Connect your Sanity project

1. Go to **Settings → Integrations → Sanity** in Zerply.
2. Find the **Sanity** section and click **Connect Sanity project**.
3. Enter your **Project ID**, **Dataset**, and **API token**.
4. Add your **Studio URL**, for example `https://yourname.sanity.studio`. This step is optional.
5. Click **Detect schema**. Zerply samples your dataset and suggests a document type and field mapping.
6. Review the suggestion, then click **Connect project**.

Zerply checks the token, project, and dataset before it saves the connection. An empty dataset gives detection nothing to read. In that case, type your document type and field names by hand.

Need to publish to more than one project? Click **Add another project** and repeat these steps. A team can connect several Sanity projects at once.

## Check your field mapping

Every Sanity project can name its fields differently. Zerply asks which field holds what, so it writes content to the right place.

Click **Customize schema mapping** to review these:

| Field | What it holds |
| --- | --- |
| **Document type** | The schema type Zerply writes to, for example `post` |
| **Title field** | Where the post title goes |
| **Body field** | Where the post content goes |
| **Slug field** | Where the URL slug goes |
| **Image field** | Where the featured image goes |
| **Published date field** | Where the publish date goes |

Schema detection fills these in for you. Change any value if your project uses a different field name, or if you switch document types.

One field is fixed: the slug always comes from the post title. Zerply does not offer a custom slug field.

## Publish content to Sanity

A connection marked **Connected project** unlocks two publish points:

- A Sanity icon next to each AI chat reply.
- A Sanity icon in the blog editor toolbar.

Click either one to open the **Publish to Sanity** dialog.

1. Pick a **Sanity Project**, if more than one is connected.
2. Check or edit the **post title**.
3. Choose **Save as Draft** or **Publish Immediately** under Status.
4. Click **Publish Now** or **Save as Draft**.

Zerply creates the document and shows a confirmation. When your Studio URL is set, the confirmation links straight to the new document. Occasionally Zerply cannot confirm the write went through cleanly. When that happens, it still tells you the document was created, and it flags what to check in Studio.

One thing to know about images: the featured image you attach becomes a real Sanity image asset. Any other image inside the post body stays as a plain text link instead. Open Studio and check the body if your post carries more than one image.

## Manage your connections

Every connected project appears in **Settings → Integrations → Sanity**.

- **Needs verification** means Zerply has not confirmed the token recently, or the last check failed. Click **Verify** to run it again.
- Only connections marked **Connected project** show up as publish targets. Verify a connection before you rely on it.
- **Remove** disconnects a project from Zerply. Nothing already published to Sanity is affected.

## FAQ

<details>
<summary>Does this integration keep Zerply and Sanity in sync?</summary>

No. Publishing runs one direction, from Zerply into Sanity, and only when you click a publish button. Zerply never reads your Sanity content back in, and never republishes on its own.
</details>

<details>
<summary>Can I publish the same post to WordPress and Sanity?</summary>

Yes. Both integrations live under **Settings → Integrations**, each with its own publish button. Pick whichever destination matches where the post belongs.
</details>

<details>
<summary>What if I skip schema detection?</summary>

You can still connect a project. Type your document type and field names by hand, matching your own Sanity schema. Run **Detect schema** later, once your dataset has documents to sample.
</details>

<details>
<summary>Why does my connection say "Needs verification"?</summary>

Zerply has not confirmed the token, project, and dataset recently, or the last check failed. Click **Verify** on that connection card. Until verification passes, it stays out of the publish dialog.
</details>

<details>
<summary>Can I set my own slug?</summary>

Not currently. Zerply generates the slug from the post title on every publish.
</details>

<details>
<summary>I removed a connection by accident. Did that delete anything in Sanity?</summary>

No. Removing a connection only stops future publishing through Zerply. Add the same project ID and dataset back to restore the link.
</details>
