> ## Documentation Index
> Fetch the complete documentation index at: https://hyperlocalise.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sanity Studio plugin

> How sanity-plugin-hyperlocalise authenticates, and how to release it.

The Studio plugin lives in `apps/sanity-studio-plugin` and talks to `apps/hyperlocalise-web` through `/api/integrations/sanity/*`. End-user workflow is in [Localize Sanity Studio documents](https://hyperlocalise.dev/platform/connections/sanity-studio-plugin.md).

## Authentication

Editors paste a Hyperlocalise API key into the plugin. The plugin sends it in the `X-Hyperlocalise-Api-Key` header on every request. The key needs `files:read`, `files:write`, `jobs:read`, and `jobs:write`.

The first request with a usable key creates a **Sanity Studio plugin** connection for it (`resolveSanityConnectionForApiKey` in `apps/hyperlocalise-web/src/lib/sanity/connections.ts`). Later requests reuse that connection. Disabling the connection under **Integrations → Sanity Studio plugin** or revoking the key stops the plugin.

`/api/integrations/sanity/*` allows any Studio origin and never allows credentials, because it authenticates only with the header. Self-hosted Studios on custom domains need no allowlist. `GET /api/integrations/sanity/health` needs no key and returns `{ "ok": true }`.

## App URL

The plugin defaults to `https://www.hyperlocalise.com`. A Studio overrides it with `SANITY_STUDIO_HYPERLOCALISE_APP_URL`, which Sanity's build reads from the Studio environment. The in-repo dev studio's `.env.example` sets it to `http://localhost:3000`. The plugin saves the app URL in settings storage per Sanity project and dataset.

## Package and CI

* Source: `apps/sanity-studio-plugin` (npm name `sanity-plugin-hyperlocalise`).
* CI: `.github/workflows/sanity-studio-plugin.yml`.
* Publish: tag `sanity-studio-plugin-v*` triggers `.github/workflows/sanity-studio-plugin-publish.yml`.

### Release a new version

1. Bump `version` in `apps/sanity-studio-plugin/package.json` and merge it to `main`.
2. Tag the merge commit with the same version and push the tag, for example `sanity-studio-plugin-v1.0.1`. The workflow fails if the tag and `version` differ.
3. The workflow stages the release on npm with trusted publishing. Nothing is installable yet.
4. A maintainer with 2FA approves it on npmjs.com under account settings → **Staged Packages**, or runs `npm stage list sanity-plugin-hyperlocalise` and then `npm stage approve <stage-id>`. Use `npm stage reject <stage-id>` to discard it.

Versions with a prerelease suffix, such as `1.1.0-beta.1`, are staged under the `next` dist-tag.

The npm trusted publisher allows `npm stage publish` only. Do not enable **Allow npm publish**, because that lets the workflow skip approval. A staged version reserves its version number, so bump the version before you retry a rejected release.

Design notes: [`docs/adr/2026-10-20-sanity-studio-plugin-inspector.md`](https://github.com/hyperlocalise/hyperlocalise/blob/main/docs/adr/2026-10-20-sanity-studio-plugin-inspector.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.