MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/API

action=userrights

(main | userrights)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: MediaWiki
  • License: GPL-2.0+

Change a user's group membership.

Parameters:
user

User name.

Type: user name
userid

User ID.

Type: integer
add

Add the user to these groups.

Values (separate with | or alternative): bot, sysop, bureaucrat, editor, reviewer, autoreview, TeamLeaders, ns000_edit_g, ns000_appr_g, ns000_admin_g, ns102_edit_g, ns102_appr_g, ns102_admin_g, ns122_edit_g, ns122_appr_g, ns122_admin_g, ns106_edit_g, ns106_appr_g, ns106_admin_g, ns112_read_g, ns112_edit_g, ns112_appr_g, ns112_admin_g, ns114_read_g, ns114_edit_g, ns114_appr_g, ns114_admin_g, ns120_read_g, ns120_edit_g, ns120_appr_g, ns120_admin_g, ns110_read_g, ns110_edit_g, ns110_appr_g, ns110_admin_g, ns108_read_g, ns108_edit_g, ns108_appr_g, ns108_admin_g, ns116_edit_g, ns116_appr_g, ns116_admin_g, translator
remove

Remove the user from these groups.

Values (separate with | or alternative): bot, sysop, bureaucrat, editor, reviewer, autoreview, TeamLeaders, ns000_edit_g, ns000_appr_g, ns000_admin_g, ns102_edit_g, ns102_appr_g, ns102_admin_g, ns122_edit_g, ns122_appr_g, ns122_admin_g, ns106_edit_g, ns106_appr_g, ns106_admin_g, ns112_read_g, ns112_edit_g, ns112_appr_g, ns112_admin_g, ns114_read_g, ns114_edit_g, ns114_appr_g, ns114_admin_g, ns120_read_g, ns120_edit_g, ns120_appr_g, ns120_admin_g, ns110_read_g, ns110_edit_g, ns110_appr_g, ns110_admin_g, ns108_read_g, ns108_edit_g, ns108_appr_g, ns108_admin_g, ns116_edit_g, ns116_appr_g, ns116_admin_g, translator
reason

Reason for the change.

Default: (empty)
token

A "userrights" token retrieved from action=query&meta=tokens

For compatibility, the token used in the web UI is also accepted.

This parameter is required.
Examples:
Add user FooBot to group bot, and remove from groups sysop and bureaucrat.
api.php?action=userrights&user=FooBot&add=bot&remove=sysop|bureaucrat&token=123ABC [open in sandbox]
Add the user with ID 123 to group bot, and remove from groups sysop and bureaucrat.
api.php?action=userrights&userid=123&add=bot&remove=sysop|bureaucrat&token=123ABC [open in sandbox]