|Delete a page.
This module cannot be used as a Generator.
To delete a page, a CSRF token is required. The CSRF token is the same for all pages, but changes at every login. CSRF tokens can be obtained via
type=csrf (MW 1.24+).
For older versions, you can use API:Tokens (action) or API:Info to get an edit token.
Pages can be deleted with action=delete.
In addition to the
delete right, other rights may be required, depending on the location and type of page.
Deleting a user's
.css page, for example, also requires the
pageid must be set.
title: The page you want to delete.
pageid: The page id of the page you want to delete. 1.14+
token: The CSRF token obtained as per the Tokens section, above. Take care to urlencode the trailing
reason: The reason for the deletion (optional). If not provided, an automatically generated reason will be used.
tags: Change tags to apply to the entry in the deletion log. 1.27+
watch: Add the page to your watchlist. 1.13+ (Deprecated in 1.17)
unwatch: Remove the page from your watchlist. 1.13+ (Deprecated in 1.17)
watchlist: Add the page to your watchlist. Possible values:
oldimage: The name of the old image to delete as provided by
action=deleterequires POST requests; GET requests will cause an error.
Deleting the Main Page with an auto-generated reason
In addition to the usual stuff:
|notitle||The title parameter must be set|
|notoken||The token parameter must be set|
|permissiondenied|| You don't have permission to delete pages|
Note: On most wikis, deleting pages is restricted to sysops, but other wikis may have stricter rules.
|cantdelete||Couldn't delete "title". Maybe it was deleted already by someone else|
|The following documentation is the output of Special:ApiHelp/delete, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org).|
- This module requires read rights.
- This module requires write rights.
- This module only accepts POST requests.
- Source: MediaWiki
- License: GPL-2.0+
Delete a page.
Title of the page to delete. Cannot be used together with pageid.
Page ID of the page to delete. Cannot be used together with title.
- Type: integer
Reason for the deletion. If not set, an automatically generated reason will be used.
Change tags to apply to the entry in the deletion log.
- Values (separate with | or alternative):
Add the page to the current user's watchlist.
- Type: boolean (details)
Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.
- One of the following values: watch, unwatch, preferences, nochange
- Default: preferences
Remove the page from the current user's watchlist.
- Type: boolean (details)
The name of the old image to delete as provided by action=query&prop=imageinfo&iiprop=archivename.
A "csrf" token retrieved from action=query&meta=tokens
- This parameter is required.
- Delete Main Page.
- api.php?action=delete&title=Main%20Page&token=123ABC [open in sandbox]
- Delete Main Page with the reason Preparing for move.
- api.php?action=delete&title=Main%20Page&token=123ABC&reason=Preparing%20for%20move [open in sandbox]