Menu
Add Role To User
Add a role to a user.
PUT
/v2025-07-11/access/{resourceType}/{resourceId}/users/{sanityUserId}/roles/{roleName}Use it in a workflow
- Add a step and choose the Sanity connector.
- Pick the Add Role To User action (under Access).
- Fill in the fields below, then reference the result from later steps as
{{addRoleToUser.response.data}}.
Request
Path parameters
Response
Returns 201 with an object. Read it in later steps with {{addRoleToUser.response.data.<field>}}.
{
"sanityUserId": "gDdcnv42e",
"profile": {
"id": "string",
"displayName": "string",
"email": "string",
"provider": "string",
"createdAt": "2025-01-01T00:00:00Z",
"familyName": "string",
"givenName": "string",
"middleName": "string",
"imageUrl": "string",
"tosAcceptedAt": "2025-01-01T00:00:00Z",
"updatedAt": "2025-01-01T00:00:00Z",
"isCurrentUser": false
},
"memberships": [
{
"resourceType": "project",
"resourceId": "c7ja4siy",
"roleNames": [
"administrator",
"editor"
],
"addedAt": "2024-01-15T12:15:30Z",
"lastSeenAt": "2024-01-15T12:15:30Z",
"resourceUserId": "projectUserId123"
}
]
}
Need more? See the Sanity guide for connection setup and behaviour shared by every action.
Was this page helpful?