Update a user
PATCH/user/users/:userId
Update the supplied account and standard profile fields. Omitted fields remain unchanged. Support for Custom profile fields will be added in a later revision.
Required OAuth scopes
Satisfy one set:
- all of:
- core_user:user:update:self
- all of:
- core_user:user:update
Moodle capabilities also apply. The self scope grants no administrative permission.
Field rules
- Email, suspension and administrative changes to
username,idnumber,authenticationMethodorconfirmedrequire applicable account-edit capabilities, includingmoodle/user:update, even when updating yourself. - Suspending an account invalidates its active sessions.
- Field-level and self-edit permissions, validation, and source/target authentication-plugin locks apply. Changing
authenticationMethodcannot provision an external identity or implicitly set or reset a password. - Use
languagefor the stored language preference andtimeZonePreferencefor a supported IANA timezone ornullfor the server default. The effectivetimeZoneis read-only, including under forced site policy; the internal99sentinel is not accepted. id,fullNameand picture URLs are read-only;deletedis excluded from inputs. Clear optional text with an empty string;nullis otherwise rejected.
Concurrency
If-Match is optional and uses the same caller-visible representation as GET. A stale ETag returns 412; without If-Match, the update is unconditional.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
- 412
- 422
OK
Response Headers
The entity-tag of this representation. Preserve the double quotes when sending it in an If-Match or If-None-Match request header.
"0123456789abcdef0123456789abcdef01234567"Bad Request
Authentication is required.
The caller lacks the required token scope or Moodle capability, or the operation targets a protected account, an authentication-plugin-locked field or another non-editable field.
Not Found
A username, email (where site policy requires unique addresses) or custom field violates a uniqueness rule. No creation or update is committed.
Precondition Failed
Well-formed input failed field validation: missing required, unknown or read-only fields, invalid values, policy failures or incompatible options. Permission or locked-field failures use 403; uniqueness conflicts use 409. Public recovery errors describe input only, never account existence, eligibility or delivery outcomes. Passwords and recovery tokens must not appear in errors.