younifyd
Menu

Update Role

Update a role

PUT/projects/{projectId}/roles/{roleName}

Use it in a workflow

  1. Add a step and choose the Sanity connector.
  2. Pick the Update Role action (under Roles).
  3. Fill in the fields below, then reference the result from later steps as {{updateRole.response.data}}.

Request

Path parameters

projectIdstringrequired

The ID of the project

roleNamestringrequired

The name of the role

Request body

Enter the body as JSON in the step's Body field.

titlestring

The title of the role

descriptionstring

The description of the role

appliesToUsersboolean

Whether the role applies to users. You can't set it to `false` while users have the role.

appliesToRobotsboolean

Whether the role applies to robots. You can't set it to `false` while robots have the role.

json
{
  "title": "Translator",
  "description": "Edit translated documents",
  "appliesToUsers": true,
  "appliesToRobots": false
}

Response

Returns 200 with an object. Read it in later steps with {{updateRole.response.data.<field>}}.

namestring

The role name

titlestring

The role title

descriptionstring

A description of the role's permissions. An empty string if the role has no description.

isCustomboolean

Whether this is a custom role

projectIdstring

The ID of the project this role belongs to

appliesToUsersboolean

Whether the role can be given to users

appliesToRobotsboolean

Whether the role can be given to robots

grantsobject

Grants grouped by permission resource schema name, such as `sanity.project` or `sanity.document.filter.mode`.

json
{
  "name": "administrator",
  "title": "Administrator",
  "description": "Read and write access to all datasets, with full access to all project settings.",
  "isCustom": false,
  "projectId": "3do82whm",
  "appliesToUsers": true,
  "appliesToRobots": false,
  "grants": {}
}

Need more? See the Sanity guide for connection setup and behaviour shared by every action.

Update Role — Sanity — Documentation