CMS setup guides

Sanity

Connect Sanity with a project token.

What you'll need

  • Your Sanity project, and the dataset you want to optimize
  • A project token with permission to read and write assets

Create the token

Create an API token in your Sanity project's management settings, with write access — Inverity needs to read your assets and add the optimized results back. Copy the token when it's shown; Sanity won't display it again.

Name it Inverity so it's identifiable in your token list later.

Connect

  1. In the Inverity dashboard, open Connectors and choose Sanity.
  2. Enter your project details and paste the token.
  3. Select the dataset and the assets you want watched.

What gets optimized

Image assets in the dataset you connect. Documents referencing those assets keep resolving — Inverity replaces the asset, not the references to it.

Good to know

  • Datasets are separate. Connect the dataset you actually deliver from. A production site reading production won't be affected by optimizing a staging dataset.
  • Sanity's image pipeline still applies. Transformation parameters in your queries continue to work on top of the optimized source.
  • Existing assets need a run. Watching covers new uploads.

Disconnecting

Remove the connector in Inverity, then revoke the token in your Sanity project settings.

Troubleshooting

  • "Token is invalid" — the token may lack write access, or belong to a different project. Re-create it with the right permissions.
  • Nothing is being optimized — confirm you selected the correct dataset.

See Connector errors and Tokens and permissions.

Previous
Contentful