Contents

Rolling back a page means undoing the last series of edits by one user.
In other words, rollback keeps undoing revision after revision until it encounters one made by someone different.
This functionality is identical to the one provided by the [rollback] links in the graphical interface.
The rollback revision will be marked as minor.
Optionally, both the rollback and the edits being rolled back can be marked as bot, which hides them from Special:RecentChanges by default.

To rollback a page, a rollback token is required.
If your wiki is using MediaWiki 1.24+, you can use action=query&meta=tokens&type=rollback to get a rollback token.

For MediaWiki 1.23 or earlier, follow these instructions:

Unlike most other tokens, rollback tokens aren't universal: they're not only different for every login, but also depend on the title of the page and the name of the user whose edits are to be rolled back.
A rollback token can be obtained as follows:

token: The token obtained in either a Tokens request with type=rollback or for wiki versions prior to 1.24, a Revisions request with rvtoken=rollback. In the latter case, please note that the token is specific to the page and user who made the revision. In either case, make sure to urlencode the token.

<?xml version="1.0" encoding="utf-8"?><api><rollbacktitle="Main Page"pageid="5"summary="Reverted edits by [[Special:Contributions/Username|Username]] ([[User talk:Username|Talk]]); changed back to last version by [[User:PreviousEditor|PreviousEditor]]"revid="28"old_revid="27"last_revid="20"/></api>