Assign roles to a user in an organization

POST /api/organizations/{id}/users/{userId}/roles

Assign roles to a user in the specified organization with the provided data.

Path parameters

  • id string Required

    The unique identifier of the organization.

  • userId string Required

    The unique identifier of the user.

application/json

Body Required

  • organizationRoleIds array[string] Required

    An array of organization role IDs to assign to the user. User existed roles assignment will be ignored.

    Minimum length of each is 1.

Responses

  • 201

    Roles were assigned to the user successfully.

  • 400

    Bad Request

  • 401

    Unauthorized

  • 403

    Forbidden

  • 422

    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.

POST /api/organizations/{id}/users/{userId}/roles
curl \
 -X POST https://[tenant_id].logto.app/api/organizations/{id}/users/{userId}/roles \
 -H "Content-Type: application/json" \
 -d '{"organizationRoleIds":["string"]}'
Request example
{
  "organizationRoleIds": [
    "string"
  ]
}