Skip to main content

Generate a temporary password

POST 

/user/users/:userId/password-reset

Generate a temporary password by submitting to the user's password-reset resource. The existing password changes immediately, and a password change is required at next login. No password or recovery token is returned.

Required OAuth scopes​

Satisfy one set:

  • all of:
    • core_user:user:update

All callers also need the system-level moodle/user:update capability. update:self alone is insufficient. Guest or deleted accounts and authentication mechanisms without supported password management are rejected. Only site administrators may reset another administrator's credentials.

Delivery and result​

Email the new password after successful credential replacement unless sendPasswordEmail is false. A delivery failure is logged and reported as failed; it does not undo the reset. If email is suppressed, arrange access separately. Use Moodle's password lifecycle and session-invalidation policy.

Return 200 with the immediate, non-secret outcome. No individually addressable reset record, result GET, retention period or Location header is introduced.

Retries​

Each accepted POST replaces the password again. Do not repeat POST to retry email delivery or resolve an uncertain result. This operation offers no duplicate-request protection. For a public reset link instead, use POST /user/password-reset.

Request​

Responses​

Password replaced. The immediate outcome reports email failure separately; it does not undo the reset. No reset record or result URL is created.

Response Headers
    Cache-Control

    Prevent storage of password-management and recovery responses.