Skip to content

Update Role

Update an existing role’s code, name, description, and permission assignments.

Endpoint

/api/v1/projects/{project_id}/roles/{role_id}

Method

PUT

Path Parameters

ParameterTypeRequiredDescription
project_idstringYesUnique ID of the project
role_idstringYesUnique ID of the role

Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
AuthorizationYesBearer access token: Bearer <access_token>

Request Body

FieldTypeRequiredDescription
codestringYesRole code (alphanumeric, dash, underscore, max 50 chars)
namestringYesRole name (max 50 chars)
descriptionstringNoDescription (max 200 chars)
permission_idsarray of stringsNoList of permission IDs to assign to role

Required Permission

roles:update

Examples

curl --request PUT \
  --url https://auth.roled.id/api/v1/projects/2JUSLUee46xG6iEwG8JwPc/roles/2JRtjyxfZudzaJkFczgoUY \
  --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJo...' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Store Manager Updated",
    "code": "store-manager-updated",
    "description": "Manages store operations including products, orders, and staff with enhanced permissions",
    "permission_ids": [
      "2JUUyotLUqz5eqsuYXXDet",
      "2JUUyotLUr7SuBqkzjRbTc",
      "2JUUyotLUrApxL7zcx7Xoy",
      "2JUUyotLUrDfBK9iwe25jj",
      "2JRjbZKS7f4oRkDaAD4gAF",
      "2JRjbZKS7fJAfNjgShH3TE",
      "2JRjbZKS7h72qSpPAJBuSj",
      "2JRjbZKS7hJfHq9yRzVqhV",
      "2JRjbZKS7feihqSQx5D8yf"
    ]
  }'

Error Codes

CodeHTTP StatusDescription
invalid_params400Missing or invalid request params, headers, or body
invalid_authorization_token401Missing or invalid authorization token
insufficient_permission403Insufficient permission
project_not_found404Project not found
role_not_found404Role not found
some_permissions_not_found404One or more specified permission IDs not found
role_code_already_used409Role with the same code already exists
system_error500Internal server error