Skip to main content

Assign role

You can assign roles to already existing users with the endpoint.

HTTP request

POST https://$instanceId.id.nevis.cloud/nevis/api/v1/users/$userId/authorizations

Parameters

ParameterInTypeRequired / OptionalDescription
instanceIdpathstringrequiredThe ID of your Identity Cloud instance.
userIdpathstringrequiredThe ID of the user.

Request body

A role can only be assigned if a roleId is provided.

ParameterTypeRequired / OptionalDescription
roleIdstringRequiredThe ID of the already existing role.

Example request

userId=948ce1fd-9fb4-4ae2-a9d2-70e229b121ed
roleId=a229a329-2e28-4005-9760-16cd280d6f0d
curl --request POST "https://$instanceId.id.nevis.cloud/nevis/api/v1/users/$userId/authorizations" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $accessKey" \
--data "{ \"roleId\" : \"$roleId\" }"

HTTP response

On success

HTTP/1.1 201 is returned if the role is successfully assigned to the user.

The response has the following additional header Location, which contains the authorizationId of the assigned role:

https://$instanceId.id.nevis.cloud/nevis/api/v1/users/${userId}/authorizations/${authorizationId}

The authorizationId is a generated UUID.

On failure

HTTP/1.1 401 is returned if the authorization fails due to an invalid access key.

HTTP/1.1 404 is returned if the user is not found.

HTTP/1.1 422 is returned if invalid request content is given.

HTTP/1.1 500 is returned if an unexpected error occurs.