Skip to main content

Delete a user

DELETE 

/user/users/:userId

Delete a Moodle account through the normal account-deletion lifecycle, including enrolment and role cleanup, session invalidation, event emission and authentication-plugin notification. This does not completely erase personal data.

Required OAuth scopes​

Satisfy one set:

  • all of:
    • core_user:user:delete

All callers also need the system-level moodle/user:delete capability.

Restrictions​

  • Guest accounts, site administrators and your own account cannot be deleted (403).
  • Missing or already-deleted users return 404.

Concurrency and result​

If-Match is optional and uses the ETag from GET /user/users/{userId}. A mismatch returns 412 without deletion; without If-Match, deletion is unconditional.

Success returns 204 with no body. Repeating the request may return 404; the account remains deleted.

Request​

Responses​

The user account was deleted. No response body.