How to invite users to a Sanity project via API?

2 repliesLast updated: Nov 30, 2025

I love the API that’s provided for projects — I have script that spins up a new install for each new project we make. One thing I’d love to have, though, would be an endpoint to be able to invite users to a project. It would save a time from having to go in and manually invite all the members of my team after. I spent a few minutes playing with the API today and it sorta seems like this already exists? but it isn’t documented here (https://www.sanity.io/docs/projects-api ) — if it does exist and someone can tell me how to do it, or tell me it doesn’t exist and I shouldn’t keep trying, would love to hear. Thanks!
AI Update

Good news! Yes, the Access API does have an endpoint to create invites, even though it might not have been clearly documented in the Projects API page you were looking at.

According to the Access API documentation, you can create invites using:

POST /v2025-07-11/access/{resourceType}/{resourceId}/invites

For inviting users to a project, you'd use:

POST https://api.sanity.io/v2025-07-11/access/project/{projectId}/invites

The request body should include:

Here's what a typical request might look like:

const response = await fetch(
  `https://api.sanity.io/v2025-07-11/access/project/${projectId}/invites`,
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'teammate@example.com',
      roleNames: ['editor']
    })
  }
);

Required permission: You'll need sanity.project.members.update permission to create invites.

The Access API also has related endpoints for managing invites:

So you were right that this functionality exists! It's just under the Access API rather than the Projects API. This should save you a ton of time automating your team onboarding process. You can loop through your team members and fire off invite requests right after spinning up each new project.

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions