API:Delete

Token
To delete a page, a delete token is required. This token is equal to the edit token and the same for all pages, but changes at every login. Delete tokens can be obtained via action=tokens with type=delete (MW 1.20+), or by using the following method:

Deleting pages
Pages can be deleted with action=delete.

Parameters

 * title: The page you want to delete.
 * pageid: The page id of the page you want to delete
 * token: The token obtained in the previous request. Take care to urlencode the trailing  as.
 * reason: The reason for the deletion (optional). If not provided, an automatically generated reason will be used.
 * watch: Add the page to your watchlist
 * unwatch: Remove the page from your watchlist
 * oldimage: The name of the old image to delete as provided by iiprop=archivename

Example
Note: In this example, all parameters are passed in a GET request just for the sake of simplicity. However, action=delete requires POST requests; GET requests will cause an error.

Possible errors
In addition to the usual stuff:


 * code: notitle
 * info: The title parameter must be set
 * code: notoken
 * info: The token parameter must be set
 * code: permissiondenied
 * info: You don't have permission to delete pages
 * On most wikis, deleting pages is restricted to sysops, but other wikis may have stricter rules.
 * code: cantdelete
 * info: Couldn't delete ``title '' . Maybe it was deleted already by someone else