Assign roles to a user in an organization
Assign roles to a user in the specified organization with the provided data.
Body
Required
-
organizationRoleIds
array[string] An array of organization role IDs to assign to the user. User existed roles assignment will be ignored.
Minimum length of each is
1
. -
organizationRoleNames
array[string] An array of organization role names to assign to the user. User existed roles assignment will be ignored.
Minimum length of each is
1
.
Responses
-
201 application/json
Roles were assigned to the user successfully.
-
Bad Request
-
Unauthorized
-
Forbidden
-
The user is not a member of the organization; or at least one of the IDs provided is not valid. For example, the organization ID or organization role ID does not exist; or at least one of the role names provided is not valid. For example, the organization role name does not exist.
POST
/api/organizations/{id}/users/{userId}/roles
curl \
--request POST 'https://[tenant_id].logto.app/api/organizations/{id}/users/{userId}/roles' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{"organizationRoleIds":["string"],"organizationRoleNames":["string"]}'
Request examples
{
"organizationRoleIds": [
"string"
],
"organizationRoleNames": [
"string"
]
}