API:Undelete

Token
You need to obtain an undelete token through list=deletedrevs before you can restore any revisions. This token is equal to the edit token and the same for all pages, but changes at every login.

Restoring deleted revisions
Deleted revisions can be restored with action=undelete.

Parameters

 * title: The page you want to undelete.
 * token: The token obtained in the previous request. Take care to urlencode the '+' as '%2B'.
 * reason: The reason for the undeletion (optional).
 * timestamps: A pipe-separated list of timestamps of the revisions to restore (optional). By default, all revisions will be restored.
 * You can get these timestamps through list=deletedrevs.

Possible errors
All errors are formatted as:


 * 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 restore deleted revisions
 * On most wikis, restoring deleted revisions is restricted to sysops, but other wikis may have stricter rules.
 * code: blocked
 * info: You have been blocked from editing
 * code: readonly
 * info: The wiki is in read-only mode
 * In read-only mode, absolutely nothing can be changed.
 * code: badtoken
 * info: Invalid token
 * code: invalidtitle
 * info: Bad title ``title ''
 * This means title contains invalid characters or is blank. Note that titles like Talk: and User: are also considered blank.
 * code: norevs
 * info: No revisions could be restored
 * This means the page you're trying to restore has no deleted revisions.
 * code: revsnotfound
 * info: Not all requested revisions could be found
 * This means one of the timestamps you specified doesn't have a matching deleted revision.
 * code: unknownerror
 * info: Undeletion failed with unknown error
 * This usually means some very rare coincidence occurred. Try the same request again, and you'll get a sensible error message.