Assign roles to user

POST /api/users/{userId}/roles

Assign API resource roles to the user. The roles will be added to the existing roles.

Path parameters

  • userId string Required

    The unique identifier of the user.

application/json

Body Required

  • roleIds array[string] Required

    An array of API resource role IDs to assign.

    Minimum length of each is 1.

Responses

  • 201 application/json

    The API resource roles has been assigned to the user.

  • Bad Request

  • Unauthorized

  • Forbidden

  • Not Found

  • Unprocessable Content

POST /api/users/{userId}/roles
curl \
 -X POST https://[tenant_id].logto.app/api/users/{userId}/roles \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"roleIds":["string"]}'
Request examples
{
  "roleIds": [
    "string"
  ]
}