Skip to main content

Endpoint

PUT /recipe/user/role
This is a tenant-specific API that assigns an existing role to a user.

Request Body

userId
string
required
The ID of the user to assign the role to.
role
string
required
The name of the role to assign. The role must already exist. Cannot be empty or whitespace only.

Request Example

curl -X PUT https://your-api-domain.com/recipe/user/role \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "user123",
    "role": "admin"
  }'

Response

Success Response

status
string
Returns "OK" when the role is successfully assigned
didUserAlreadyHaveRole
boolean
  • true if the user already had this role
  • false if the role was newly assigned
{
  "status": "OK",
  "didUserAlreadyHaveRole": false
}

Error Response

status
string
Returns "UNKNOWN_ROLE_ERROR" when the specified role does not exist
{
  "status": "UNKNOWN_ROLE_ERROR"
}

Implementation Details

Source: View source
  • Role names are trimmed of leading/trailing whitespace before processing
  • The role must be created first using the Create Role endpoint
  • Role assignments are scoped to the tenant in which they are created
  • Assigning a role that a user already has is not an error - the API will return successfully with didUserAlreadyHaveRole: true

Error Responses

error
BadRequestException
Returned when the role field is empty or whitespace only

Role Management Overview

See all role management endpoints

Build docs developers (and LLMs) love