Locked out of your Sanity project? Recover access from an ex-developer

By Nayan Kyada · · 7 min read

Part of The Sanity + Next.js Guide

If you are locked out of your Sanity project, the usual story is simple: a freelancer or agency created it under their own login, the site went live, and now nobody on your team can open the management console. The content still renders on the website, so it feels fine, until you need a new editor, a new domain, or a bill gets paid late. This post covers how to confirm what you actually own, how to get access back, and how to make sure it cannot happen again.

Symptoms that you don't own your Sanity project

The warning signs show up in small, boring moments:

  • You open the Studio URL and can log in, but you cannot invite a new editor.
  • The management console at sanity.io/manage shows nothing for your company email.
  • Invoices or plan emails go to a personal address you don't recognize.
  • The website deploy uses an API token nobody can identify or regenerate.
  • Adding your new domain to the allowed CORS origins is impossible because only the old developer can edit them.

Being able to edit content is not the same as owning the project. Editors can write and publish without ever holding the keys. The keys are admin roles on the project, ideally under an organization your company controls.

What it costs to ignore it

The risk is rarely dramatic on day one. It is slow and expensive on the day something changes. A developer's account can be closed, a card can expire, or a person can simply stop answering messages. When the plan lapses or the project is deleted, the dataset goes with it, and the live site is only as safe as the last export someone made.

There is also a security side. Tokens created by a past developer are still valid until someone revokes them. If one of those leaked into a public repo, you want to know. The post on an exposed Sanity API token in a Next.js site covers how to check for that.

Step 1: find out who actually owns what

Before you email anyone, gather facts. You need four answers:

  1. The project ID. It is visible in the site's code (the Sanity client config or the public environment variables) and in the Studio configuration. It is not a secret.
  2. The dataset names in use, usually production, sometimes staging.
  3. Which organization, if any, the project belongs to.
  4. Who has admin roles right now.

The project ID is the key that lets you ask Sanity support about the right project. If your repository is accessible, search it for the client config. If not, the browser's network tab on the live site will show requests to an API host that begins with the project ID.

Step 2: ask for admin, not just access

If the previous developer is still reachable, the cleanest fix takes ten minutes. Ask them to do these in the management console:

  • Invite your company email as an administrator on the project.
  • Move the project into an organization your company owns, if the console offers it for your plan, or create one and add yourself as owner.
  • Update the billing contact to your finance address.
  • Confirm in writing that they no longer need access, then remove themselves, or ask you to remove them.

Be specific about administrator. A common mistake is accepting an editor invite, feeling reassured, and discovering six months later that you can't create tokens or manage CORS. If you need a refresher on what each role can do, the post on Sanity roles and document-level permissions explains the model.

Step 3: if the developer is gone

When nobody answers, work through these in order:

  1. Check whether anyone at your company already has an admin role under a different email. Old agency contacts and former employees are the usual surprises.
  2. Look for transactional emails from Sanity in shared inboxes, such as billing receipts or invitations. They tell you which address owns the account.
  3. Contact Sanity support with the project ID, your company details, and evidence that you own the website and domain. Support decides case by case, so expect questions and don't expect an instant answer.
  4. In parallel, protect the content. Even a partial export beats nothing.

The parallel part matters. Don't wait for support before you start planning a fallback. If you can get any admin-level login, even temporary, take a full export straight away.

# Run from any machine where you are logged in with project access
npx sanity login
npx sanity dataset list
npx sanity dataset export production ./backup-production.tar.gz
 
# Check which origins the project currently allows
npx sanity cors list

The export includes documents and, by default, the assets. Store the archive somewhere your company controls, not only on one person's laptop.

Step 4: reset every credential

Once you hold admin access, assume every credential the old developer touched is compromised, even if only by neglect:

  • Create new read and write API tokens, scoped to what each integration needs.
  • Replace them in your hosting environment variables and webhook secrets, then redeploy.
  • Delete the old tokens only after the new deploy is confirmed working, so the site doesn't go down mid-change.
  • Review CORS origins and remove domains you don't recognize.
  • Review webhooks and remove any that point at endpoints you don't control.

A quick sanity check on the website side is to confirm that only server code reads the write token:

// lib/sanity/server-client.ts
import { createClient } from 'next-sanity'
 
export const serverClient = createClient({
  projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!,
  dataset: process.env.NEXT_PUBLIC_SANITY_DATASET!,
  apiVersion: '2025-01-01',
  useCdn: false,
  // Never prefix this variable with NEXT_PUBLIC_
  token: process.env.SANITY_API_WRITE_TOKEN,
})

If the write token variable has a public prefix anywhere in the repo, treat that as an incident and rotate it immediately.

Step 5: make it impossible to repeat

After recovery, put the following in place so the project survives the next staff change:

  • The project lives under an organization owned by your company, with at least two admins.
  • Billing goes to a shared finance address, not a person.
  • Tokens are documented: name, purpose, where it is stored, who can rotate it.
  • A scheduled export exists, even a monthly manual one, stored outside the project.
  • Hosting and repository access are under company accounts too.

This is the same list I'd expect in a proper handover, and the Sanity project handover checklist goes through it item by item. If the codebase itself is also in doubt, taking over a Next.js project after your developer disappears covers the repository and hosting side.

What to ask a developer you bring in

Whoever you hire to clean this up should be able to answer these without hedging:

  • Which organization will the project sit under when you finish, and who are its admins?
  • How will you prove the export is complete and restorable into a fresh dataset?
  • Which tokens exist today, and which will you rotate?
  • Will you work in a staging dataset first, rather than editing production?
  • What do I get in writing at the end?

A developer who wants to keep the project under their own account "for convenience" is repeating the exact problem you are fixing.

Getting help

This is work I do: recovering or consolidating Sanity ownership, rotating credentials, taking a verified backup, and checking the site still builds and publishes cleanly afterward. It usually fits inside my Performance and Sanity audit from $800, and if you need a developer on a longer engagement, the details are on the hire a Sanity developer page.

Frequently asked questions

What if the Sanity project owner is a developer who has left and won't reply?

Check whether you have admin access to the organization or the project in the Sanity management console. If the project sits under a personal account you can't reach, your options are to contact Sanity support with proof of business ownership, or to export what the live site can still reach and rebuild the project under your own organization.

Can I back up Sanity content without being a project admin?

Exporting a dataset needs a logged-in user with sufficient permissions on the project, so a read-only role is usually not enough. If you only have a viewer-level role, ask an admin to upgrade you first, or export through an API token that someone with access creates.

Should I rotate API tokens after taking over a Sanity project?

Yes. Any token the previous developer created may live in their laptop, a deploy dashboard or a chat log. Create new tokens, update your hosting environment variables, redeploy, then delete the old tokens.