update_user_role_user
Update an existing LearnWorlds user's role by providing the new role_id and optional assignments. Adjust permissions or responsibilities without deleting and recreating the user.
Instructions
🟡 WRITE · updates data · PUT /v2/users/{id}/user-role
Updates the role assigned to the user.
Behavior: replaces the fields you send on an existing record in the live school. Idempotent: repeating it leaves the same state. Auth (admin API token + Lw-Client id) is injected server-side, never by the model; calls are throttled to stay under LearnWorlds' 30-per-10s cap and retried on 429/5xx.
Parameters: the whole JSON payload goes in the single body argument, forwarded verbatim (the spec leaves body optional, but this endpoint expects one).
Returns: HTTP <status> followed by the LearnWorlds JSON response body. A non-2xx reply surfaces as a tool error with that status and the API error payload — 401 bad/expired token, 403 not permitted, 404 no such record, 422 rejected input.
Use when: only when the user asked to change an existing record. Read it first so you overwrite just the fields you mean to; use the create tool if it does not exist yet. Related Users tools: get_user_role_user, enroll_user_product, get_courses_enrollments_user, get_products_user, get_seat_offerings_that_user_is_member.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User Id or email | |
| body | No | Required fields change depending of role_id. If role_id is instructor, then assigned courses must be filled. |