MediaWiki API help
This is an auto-generated MediaWiki API documentation page.
Documentation and examples: https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page
action=block
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: MediaWiki
- License: GPL-2.0-or-later
Block a user.
- user
User to block.
- Type: user, by any of user name, IP, IP range and user ID (e.g. "#12345")
- userid
- Deprecated.
Specify user=#ID instead.
- Type: integer
- expiry
Expiry time. May be relative (e.g. 5 months or 2 weeks) or absolute (e.g. 2014-09-18T12:34:56Z). If set to infinite, indefinite, or never, the block will never expire.
- Default: never
- reason
Reason for block.
- Default: (empty)
- anononly
Block anonymous users only (i.e. disable anonymous edits for this IP address).
- Type: boolean (details)
- nocreate
Prevent account creation.
- Type: boolean (details)
- autoblock
Automatically block the last used IP address, and any subsequent IP addresses they try to login from.
- Type: boolean (details)
- noemail
Prevent user from sending email through the wiki. (Requires the
blockemail
right).- Type: boolean (details)
- hidename
Hide the username from the block log. (Requires the
hideuser
right).- Type: boolean (details)
- allowusertalk
Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit).
- Type: boolean (details)
- reblock
If the user is already blocked, overwrite the existing block.
- Type: boolean (details)
- watchuser
Watch the user's or IP address's user and talk pages.
- Type: boolean (details)
- tags
Change tags to apply to the entry in the block log.
- Values (separate with | or alternative):
- partial
Block user from specific pages or namespaces rather than the entire site.
- Type: boolean (details)
- pagerestrictions
List of titles to block the user from editing. Only applies when partial is set to true.
- Separate values with | or alternative.
- Maximum number of values is 10.
- namespacerestrictions
List of namespace IDs to block the user from editing. Only applies when partial is set to true.
- Values (separate with | or alternative): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 102, 103, 106, 107, 108, 109, 112, 113, 114, 115, 274, 275, 420, 421, 828, 829, 2300, 2301, 2302, 2303, 3296, 3297, 3300, 3301, 3302, 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3330, 3331, 3332, 3333, 3334, 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3365, 3366, 3367, 3368, 3369, 3370, 3371, 3372, 3373
- Maximum number of values is 50 (500 for clients that are allowed higher limits).
- To specify all values, use *.
- token
A "csrf" token retrieved from action=query&meta=tokens
- This parameter is required.
- Block IP address 192.0.2.5 for three days with a reason.
- api.php?action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC [open in sandbox]
- Block user Vandal indefinitely with a reason, and prevent new account creation and email sending.
- api.php?action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC [open in sandbox]