Delete grants from role and delete custom roles in Sanity permissions

11 replies
Last updated: Nov 30, 2025
Hi, with the new Role/permissions system is it possible to:• Delete an existing grant from a role (maybe a
DELETE
request to the
/grants
endpoint?) • Delete an existing role? Not
deleting a user role , but deleting the role itself so that it doesn't show up when you fetch the list of roles through the
/roles
endpoint.
AI Update

Based on the documentation I've reviewed, here's what you can do with the new Roles/permissions system:

Deleting Grants

Yes, you can manage grants! While the documentation doesn't explicitly show a standalone DELETE request to a /grants endpoint in the format you mentioned, grants are now managed through role permissions in the new Access API.

In the new Access API (v2025-07-11), grants are part of role permissions. To remove a grant from a role, you would:

  1. Update the role using PATCH /v2025-07-11/access/{resourceType}/{resourceId}/roles/{roleName} and modify the permissions array to exclude the grant you want to remove
  2. Or delete the entire role (see below) if that's what you need

The old /grants endpoint pattern you're referencing was part of the v2021-06-07 API. The new API has restructured this into the role-based endpoints where permissions (which include what were previously called "grants") are managed as part of roles.

Deleting Roles

Yes, you can delete custom roles! Use this endpoint:

DELETE /v2025-07-11/access/{resourceType}/{resourceId}/roles/{roleName}

This requires:

  • Permission: sanity.{resourceType}.roles.delete
  • Feature: advancedRolesManagement (Enterprise feature)

Important notes:

  • You can only delete custom roles (where isCustom: true)
  • Pre-defined roles (administrator, editor, viewer, etc.) cannot be deleted, but on Enterprise plans with advanced roles management enabled, they can be removed from appearing in the resource
  • Once deleted, the role won't show up when you fetch the /roles endpoint

The Access API documentation shows all available endpoints. The new API (v2025-07-11) has significantly restructured how roles and permissions work compared to the older v2021-06-07 API, consolidating grants, resources, and permission resource schemas into a simpler "permissions" concept that's managed within roles.

Show original thread
11 replies

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.

Was this answer helpful?