MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: https://www.mediawiki.org/wiki/API

Main module

Status: All features shown on this page should be working, but the API is still in active development, and may change at any time. Subscribe to the mediawiki-api-announce mailing list for notice of updates.

Erroneous requests: When erroneous requests are sent to the API, an HTTP header will be sent with the key "MediaWiki-API-Error" and then both the value of the header and the error code sent back will be set to the same value. For more information see API: Errors and warnings.

Parameters:
action

Which action to perform.

One value: block, cargoquery, cargorecreatedata, cargorecreatetables, checktoken, clearhasmsg, compare, createaccount, delete, edit, emailuser, expandtemplates, feedcontributions, feedrecentchanges, feedwatchlist, filerevert, help, imagerotate, import, login, logout, managetags, move, opensearch, options, paraminfo, parse, patrol, protect, purge, query, revisiondelete, rollback, rsd, setnotificationtimestamp, sfautocomplete, sfautoedit, stashedit, tag, tokens, unblock, undelete, upload, userrights, watch
Default: help
format

The format of the output.

One value: dbg, dbgfm, dump, dumpfm, json, jsonfm, none, php, phpfm, rawfm, txt, txtfm, wddx, wddxfm, xml, xmlfm, yaml, yamlfm
Default: jsonfm
maxlag

Maximum lag can be used when MediaWiki is installed on a database replicated cluster. To save actions causing any more site replication lag, this parameter can make the client wait until the replication lag is less than the specified value. In case of excessive lag, error code maxlag is returned with a message like Waiting for $host: $lag seconds lagged.
See Manual: Maxlag parameter for more information.

smaxage

Set the s-maxage header to this many seconds. Errors are never cached.

Default: 0
maxage

Set the max-age header to this many seconds. Errors are never cached.

Default: 0
assert

Verify the user is logged in if set to user, or has the bot userright if bot.

One value: user, bot
requestid

Any value given here will be included in the response. May be used to distinguish requests.

servedby

Include the hostname that served the request in the results.

curtimestamp

Include the current timestamp in the result.

origin

When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body). This must match one of the origins in the Origin header exactly, so it has to be set to something like https://en.wikipedia.org or https://meta.wikimedia.org. If this parameter does not match the Origin header, a 403 response will be returned. If this parameter matches the Origin header and the origin is whitelisted, an Access-Control-Allow-Origin header will be set.

uselang

Language to use for message translations. A list of codes may be fetched from action=query&meta=siteinfo with siprop=languages, or specify user to use the current user's language preference, or specify content to use this wiki's content language.

Default: user
Examples:
Help for the main module.
api.php?action=help
All help in one page.
api.php?action=help&recursivesubmodules=1
Permissions:
writeapi
Use of the write API
Granted to: all, user, bot
apihighlimits
Use higher limits in API queries (slow queries: 500; fast queries: 5000). The limits for slow queries also apply to multivalue parameters.
Granted to: bot, sysop

action=block

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Block a user.

Parameters:
user

Username, IP address, or IP range to block.

This parameter is required.
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).

nocreate

Prevent account creation.

autoblock

Automatically block the last used IP address, and any subsequent IP addresses they try to login from.

noemail

Prevent user from sending email through the wiki. (Requires the blockemail right).

hidename

Hide the username from the block log. (Requires the hideuser right).

allowusertalk

Allow the user to edit their own talk page (depends on $wgBlockAllowsUTEdit).

reblock

If the user is already blocked, overwrite the existing block.

watchuser

Watch the user's or IP address's user and talk pages.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Examples:
Block IP address 192.0.2.5 for three days with reason First strike.
api.php?action=block&user=192.0.2.5&expiry=3%20days&reason=First%20strike&token=123ABC
Block user Vandal indefinitely with reason Vandalism, and prevent new account creation and email sending.
api.php?action=block&user=Vandal&expiry=never&reason=Vandalism&nocreate=&autoblock=&noemail=&token=123ABC

action=cargoquery

  • This module requires read rights.

An SQL-style query used for data tables, provided by the Cargo extension (http://www.mediawiki.org/Extension:Cargo)

Parameters:
limit

Limit how many entries to return

No more than 500 (5,000 for bots) allowed.
Default: 50
tables

The Cargo database table or tables on which to search

fields

The table field(s) to retrieve

where

The conditions for the query, corresponding to an SQL WHERE clause

join_on

Conditions for joining multiple tables, corresponding to an SQL JOIN ON clause

group_by

Field(s) on which to group results, corresponding to an SQL GROUP BY clause

having

Conditions for grouped values, corresponding to an SQL HAVING clause

order_by

The order of results, corresponding to an SQL ORDER BY clause

action=cargorecreatedata

  • This module requires read rights.

An API module to recreate data for the Cargo extension (http://www.mediawiki.org/Extension:Cargo)

Parameters:
template

The template whose data to use

table

The Cargo database table to repopulate

offset
(no description)
Default: 0
replaceOldRows

Whether to replace old rows for each page while repopulating the table

action=cargorecreatetables

  • This module requires read rights.

An API module to recreate tables for the Cargo extension (http://www.mediawiki.org/Extension:Cargo)

Parameter:
template

The template whose declared Cargo table(s) should be recreated

action=checktoken

  • This module requires read rights.

Check the validity of a token from action=query&meta=tokens.

Parameters:
type

Type of token being tested.

This parameter is required.
One value: csrf, patrol, rollback, userrights, watch
token

Token to test.

This parameter is required.
maxtokenage

Maximum allowed age of the token, in seconds.

Example:
Test the validity of a csrf token.
api.php?action=checktoken&type=csrf&token=123ABC

action=clearhasmsg

  • This module requires read rights.
  • This module requires write rights.

Clears the hasmsg flag for the current user.

Example:
Clear the hasmsg flag for the current user.
api.php?action=clearhasmsg

action=compare

  • This module requires read rights.

Get the difference between 2 pages.

A revision number, a page title, or a page ID for both "from" and "to" must be passed.

Parameters:
fromtitle

First title to compare.

fromid

First page ID to compare.

fromrev

First revision to compare.

totitle

Second title to compare.

toid

Second page ID to compare.

torev

Second revision to compare.

Example:
Create a diff between revision 1 and 2.
api.php?action=compare&fromrev=1&torev=2

action=createaccount

  • This module requires write rights.
  • This module only accepts POST requests.

Create a new user account.

Parameters:
name

Username.

This parameter is required.
password

Password (ignored if mailpassword is set).

domain

Domain for external authentication (optional).

token

Account creation token obtained in first request.

email

Email address of user (optional).

realname

Real name of user (optional).

mailpassword

If set to any value, a random password will be emailed to the user.

reason

Optional reason for creating the account to be put in the logs.

language

Language code to set as default for the user (optional, defaults to content language).

Examples:
Create user testuser with password test123.
api.php?action=createaccount&name=testuser&password=test123
Create user testmailuser and email a randomly-generated password.
api.php?action=createaccount&name=testmailuser&mailpassword=true&reason=MyReason

action=delete

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Delete a page.

Parameters:
title

Title of the page to delete. Cannot be used together with pageid.

pageid

Page ID of the page to delete. Cannot be used together with title.

reason

Reason for the deletion. If not set, an automatically generated reason will be used.

watch
Deprecated.

Add the page to the current user's watchlist.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
unwatch
Deprecated.

Remove the page from the current user's watchlist.

oldimage

The name of the old image to delete as provided by action=query&prop=imageinfo&iiprop=archivename.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=edit

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Create and edit pages.

Parameters:
title

Title of the page to edit. Cannot be used together with pageid.

pageid

Page ID of the page to edit. Cannot be used together with title.

section

Section number. 0 for the top section, new for a new section.

sectiontitle

The title for a new section.

text

Page content.

summary

Edit summary. Also section title when section=new and sectiontitle is not set.

tags

Change tags to apply to the revision.

Values (separate with |):
minor

Minor edit.

notminor

Non-minor edit.

bot

Mark this edit as bot.

basetimestamp

Timestamp of the base revision, used to detect edit conflicts. May be obtained through action=query&prop=revisions&rvprop=timestamp.

starttimestamp

Timestamp when the editing process began, used to detect edit conflicts. An appropriate value may be obtained using curtimestamp when beginning the edit process (e.g. when loading the page content to edit).

recreate

Override any errors about the page having been deleted in the meantime.

createonly

Don't edit the page if it exists already.

nocreate

Throw an error if the page doesn't exist.

watch
Deprecated.

Add the page to the current user's watchlist.

unwatch
Deprecated.

Remove the page from the current user's watchlist.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
md5

The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated. If set, the edit won't be done unless the hash is correct.

prependtext

Add this text to the beginning of the page. Overrides text.

appendtext

Add this text to the end of the page. Overrides text.

Use section=new to append a new section, rather than this parameter.

undo

Undo this revision. Overrides text, prependtext and appendtext.

undoafter

Undo all revisions from undo to this one. If not set, just undo one revision.

redirect

Automatically resolve redirects.

contentformat

Content serialization format used for the input text.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
contentmodel

Content model of the new content.

One value: wikitext, javascript, json, css, text
token

A "csrf" token retrieved from action=query&meta=tokens

The token should always be sent as the last parameter, or at least after the text parameter.

This parameter is required.

action=emailuser

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Email a user.

Parameters:
target

User to send email to.

This parameter is required.
subject

Subject header.

text

Mail body.

This parameter is required.
ccme

Send a copy of this mail to me.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Example:
Send an email to the User WikiSysop with the text Content.
api.php?action=emailuser&target=WikiSysop&text=Content&token=123ABC

action=expandtemplates

  • This module requires read rights.

Expands all templates in wikitext.

Parameters:
title

Title of page.

Default: API
text

Wikitext to convert.

This parameter is required.
revid

Revision ID, for {{REVISIONID}} and similar variables.

prop

Which pieces of information to get:

wikitext
The expanded wikitext.
categories
Any categories present in the input that are not represented in the wikitext output.
properties
Page properties defined by expanded magic words in the wikitext.
volatile
Whether the output is volatile and should not be reused elsewhere within the page.
ttl
The maximum time after which caches of the result should be invalidated.
parsetree
The XML parse tree of the input.

Note that if no values are selected, the result will contain the wikitext, but the output will be in a deprecated format.

Values (separate with |): wikitext, categories, properties, volatile, ttl, parsetree
includecomments

Whether to include HTML comments in the output.

generatexml
Deprecated.

Generate XML parse tree (replaced by prop=parsetree).

Example:
Expand the wikitext {{Project:Sandbox}}.
api.php?action=expandtemplates&text={{Project:Sandbox}}

action=feedcontributions

  • This module requires read rights.

Returns a user contributions feed.

Parameters:
feedformat

The format of the feed.

One value: rss, atom
Default: rss
user

What users to get the contributions for.

This parameter is required.
namespace

Which namespace to filter the contributions by.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
year

From year (and earlier).

month

From month (and earlier).

tagfilter

Filter contributions that have these tags.

Values (separate with |):
Default: (empty)
deletedonly

Show only deleted contributions.

toponly

Only show edits that are latest revisions.

newonly

Only show edits that are page creations.

showsizediff

Show the size difference between revisions.

Example:
Return contributions for user Example.
api.php?action=feedcontributions&user=Example

action=feedrecentchanges

  • This module requires read rights.

Returns a recent changes feed.

Parameters:
feedformat

The format of the feed.

One value: rss, atom
Default: rss
namespace

Namespace to limit the results to.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
invert

All namespaces but the selected one.

associated

Include associated (talk or main) namespace.

days

Days to limit the results to.

The value must be no less than 1.
Default: 7
limit

Maximum number of results to return.

The value must be between 1 and 50.
Default: 50
from

Show changes since then.

hideminor

Hide minor changes.

hidebots

Hide changes made by bots.

hideanons

Hide changes made by anonymous users.

hideliu

Hide changes made by registered users.

hidepatrolled

Hide patrolled changes.

hidemyself

Hide changes made by the current user.

tagfilter

Filter by tag.

target

Show only changes on pages linked from this page.

showlinkedto

Show changes on pages linked to the selected page instead.

Examples:
Show recent changes.
api.php?action=feedrecentchanges
Show recent changes for 30 days.
api.php?action=feedrecentchanges&days=30

action=feedwatchlist

  • This module requires read rights.

Returns a watchlist feed.

Parameters:
feedformat

The format of the feed.

One value: rss, atom
Default: rss
hours

List pages modified within this many hours from now.

The value must be between 1 and 72.
Default: 24
linktosections

Link directly to changed sections if possible.

allrev

Include multiple revisions of the same page within given timeframe.

wlowner

Used along with token to access a different user's watchlist.

wltoken

A security token (available in the user's preferences) to allow access to another user's watchlist.

wlshow

Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set show=minor|!anon.

Values (separate with |): minor, !minor, bot, !bot, anon, !anon, patrolled, !patrolled, unread, !unread
wltype

Which types of changes to show:

edit
Regular page edits.
external
External changes.
new
Page creations.
log
Log entries.
Values (separate with |): edit, external, new, log
Default: edit|new|log
wlexcludeuser

Don't list changes by this user.

Examples:
Show the watchlist feed.
api.php?action=feedwatchlist
Show all changes to watched pages in the past 6 hours.
api.php?action=feedwatchlist&allrev=&hours=6

action=filerevert

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Revert a file to an old version.

Parameters:
filename

Target filename, without the File: prefix.

This parameter is required.
comment

Upload comment.

Default: (empty)
archivename

Archive name of the revision to revert to.

This parameter is required.
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=help

Display help for the specified modules.

Parameters:
modules

Modules to display help for (values of the action and format parameters, or main). Can specify submodules with a +.

Separate values with |. Maximum number of values is 50 (500 for bots).
Default: main
submodules

Include help for submodules of the named module.

recursivesubmodules

Include help for submodules recursively.

wrap

Wrap the output in a standard API response structure.

toc

Include a table of contents in the HTML output.

Examples:
Help for the main module.
api.php?action=help
All help in one page.
api.php?action=help&recursivesubmodules=1
Help for the help module itself.
api.php?action=help&modules=help
Help for two query submodules.
api.php?action=help&modules=query+info|query+categorymembers

action=imagerotate

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Rotate one or more images.

Parameters:
rotation

Degrees to rotate image clockwise.

This parameter is required.
One value: 90, 180, 270
continue

When more results are available, use this to continue.

titles

A list of titles to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
pageids

A list of page IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
revids

A list of revision IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
generator

Get the list of pages to work on by executing the specified query module.

Note: Generator parameter names must be prefixed with a "g", see examples.

One value: allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, backlinks, categories, categorymembers, deletedrevisions, duplicatefiles, embeddedin, exturlusage, fileusage, images, imageusage, iwbacklinks, langbacklinks, links, linkshere, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, templates, transcludedin, watchlist, watchlistraw
redirects

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

converttitles

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz, zh.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=import

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Import a page from another wiki, or an XML file.

Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when sending a file for the xml parameter.

Parameters:
summary

Import summary.

xml

Uploaded XML file.

Must be posted as a file upload using multipart/form-data.
interwikisource

For interwiki imports: wiki to import from.

One value:
interwikipage

For interwiki imports: page to import.

fullhistory

For interwiki imports: import the full history, not just the current version.

templates

For interwiki imports: import all included templates as well.

namespace

For interwiki imports: import to this namespace.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
rootpage

Import as subpage of this page.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=login (lg)

  • This module only accepts POST requests.

Log in and get authentication cookies.

In the event of a successful log-in, the needed cookies will be included in the HTTP response headers. In the event of a failed log-in, further attempts may be throttled to limit automated password guessing attacks.

Parameters:
lgname

User name.

lgpassword

Password.

lgdomain

Domain (optional).

lgtoken

Login token obtained in first request.

action=logout

Log out and clear session data.

Example:
Log the current user out.
api.php?action=logout

action=managetags

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Perform management tasks relating to change tags.

Parameters:
operation

Which operation to perform:

create
Create a new change tag for manual use.
delete
Remove a change tag from the database, including removing the tag from all revisions, recent change entries and log entries on which it is used.
activate
Activate a change tag, allowing users to apply it manually.
deactivate
Deactivate a change tag, preventing users from applying it manually.
This parameter is required.
One value: create, delete, activate, deactivate
tag

Tag to create, delete, activate or deactivate. For tag creation, the tag must not exist. For tag deletion, the tag must exist. For tag activation, the tag must exist and not be in use by an extension. For tag deactivation, the tag must be currently active and manually defined.

This parameter is required.
reason

An optional reason for creating, deleting, activating or deactivating the tag.

ignorewarnings

Whether to ignore any warnings that are issued during the operation.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Examples:
Create a tag named spam with the reason For use in edit patrolling
api.php?action=managetags&operation=create&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC
Delete the vandlaism tag with the reason Misspelt
api.php?action=managetags&operation=delete&tag=vandlaism&reason=Misspelt&token=123ABC
Activate a tag named spam with the reason For use in edit patrolling
api.php?action=managetags&operation=activate&tag=spam&reason=For+use+in+edit+patrolling&token=123ABC
Deactivate a tag named spam with the reason No longer required
api.php?action=managetags&operation=deactivate&tag=spam&reason=No+longer+required&token=123ABC

action=move

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Move a page.

Parameters:
from

Title of the page to rename. Cannot be used together with fromid.

fromid

Page ID of the page to rename. Cannot be used together with from.

to

Title to rename the page to.

This parameter is required.
reason

Reason for the rename.

Default: (empty)
movetalk

Rename the talk page, if it exists.

movesubpages

Rename subpages, if applicable.

noredirect

Don't create a redirect.

watch
Deprecated.

Add the page and the redirect to the current user's watchlist.

unwatch
Deprecated.

Remove the page and the redirect from the current user's watchlist.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
ignorewarnings

Ignore any warnings.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=opensearch

  • This module requires read rights.

Search the wiki using the OpenSearch protocol.

Parameters:
search

Search string.

limit

Maximum number of results to return.

No more than 100 (100 for bots) allowed.
Default: 10
namespace

Namespaces to search.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
suggest

Do nothing if $wgEnableOpenSearchSuggest is false.

redirects

How to handle redirects:

return
Return the redirect itself.
resolve
Return the target page. May return fewer than limit results.

For historical reasons, the default is "return" for format=json and "resolve" for other formats.

One value: return, resolve
format

The format of the output.

One value: json, jsonfm, xml, xmlfm
Default: json
warningsaserror

If warnings are raised with format=json, return an API error instead of ignoring them.

Example:
Find pages beginning with Te.
api.php?action=opensearch&search=Te

action=options

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Change preferences of the current user.

Only options which are registered in core or in one of installed extensions, or options with keys prefixed with "userjs-" (intended to be used by user scripts), can be set.

Parameters:
reset

Resets preferences to the site defaults.

resetkinds

List of types of options to reset when the reset option is set.

Values (separate with |): registered, registered-multiselect, registered-checkmatrix, userjs, special, unused, all
Default: all
change

List of changes, formatted name=value (e.g. skin=vector). Value cannot contain pipe characters. If no value is given (not even an equals sign), e.g., optionname|otheroption|..., the option will be reset to its default value.

Separate values with |. Maximum number of values is 50 (500 for bots).
optionname

A name of a option which should be set to the value given by optionvalue.

optionvalue

A value of the option specified by optionname, can contain pipe characters.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=paraminfo

Obtain information about API modules.

Parameters:
modules

List of module names (values of the action and format parameters, or main). Can specify submodules with a +.

Separate values with |. Maximum number of values is 50 (500 for bots).
helpformat

Format of help strings.

One value: html, wikitext, raw, none
Default: none
querymodules
Deprecated.

List of query module names (value of prop, meta or list parameter). Use modules=query+foo instead of querymodules=foo.

Values (separate with |): allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allmessages, allpages, allredirects, alltransclusions, allusers, backlinks, blocks, categories, categoryinfo, categorymembers, contributors, deletedrevisions, deletedrevs, duplicatefiles, embeddedin, extlinks, exturlusage, filearchive, filerepoinfo, fileusage, imageinfo, images, imageusage, info, iwbacklinks, iwlinks, langbacklinks, langlinks, links, linkshere, logevents, pagepropnames, pageprops, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, siteinfo, stashimageinfo, tags, templates, tokens, transcludedin, usercontribs, userinfo, users, watchlist, watchlistraw
Maximum number of values is 50 (500 for bots).
mainmodule
Deprecated.

Get information about the main (top-level) module as well. Use modules=main instead.

pagesetmodule
Deprecated.

Get information about the pageset module (providing titles= and friends) as well.

formatmodules
Deprecated.

List of format module names (value of format parameter). Use modules instead.

Values (separate with |): dbg, dbgfm, dump, dumpfm, json, jsonfm, none, php, phpfm, rawfm, txt, txtfm, wddx, wddxfm, xml, xmlfm, yaml, yamlfm

action=parse

  • This module requires read rights.

Parses content and returns parser output.

See the various prop-modules of action=query to get information from the current version of a page.

There are several ways to specify the text to parse:

  1. Specify a page or revision, using page, pageid, or oldid.
  2. Specify content explicitly, using text, title, and contentmodel.
  3. Specify only a summary to parse. prop should be given an empty value.
Parameters:
title

Title of page the text belongs to. If omitted, contentmodel must be specified, and API will be used as the title.

text

Text to parse. Use title or contentmodel to control the content model.

summary

Summary to parse.

page

Parse the content of this page. Cannot be used together with text and title.

pageid

Parse the content of this page. Overrides page.

redirects

If page or pageid is set to a redirect, resolve it.

oldid

Parse the content of this revision. Overrides page and pageid.

prop

Which pieces of information to get:

text
Gives the parsed text of the wikitext.
langlinks
Gives the language links in the parsed wikitext.
categories
Gives the categories in the parsed wikitext.
categorieshtml
Gives the HTML version of the categories.
links
Gives the internal links in the parsed wikitext.
templates
Gives the templates in the parsed wikitext.
images
Gives the images in the parsed wikitext.
externallinks
Gives the external links in the parsed wikitext.
sections
Gives the sections in the parsed wikitext.
revid
Adds the revision ID of the parsed page.
displaytitle
Adds the title of the parsed wikitext.
headitems
Gives items to put in the <head> of the page.
headhtml
Gives parsed <head> of the page.
modules
Gives the ResourceLoader modules used on the page.
indicators
Gives the HTML of page status indicators used on the page.
iwlinks
Gives interwiki links in the parsed wikitext.
wikitext
Gives the original wikitext that was parsed.
properties
Gives various properties defined in the parsed wikitext.
limitreportdata
Gives the limit report in a structured way. Gives no data, when disablepp is set.
limitreporthtml
Gives the HTML version of the limit report. Gives no data, when disablepp is set.
Values (separate with |): text, langlinks, categories, categorieshtml, links, templates, images, externallinks, sections, revid, displaytitle, headitems, headhtml, modules, indicators, iwlinks, wikitext, properties, limitreportdata, limitreporthtml
Default: text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties
pst

Do a pre-save transform on the input before parsing it. Only valid when used with text.

onlypst

Do a pre-save transform (PST) on the input, but don't parse it. Returns the same wikitext, after a PST has been applied. Only valid when used with text.

effectivelanglinks

Includes language links supplied by extensions (for use with prop=langlinks).

section

Only retrieve the content of this section number or when new generate a new section.

new section is only honored when specifying text.

sectiontitle

New section title when section is new.

Unlike page editing, this does not fall back to summary when omitted or empty.

disablepp

Disable the PP Report from the parser output.

disableeditsection

Disable edit section links from the parser output.

generatexml

Generate XML parse tree (requires content model wikitext).

preview

Parse in preview mode.

sectionpreview

Parse in section preview mode (enables preview mode too).

disabletoc

Disable table of contents in output.

contentformat

Content serialization format used for the input text. Only valid when used with text.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
contentmodel

Content model of the input text. If omitted, title must be specified, and default will be the model of the specified title. Only valid when used with text.

One value: wikitext, javascript, json, css, text

action=patrol

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Patrol a page or revision.

Parameters:
rcid

Recentchanges ID to patrol.

revid

Revision ID to patrol.

token

A "patrol" token retrieved from action=query&meta=tokens

This parameter is required.

action=protect

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Change the protection level of a page.

Parameters:
title

Title of the page to (un)protect. Cannot be used together with pageid.

pageid

ID of the page to (un)protect. Cannot be used together with title.

protections

List of protection levels, formatted action=level (e.g. edit=sysop).

Note: Any actions not listed will have restrictions removed.

This parameter is required.
Separate values with |. Maximum number of values is 50 (500 for bots).
expiry

Expiry timestamps. If only one timestamp is set, it'll be used for all protections. Use infinite, indefinite, infinity, or never, for a never-expiring protection.

Separate values with |. Maximum number of values is 50 (500 for bots).
Default: infinite
reason

Reason for (un)protecting.

Default: (empty)
cascade

Enable cascading protection (i.e. protect pages included in this page). Ignored if all protection levels given do not support cascading.

watch
Deprecated.

If set, add the page being (un)protected to the current user's watchlist.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=purge

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Purge the cache for the given titles.

Requires a POST request if the user is not logged in.

Parameters:
forcelinkupdate

Update the links tables.

forcerecursivelinkupdate

Update the links table, and update the links tables for any page that uses this page as a template.

continue

When more results are available, use this to continue.

titles

A list of titles to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
pageids

A list of page IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
revids

A list of revision IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
generator

Get the list of pages to work on by executing the specified query module.

Note: Generator parameter names must be prefixed with a "g", see examples.

One value: allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, backlinks, categories, categorymembers, deletedrevisions, duplicatefiles, embeddedin, exturlusage, fileusage, images, imageusage, iwbacklinks, langbacklinks, links, linkshere, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, templates, transcludedin, watchlist, watchlistraw
redirects

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

converttitles

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz, zh.

Examples:
Purge the Main Page and the API page.
api.php?action=purge&titles=Main_Page|API
Purge the first 10 pages in the main namespace.
api.php?action=purge&generator=allpages&gapnamespace=0&gaplimit=10

action=query

  • This module requires read rights.

Fetch data from and about MediaWiki.

All data modifications will first have to use query to acquire a token to prevent abuse from malicious sites.

Parameters:
prop

Which properties to get for the queried pages.

Values (separate with |): categories, categoryinfo, contributors, deletedrevisions, duplicatefiles, extlinks, fileusage, imageinfo, images, info, iwlinks, langlinks, links, linkshere, pageprops, redirects, revisions, stashimageinfo, templates, transcludedin
list

Which lists to get.

Values (separate with |): allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, allusers, backlinks, blocks, categorymembers, deletedrevs, embeddedin, exturlusage, filearchive, imageusage, iwbacklinks, langbacklinks, logevents, pagepropnames, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, search, tags, usercontribs, users, watchlist, watchlistraw
meta

Which metadata to get.

Values (separate with |): allmessages, filerepoinfo, siteinfo, tokens, userinfo
indexpageids

Include an additional pageids section listing all returned page IDs.

export

Export the current revisions of all given or generated pages.

exportnowrap

Return the export XML without wrapping it in an XML result (same format as Special:Export). Can only be used with export.

iwurl

Whether to get the full URL if the title is an interwiki link.

continue

When present, formats query-continue as key-value pairs that should simply be merged into the original request. This parameter must be set to an empty string in the initial query.

This parameter is recommended for all new development, and will be made default in the next API version.

rawcontinue

Currently ignored. In the future, continue will become the default and this will be needed to receive the raw query-continue data.

titles

A list of titles to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
pageids

A list of page IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
revids

A list of revision IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
generator

Get the list of pages to work on by executing the specified query module.

Note: Generator parameter names must be prefixed with a "g", see examples.

One value: allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, backlinks, categories, categorymembers, deletedrevisions, duplicatefiles, embeddedin, exturlusage, fileusage, images, imageusage, iwbacklinks, langbacklinks, links, linkshere, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, templates, transcludedin, watchlist, watchlistraw
redirects

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

converttitles

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz, zh.

prop=categories (cl)

  • This module requires read rights.
  • This module can be used as a generator.

List all categories the pages belong to.

Parameters:
clprop

Which additional properties to get for each category:

sortkey
Adds the sortkey (hexadecimal string) and sortkey prefix (human-readable part) for the category.
timestamp
Adds timestamp of when the category was added.
hidden
Tags categories that are hidden with __HIDDENCAT__.
Values (separate with |): sortkey, timestamp, hidden
clshow

Which kind of categories to show.

Values (separate with |): hidden, !hidden
cllimit

How many categories to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
clcontinue

When more results are available, use this to continue.

clcategories

Only list these categories. Useful for checking whether a certain page is in a certain category.

Separate values with |. Maximum number of values is 50 (500 for bots).
cldir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
Get a list of categories the page Albert Einstein belongs to.
api.php?action=query&prop=categories&titles=Albert%20Einstein
Get information about all categories used in the page Albert Einstein.
api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info

prop=categoryinfo (ci)

  • This module requires read rights.

Returns information about the given categories.

Parameter:
cicontinue

When more results are available, use this to continue.

Example:
Get information about Category:Foo and Category:Bar.
api.php?action=query&prop=categoryinfo&titles=Category:Foo|Category:Bar

prop=contributors (pc)

  • This module requires read rights.

Get the list of logged-in contributors and the count of anonymous contributors to a page.

Parameters:
pcgroup

Only include users in the given groups. Does not include implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with |): bot, sysop, bureaucrat
pcexcludegroup

Exclude users in the given groups. Does not include implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with |): bot, sysop, bureaucrat
pcrights

Only include users having the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with |): apihighlimits, applychangetags, autoconfirmed, autopatrol, bigdelete, block, blockemail, bot, browsearchive, changetags, createaccount, createpage, createtalk, delete, deletedhistory, deletedtext, deletelogentry, deleterevision, edit, editcontentmodel, editinterface, editprotected, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjs, editmywatchlist, editsemiprotected, editusercssjs, editusercss, edituserjs, hideuser, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, minoredit, move, movefile, move-categorypages, move-rootuserpages, move-subpages, nominornewtalk, noratelimit, override-export-depth, pagelang, passwordreset, patrol, patrolmarks, protect, proxyunbannable, purge, read, reupload, reupload-own, reupload-shared, rollback, sendemail, siteadmin, suppressionlog, suppressredirect, suppressrevision, unblockself, undelete, unwatchedpages, upload, upload_by_url, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed, writeapi, recreatecargodata, deletecargodata, viewedittab, editrestrictedfields, createclass, confirmaccount, requestips, lookupcredentials, approverevisions, viewlinktolatest
Maximum number of values is 50 (500 for bots).
pcexcluderights

Exclude users having the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with |): apihighlimits, applychangetags, autoconfirmed, autopatrol, bigdelete, block, blockemail, bot, browsearchive, changetags, createaccount, createpage, createtalk, delete, deletedhistory, deletedtext, deletelogentry, deleterevision, edit, editcontentmodel, editinterface, editprotected, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjs, editmywatchlist, editsemiprotected, editusercssjs, editusercss, edituserjs, hideuser, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, minoredit, move, movefile, move-categorypages, move-rootuserpages, move-subpages, nominornewtalk, noratelimit, override-export-depth, pagelang, passwordreset, patrol, patrolmarks, protect, proxyunbannable, purge, read, reupload, reupload-own, reupload-shared, rollback, sendemail, siteadmin, suppressionlog, suppressredirect, suppressrevision, unblockself, undelete, unwatchedpages, upload, upload_by_url, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed, writeapi, recreatecargodata, deletecargodata, viewedittab, editrestrictedfields, createclass, confirmaccount, requestips, lookupcredentials, approverevisions, viewlinktolatest
Maximum number of values is 50 (500 for bots).
pclimit

How many contributors to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
pccontinue

When more results are available, use this to continue.

Example:
Show contributors to the page Main Page.
api.php?action=query&prop=contributors&titles=Main_Page

prop=deletedrevisions (drv)

  • This module requires read rights.
  • This module can be used as a generator.

Get deleted revision information.

May be used in several ways:

  1. Get deleted revisions for a set of pages, by setting titles or pageids. Ordered by title and timestamp.
  2. Get data about a set of deleted revisions by setting their IDs with revids. Ordered by revision ID.
Parameters:
drvprop

Which properties to get for each revision:

ids
The ID of the revision.
flags
Revision flags (minor).
timestamp
The timestamp of the revision.
user
User that made the revision.
userid
User ID of the revision creator.
size
Length (bytes) of the revision.
sha1
SHA-1 (base 16) of the revision.
contentmodel
Content model ID of the revision.
comment
Comment by the user for the revision.
parsedcomment
Parsed comment by the user for the revision.
content
Text of the revision.
tags
Tags for the revision.
Values (separate with |): ids, flags, timestamp, user, userid, size, sha1, contentmodel, comment, parsedcomment, content, tags
Default: ids|timestamp|flags|comment|user
drvlimit

Limit how many revisions will be returned.

No more than 500 (5,000 for bots) allowed.
drvexpandtemplates

Expand templates in revision content (requires drvprop=content).

drvgeneratexml

Generate XML parse tree for revision content (requires drvprop=content).

drvparse

Parse revision content (requires drvprop=content). For performance reasons, if this option is used, drvlimit is enforced to 1.

drvsection

Only retrieve the content of this section number.

drvdiffto

Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.

drvdifftotext

Text to diff each revision to. Only diffs a limited number of revisions. Overrides drvdiffto. If drvsection is set, only that section will be diffed against this text

drvcontentformat

Serialization format used for drvdifftotext and expected for output of content.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
drvstart

The timestamp to start enumerating from. Ignored when processing a list of revision IDs.

drvend

The timestamp to stop enumerating at. Ignored when processing a list of revision IDs.

drvdir

In which direction to enumerate:

newer
List oldest first. Note: drvstart has to be before drvend.
older
List newest first (default). Note: drvstart has to be later than drvend.
One value: newer, older
Default: older
drvtag

Only list revisions tagged with this tag.

drvuser

Only list revisions by this user.

drvexcludeuser

Don't list revisions by this user.

drvcontinue

When more results are available, use this to continue.

Examples:
List the deleted revisions of the pages Main Page and Talk:Main Page, with content.
api.php?action=query&prop=deletedrevisions&titles=Main%20Page|Talk:Main%20Page&drvprop=user|comment|content
List the information for deleted revision 123456.
api.php?action=query&prop=deletedrevisions&revids=123456

prop=duplicatefiles (df)

  • This module requires read rights.
  • This module can be used as a generator.

List all files that are duplicates of the given files based on hash values.

Parameters:
dflimit

How many duplicate files to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
dfcontinue

When more results are available, use this to continue.

dfdir

The direction in which to list.

One value: ascending, descending
Default: ascending
dflocalonly

Look only for files in the local repository.

  • This module requires read rights.

Returns all external URLs (not interwikis) from the given pages.

Parameters:
ellimit

How many links to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
eloffset

When more results are available, use this to continue.

elprotocol

Protocol of the URL. If empty and elquery is set, the protocol is http. Leave both this and elquery empty to list all external links.

One value: Can be empty, or bitcoin, ftp, ftps, geo, git, gopher, http, https, irc, ircs, magnet, mailto, mms, news, nntp, redis, sftp, sip, sips, sms, ssh, svn, tel, telnet, urn, worldwind, xmpp
Default: (empty)
elquery

Search string without protocol. Useful for checking whether a certain page contains a certain external url.

elexpandurl

Expand protocol-relative URLs with the canonical protocol.

Example:
Get a list of external links on Main Page.
api.php?action=query&prop=extlinks&titles=Main%20Page

prop=fileusage (fu)

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that use the given files.

Parameters:
fuprop

Which properties to get:

pageid
Page ID of each page.
title
Title of each page.
redirect
Flag if the page is a redirect.
Values (separate with |): pageid, title, redirect
Default: pageid|title|redirect
funamespace

Only include pages in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
fushow

Show only items that meet these criteria:

redirect
Only show redirects.
!redirect
Only show non-redirects.
Values (separate with |): redirect, !redirect
fulimit

How many to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
fucontinue

When more results are available, use this to continue.

prop=imageinfo (ii)

  • This module requires read rights.

Returns file information and upload history.

Parameters:
iiprop

Which file information to get:

timestamp
Adds timestamp for the uploaded version.
user
Adds the user who uploaded each file version.
userid
Add the user ID that uploaded each file version.
comment
Comment on the version.
parsedcomment
Parse the comment on the version.
canonicaltitle
Adds the canonical title of the file.
url
Gives URL to the file and the description page.
size
Adds the size of the file in bytes and the height, width and page count (if applicable).
dimensions
Alias for size.
sha1
Adds SHA-1 hash for the file.
mime
Adds MIME type of the file.
thumbmime
Adds MIME type of the image thumbnail (requires url and param iiurlwidth).
mediatype
Adds the media type of the file.
metadata
Lists Exif metadata for the version of the file.
commonmetadata
Lists file format generic metadata for the version of the file.
extmetadata
Lists formatted metadata combined from multiple sources. Results are HTML formatted.
archivename
Adds the filename of the archive version for non-latest versions.
bitdepth
Adds the bit depth of the version.
uploadwarning
Used by the Special:Upload page to get information about an existing file. Not intended for use outside MediaWiki core.
Values (separate with |): timestamp, user, userid, comment, parsedcomment, canonicaltitle, url, size, dimensions, sha1, mime, thumbmime, mediatype, metadata, commonmetadata, extmetadata, archivename, bitdepth, uploadwarning
Default: timestamp|user
iilimit

How many file revisions to return per file.

No more than 500 (5,000 for bots) allowed.
Default: 1
iistart

Timestamp to start listing from.

iiend

Timestamp to stop listing at.

iiurlwidth

If iiprop=url is set, a URL to an image scaled to this width will be returned. For performance reasons if this option is used, no more than 50 scaled images will be returned.

Default: -1
iiurlheight

Similar to iiurlwidth.

Default: -1
iimetadataversion

Version of metadata to use. If latest is specified, use latest version. Defaults to 1 for backwards compatibility.

Default: 1
iiextmetadatalanguage

What language to fetch extmetadata in. This affects both which translation to fetch, if multiple are available, as well as how things like numbers and various values are formatted.

Default: en
iiextmetadatamultilang

If translations for extmetadata property are available, fetch all of them.

iiextmetadatafilter

If specified and non-empty, only these keys will be returned for iiprop=extmetadata.

Separate values with |. Maximum number of values is 50 (500 for bots).
iiurlparam

A handler specific parameter string. For example, PDFs might use page15-100px. iiurlwidth must be used and be consistent with iiurlparam.

Default: (empty)
iicontinue

When more results are available, use this to continue.

iilocalonly

Look only for files in the local repository.

prop=images (im)

  • This module requires read rights.
  • This module can be used as a generator.

Returns all files contained on the given pages.

Parameters:
imlimit

How many files to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
imcontinue

When more results are available, use this to continue.

imimages

Only list these files. Useful for checking whether a certain page has a certain file.

Separate values with |. Maximum number of values is 50 (500 for bots).
imdir

The direction in which to list.

One value: ascending, descending
Default: ascending

prop=info (in)

  • This module requires read rights.

Get basic page information.

Parameters:
inprop

Which additional properties to get:

protection
List the protection level of each page.
talkid
The page ID of the talk page for each non-talk page.
watched
List the watched status of each page.
watchers
The number of watchers, if allowed.
notificationtimestamp
The watchlist notification timestamp of each page.
subjectid
The page ID of the parent page for each talk page.
url
Gives a full URL, an edit URL, and the canonical URL for each page.
readable
Whether the user can read this page.
preload
Gives the text returned by EditFormPreloadText.
displaytitle
Gives the way the page title is actually displayed.
Values (separate with |): protection, talkid, watched, watchers, notificationtimestamp, subjectid, url, readable, preload, displaytitle
intestactions

Test whether the current user can perform certain actions on the page.

Separate values with |. Maximum number of values is 50 (500 for bots).
intoken
Deprecated.

Use action=query&meta=tokens instead.

Values (separate with |): edit, delete, protect, move, block, unblock, email, import, watch
incontinue

When more results are available, use this to continue.

Examples:
Get information about the page Main Page.
api.php?action=query&prop=info&titles=Main%20Page
Get general and protection information about the page Main Page.
api.php?action=query&prop=info&inprop=protection&titles=Main%20Page
  • This module requires read rights.

Returns all interwiki links from the given pages.

Parameters:
iwprop

Which additional properties to get for each interlanguage link:

url
Adds the full URL.
Values (separate with |): url
iwprefix

Only return interwiki links with this prefix.

iwtitle

Interwiki link to search for. Must be used with iwprefix.

iwdir

The direction in which to list.

One value: ascending, descending
Default: ascending
iwlimit

How many interwiki links to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
iwcontinue

When more results are available, use this to continue.

iwurl
Deprecated.

Whether to get the full URL (cannot be used with iwprop).

Example:
Get interwiki links from the page Main Page.
api.php?action=query&prop=iwlinks&titles=Main%20Page
  • This module requires read rights.

Returns all interlanguage links from the given pages.

Parameters:
llprop

Which additional properties to get for each interlanguage link:

url
Adds the full URL.
langname
Adds the localised language name (best effort). Use llinlanguagecode to control the language.
autonym
Adds the native language name.
Values (separate with |): url, langname, autonym
lllang

Only return language links with this language code.

lltitle

Link to search for. Must be used with lllang.

lldir

The direction in which to list.

One value: ascending, descending
Default: ascending
llinlanguagecode

Language code for localised language names.

Default: en
lllimit

How many langlinks to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
llcontinue

When more results are available, use this to continue.

llurl
Deprecated.

Whether to get the full URL (cannot be used with llprop).

Example:
Get interlanguage links from the page Main Page.
api.php?action=query&prop=langlinks&titles=Main%20Page&redirects=
  • This module requires read rights.
  • This module can be used as a generator.

Returns all links from the given pages.

Parameters:
plnamespace

Show links in these namespaces only.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
pllimit

How many links to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
plcontinue

When more results are available, use this to continue.

pltitles

Only list links to these titles. Useful for checking whether a certain page links to a certain title.

Separate values with |. Maximum number of values is 50 (500 for bots).
pldir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
Get links from the page Main Page
api.php?action=query&prop=links&titles=Main%20Page
Get information about the link pages in the page Main Page.
api.php?action=query&generator=links&titles=Main%20Page&prop=info
Get links from the page Main Page in the User and Template namespaces.
api.php?action=query&prop=links&titles=Main%20Page&plnamespace=2|10

prop=linkshere (lh)

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that link to the given pages.

Parameters:
lhprop

Which properties to get:

pageid
Page ID of each page.
title
Title of each page.
redirect
Flag if the page is a redirect.
Values (separate with |): pageid, title, redirect
Default: pageid|title|redirect
lhnamespace

Only include pages in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
lhshow

Show only items that meet these criteria:

redirect
Only show redirects.
!redirect
Only show non-redirects.
Values (separate with |): redirect, !redirect
lhlimit

How many to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
lhcontinue

When more results are available, use this to continue.

prop=pageprops (pp)

  • This module requires read rights.

Get various properties defined in the page content.

Parameters:
ppcontinue

When more results are available, use this to continue.

ppprop

Only list these props. Useful for checking whether a certain page uses a certain page prop.

Separate values with |. Maximum number of values is 50 (500 for bots).
Example:
Get properties for Category:Foo.
api.php?action=query&prop=pageprops&titles=Category:Foo

prop=redirects (rd)

  • This module requires read rights.
  • This module can be used as a generator.

Returns all redirects to the given pages.

Parameters:
rdprop

Which properties to get:

pageid
Page ID of each redirect.
title
Title of each redirect.
fragment
Fragment of each redirect, if any.
Values (separate with |): pageid, title, fragment
Default: pageid|title
rdnamespace

Only include pages in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
rdshow

Show only items that meet these criteria:

fragment
Only show redirects with a fragment.
!fragment
Only show redirects without a fragment.
Values (separate with |): fragment, !fragment
rdlimit

How many redirects to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
rdcontinue

When more results are available, use this to continue.

prop=revisions (rv)

  • This module requires read rights.
  • This module can be used as a generator.

Get revision information.

May be used in several ways:

  1. Get data about a set of pages (last revision), by setting titles or pageids.
  2. Get revisions for one given page, by using titles or pageids with start, end, or limit.
  3. Get data about a set of revisions by setting their IDs with revids.
Parameters:
rvprop

Which properties to get for each revision:

ids
The ID of the revision.
flags
Revision flags (minor).
timestamp
The timestamp of the revision.
user
User that made the revision.
userid
User ID of the revision creator.
size
Length (bytes) of the revision.
sha1
SHA-1 (base 16) of the revision.
contentmodel
Content model ID of the revision.
comment
Comment by the user for the revision.
parsedcomment
Parsed comment by the user for the revision.
content
Text of the revision.
tags
Tags for the revision.
Values (separate with |): ids, flags, timestamp, user, userid, size, sha1, contentmodel, comment, parsedcomment, content, tags
Default: ids|timestamp|flags|comment|user
rvlimit

Limit how many revisions will be returned.

May only be used with a single page (mode #2).
No more than 500 (5,000 for bots) allowed.
rvexpandtemplates

Expand templates in revision content (requires rvprop=content).

rvgeneratexml

Generate XML parse tree for revision content (requires rvprop=content).

rvparse

Parse revision content (requires rvprop=content). For performance reasons, if this option is used, rvlimit is enforced to 1.

rvsection

Only retrieve the content of this section number.

rvdiffto

Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.

rvdifftotext

Text to diff each revision to. Only diffs a limited number of revisions. Overrides rvdiffto. If rvsection is set, only that section will be diffed against this text

rvcontentformat

Serialization format used for rvdifftotext and expected for output of content.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
rvstartid

From which revision ID to start enumeration.

May only be used with a single page (mode #2).
rvendid

Stop revision enumeration on this revision ID.

May only be used with a single page (mode #2).
rvstart

From which revision timestamp to start enumeration.

May only be used with a single page (mode #2).
rvend

Enumerate up to this timestamp.

May only be used with a single page (mode #2).
rvdir

In which direction to enumerate:

newer
List oldest first. Note: rvstart has to be before rvend.
older
List newest first (default). Note: rvstart has to be later than rvend.
May only be used with a single page (mode #2).
One value: newer, older
Default: older
rvuser

Only include revisions made by user.

May only be used with a single page (mode #2).
rvexcludeuser

Exclude revisions made by user.

May only be used with a single page (mode #2).
rvtag

Only list revisions tagged with this tag.

rvtoken
Deprecated.

Which tokens to obtain for each revision.

Values (separate with |): rollback
rvcontinue

When more results are available, use this to continue.

prop=stashimageinfo (sii)

  • This module requires read rights.

Returns file information for stashed files.

Parameters:
siifilekey

Key that identifies a previous upload that was stashed temporarily.

Separate values with |. Maximum number of values is 50 (500 for bots).
siisessionkey
Deprecated.

Alias for siifilekey, for backward compatibility.

Separate values with |. Maximum number of values is 50 (500 for bots).
siiprop

Which file information to get:

timestamp
Adds timestamp for the uploaded version.
canonicaltitle
Adds the canonical title of the file.
url
Gives URL to the file and the description page.
size
Adds the size of the file in bytes and the height, width and page count (if applicable).
dimensions
Alias for size.
sha1
Adds SHA-1 hash for the file.
mime
Adds MIME type of the file.
thumbmime
Adds MIME type of the image thumbnail (requires url and param siiurlwidth).
metadata
Lists Exif metadata for the version of the file.
commonmetadata
Lists file format generic metadata for the version of the file.
extmetadata
Lists formatted metadata combined from multiple sources. Results are HTML formatted.
bitdepth
Adds the bit depth of the version.
Values (separate with |): timestamp, canonicaltitle, url, size, dimensions, sha1, mime, thumbmime, metadata, commonmetadata, extmetadata, bitdepth
Default: timestamp|url
siiurlwidth

If siiprop=url is set, a URL to an image scaled to this width will be returned. For performance reasons if this option is used, no more than 50 scaled images will be returned.

Default: -1
siiurlheight

Similar to siiurlwidth.

Default: -1
siiurlparam

A handler specific parameter string. For example, PDFs might use page15-100px. siiurlwidth must be used and be consistent with siiurlparam.

Default: (empty)

prop=templates (tl)

  • This module requires read rights.
  • This module can be used as a generator.

Returns all pages transcluded on the given pages.

Parameters:
tlnamespace

Show templates in this namespaces only.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
tllimit

How many templates to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
tlcontinue

When more results are available, use this to continue.

tltemplates

Only list these templates. Useful for checking whether a certain page uses a certain template.

Separate values with |. Maximum number of values is 50 (500 for bots).
tldir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
Get the templates used on the page Main Page.
api.php?action=query&prop=templates&titles=Main%20Page
Get information about the template pages used on Main Page.
api.php?action=query&generator=templates&titles=Main%20Page&prop=info
Get pages in the User and Template namespaces that are transcluded on the page Main Page.
api.php?action=query&prop=templates&titles=Main%20Page&tlnamespace=2|10

prop=transcludedin (ti)

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that transclude the given pages.

Parameters:
tiprop

Which properties to get:

pageid
Page ID of each page.
title
Title of each page.
redirect
Flag if the page is a redirect.
Values (separate with |): pageid, title, redirect
Default: pageid|title|redirect
tinamespace

Only include pages in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
tishow

Show only items that meet these criteria:

redirect
Only show redirects.
!redirect
Only show non-redirects.
Values (separate with |): redirect, !redirect
tilimit

How many to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
ticontinue

When more results are available, use this to continue.

Examples:
Get a list of pages transcluding Main Page.
api.php?action=query&prop=transcludedin&titles=Main%20Page
Get information about pages transcluding Main Page.
api.php?action=query&generator=transcludedin&titles=Main%20Page&prop=info

list=allcategories (ac)

  • This module requires read rights.
  • This module can be used as a generator.

Enumerate all categories.

Parameters:
acfrom

The category to start enumerating from.

accontinue

When more results are available, use this to continue.

acto

The category to stop enumerating at.

acprefix

Search for all category titles that begin with this value.

acdir

Direction to sort in.

One value: ascending, descending
Default: ascending
acmin

Only return categories with at least this many members.

acmax

Only return categories with at most this many members.

aclimit

How many categories to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
acprop

Which properties to get:

size
Adds number of pages in the category.
hidden
Tags categories that are hidden with __HIDDENCAT__.
Values (separate with |): size, hidden
Default: (empty)
Examples:
List categories with information on the number of pages in each.
api.php?action=query&list=allcategories&acprop=size
Retrieve info about the category page itself for categories beginning List.
api.php?action=query&generator=allcategories&gacprefix=List&prop=info

list=alldeletedrevisions (adr)

  • This module requires read rights.
  • This module can be used as a generator.

List all deleted revisions by a user or in a namespace.

Parameters:
adrprop

Which properties to get for each revision:

ids
The ID of the revision.
flags
Revision flags (minor).
timestamp
The timestamp of the revision.
user
User that made the revision.
userid
User ID of the revision creator.
size
Length (bytes) of the revision.
sha1
SHA-1 (base 16) of the revision.
contentmodel
Content model ID of the revision.
comment
Comment by the user for the revision.
parsedcomment
Parsed comment by the user for the revision.
content
Text of the revision.
tags
Tags for the revision.
Values (separate with |): ids, flags, timestamp, user, userid, size, sha1, contentmodel, comment, parsedcomment, content, tags
Default: ids|timestamp|flags|comment|user
adrlimit

Limit how many revisions will be returned.

No more than 500 (5,000 for bots) allowed.
adrexpandtemplates

Expand templates in revision content (requires adrprop=content).

adrgeneratexml

Generate XML parse tree for revision content (requires adrprop=content).

adrparse

Parse revision content (requires adrprop=content). For performance reasons, if this option is used, adrlimit is enforced to 1.

adrsection

Only retrieve the content of this section number.

adrdiffto

Revision ID to diff each revision to. Use prev, next and cur for the previous, next and current revision respectively.

adrdifftotext

Text to diff each revision to. Only diffs a limited number of revisions. Overrides adrdiffto. If adrsection is set, only that section will be diffed against this text

adrcontentformat

Serialization format used for adrdifftotext and expected for output of content.

One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
adruser

Only list revisions by this user.

adrnamespace

Only list pages in this namespace.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
adrstart

The timestamp to start enumerating from.

May only be used with adruser.
adrend

The timestamp to stop enumerating at.

May only be used with adruser.
adrdir

In which direction to enumerate:

newer
List oldest first. Note: adrstart has to be before adrend.
older
List newest first (default). Note: adrstart has to be later than adrend.
One value: newer, older
Default: older
adrfrom

Start listing at this title.

Cannot be used with adruser.
adrto

Stop listing at this title.

Cannot be used with adruser.
adrprefix

Search for all page titles that begin with this value.

Cannot be used with adruser.
adrexcludeuser

Don't list revisions by this user.

Cannot be used with adruser.
adrtag

Only list revisions tagged with this tag.

adrcontinue

When more results are available, use this to continue.

adrgeneratetitles

When being used as a generator, generate titles rather than revision IDs.

Examples:
List the last 50 deleted contributions by user Example.
api.php?action=query&list=alldeletedrevisions&adruser=Example&adrlimit=50
List the first 50 deleted revisions in the main namespace.
api.php?action=query&list=alldeletedrevisions&adrdir=newer&adrlimit=50

list=allfileusages (af)

  • This module requires read rights.
  • This module can be used as a generator.

List all file usages, including non-existing.

Parameters:
afcontinue

When more results are available, use this to continue.

affrom

The title of the file to start enumerating from.

afto

The title of the file to stop enumerating at.

afprefix

Search for all file titles that begin with this value.

afunique

Only show distinct file titles. Cannot be used with afprop=ids. When used as a generator, yields target pages instead of source pages.

afprop

Which pieces of information to include:

ids
Adds the page ID of the using page (cannot be used with afunique).
title
Adds the title of the file.
Values (separate with |): ids, title
Default: title
aflimit

How many total items to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
afdir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
List file titles, including missing ones, with page IDs they are from, starting at B.
api.php?action=query&list=allfileusages&affrom=B&afprop=ids|title
List unique file titles.
api.php?action=query&list=allfileusages&afunique=&affrom=B
Gets all file titles, marking the missing ones.
api.php?action=query&generator=allfileusages&gafunique=&gaffrom=B
Gets pages containing the files.
api.php?action=query&generator=allfileusages&gaffrom=B

list=allimages (ai)

  • This module requires read rights.
  • This module can be used as a generator.

Enumerate all images sequentially.

Parameters:
aisort

Property to sort by.

One value: name, timestamp
Default: name
aidir

The direction in which to list.

One value: ascending, descending, newer, older
Default: ascending
aifrom

The image title to start enumerating from. Can only be used with aisort=name.

aito

The image title to stop enumerating at. Can only be used with aisort=name.

aicontinue

When more results are available, use this to continue.

aistart

The timestamp to start enumerating from. Can only be used with aisort=timestamp.

aiend

The timestamp to end enumerating. Can only be used with aisort=timestamp.

aiprop

Which file information to get:

timestamp
Adds timestamp for the uploaded version.
user
Adds the user who uploaded each file version.
userid
Add the user ID that uploaded each file version.
comment
Comment on the version.
parsedcomment
Parse the comment on the version.
canonicaltitle
Adds the canonical title of the file.
url
Gives URL to the file and the description page.
size
Adds the size of the file in bytes and the height, width and page count (if applicable).
dimensions
Alias for size.
sha1
Adds SHA-1 hash for the file.
mime
Adds MIME type of the file.
mediatype
Adds the media type of the file.
metadata
Lists Exif metadata for the version of the file.
commonmetadata
Lists file format generic metadata for the version of the file.
extmetadata
Lists formatted metadata combined from multiple sources. Results are HTML formatted.
bitdepth
Adds the bit depth of the version.
Values (separate with |): timestamp, user, userid, comment, parsedcomment, canonicaltitle, url, size, dimensions, sha1, mime, mediatype, metadata, commonmetadata, extmetadata, bitdepth
Default: timestamp|url
aiprefix

Search for all image titles that begin with this value. Can only be used with aisort=name.

aiminsize

Limit to images with at least this many bytes.

aimaxsize

Limit to images with at most this many bytes.

aisha1

SHA1 hash of image. Overrides aisha1base36.

aisha1base36

SHA1 hash of image in base 36 (used in MediaWiki).

aiuser

Only return files uploaded by this user. Can only be used with aisort=timestamp. Cannot be used together with aifilterbots.

aifilterbots

How to filter files uploaded by bots. Can only be used with aisort=timestamp. Cannot be used together with aiuser.

One value: all, bots, nobots
Default: all
aimime

What MIME types to search for, e.g. image/jpeg.

Separate values with |. Maximum number of values is 50 (500 for bots).
ailimit

How many images in total to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
Examples:
Show a list of files starting at the letter B.
api.php?action=query&list=allimages&aifrom=B
Show a list of recently uploaded files, similar to Special:NewFiles.
api.php?action=query&list=allimages&aiprop=user|timestamp|url&aisort=timestamp&aidir=older
Show a list of files with MIME type image/png or image/gif
api.php?action=query&list=allimages&aimime=image/png|image/gif
Show info about 4 files starting at the letter T.
api.php?action=query&generator=allimages&gailimit=4&gaifrom=T&prop=imageinfo
  • This module requires read rights.
  • This module can be used as a generator.

Enumerate all links that point to a given namespace.

Parameters:
alcontinue

When more results are available, use this to continue.

alfrom

The title of the link to start enumerating from.

alto

The title of the link to stop enumerating at.

alprefix

Search for all linked titles that begin with this value.

alunique

Only show distinct linked titles. Cannot be used with alprop=ids. When used as a generator, yields target pages instead of source pages.

alprop

Which pieces of information to include:

ids
Adds the page ID of the linking page (cannot be used with alunique).
title
Adds the title of the link.
Values (separate with |): ids, title
Default: title
alnamespace

The namespace to enumerate.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
allimit

How many total items to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
aldir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
List linked titles, including missing ones, with page IDs they are from, starting at B.
api.php?action=query&list=alllinks&alfrom=B&alprop=ids|title
List unique linked titles.
api.php?action=query&list=alllinks&alunique=&alfrom=B
Gets all linked titles, marking the missing ones.
api.php?action=query&generator=alllinks&galunique=&galfrom=B
Gets pages containing the links.
api.php?action=query&generator=alllinks&galfrom=B

list=allpages (ap)

  • This module requires read rights.
  • This module can be used as a generator.

Enumerate all pages sequentially in a given namespace.

Parameters:
apfrom

The page title to start enumerating from.

apcontinue

When more results are available, use this to continue.

apto

The page title to stop enumerating at.

apprefix

Search for all page titles that begin with this value.

apnamespace

The namespace to enumerate.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
apfilterredir

Which pages to list.

One value: all, redirects, nonredirects
Default: all
apminsize

Limit to pages with at least this many bytes.

apmaxsize

Limit to pages with at most this many bytes.

apprtype

Limit to protected pages only.

Values (separate with |): edit, move, upload
apprlevel

Filter protections based on protection level (must be used with apprtype= parameter).

Values (separate with |): Can be empty, or autoconfirmed, sysop
apprfiltercascade

Filter protections based on cascadingness (ignored when apprtype isn't set).

One value: cascading, noncascading, all
Default: all
aplimit

How many total pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
apdir

The direction in which to list.

One value: ascending, descending
Default: ascending
apfilterlanglinks

Filter based on whether a page has langlinks. Note that this may not consider langlinks added by extensions.

One value: withlanglinks, withoutlanglinks, all
Default: all
apprexpiry

Which protection expiry to filter the page on:

indefinite
Get only pages with indefinite protection expiry.
definite
Get only pages with a definite (specific) protection expiry.
all
Get pages with any protections expiry.
One value: indefinite, definite, all
Default: all
Examples:
Show a list of pages starting at the letter B.
api.php?action=query&list=allpages&apfrom=B
Show info about 4 pages starting at the letter T.
api.php?action=query&generator=allpages&gaplimit=4&gapfrom=T&prop=info
Show content of first 2 non-redirect pages beginning at Re.
api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content

list=allredirects (ar)

  • This module requires read rights.
  • This module can be used as a generator.

List all redirects to a namespace.

Parameters:
arcontinue

When more results are available, use this to continue.

arfrom

The title of the redirect to start enumerating from.

arto

The title of the redirect to stop enumerating at.

arprefix

Search for all target pages that begin with this value.

arunique

Only show distinct target pages. Cannot be used with arprop=ids|fragment|interwiki. When used as a generator, yields target pages instead of source pages.

arprop

Which pieces of information to include:

ids
Adds the page ID of the redirecting page (cannot be used with arunique).
title
Adds the title of the redirect.
fragment
Adds the fragment from the redirect, if any (cannot be used with arunique).
interwiki
Adds the interwiki prefix from the redirect, if any (cannot be used with arunique).
Values (separate with |): ids, title, fragment, interwiki
Default: title
arnamespace

The namespace to enumerate.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
arlimit

How many total items to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
ardir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
List target pages, including missing ones, with page IDs they are from, starting at B.
api.php?action=query&list=allredirects&arfrom=B&arprop=ids|title
List unique target pages.
api.php?action=query&list=allredirects&arunique=&arfrom=B
Gets all target pages, marking the missing ones.
api.php?action=query&generator=allredirects&garunique=&garfrom=B
Gets pages containing the redirects.
api.php?action=query&generator=allredirects&garfrom=B

list=alltransclusions (at)

  • This module requires read rights.
  • This module can be used as a generator.

List all transclusions (pages embedded using {{x}}), including non-existing.

Parameters:
atcontinue

When more results are available, use this to continue.

atfrom

The title of the transclusion to start enumerating from.

atto

The title of the transclusion to stop enumerating at.

atprefix

Search for all transcluded titles that begin with this value.

atunique

Only show distinct transcluded titles. Cannot be used with atprop=ids. When used as a generator, yields target pages instead of source pages.

atprop

Which pieces of information to include:

ids
Adds the page ID of the transcluding page (cannot be used with atunique).
title
Adds the title of the transclusion.
Values (separate with |): ids, title
Default: title
atnamespace

The namespace to enumerate.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 10
atlimit

How many total items to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
atdir

The direction in which to list.

One value: ascending, descending
Default: ascending
Examples:
List transcluded titles, including missing ones, with page IDs they are from, starting at B.
api.php?action=query&list=alltransclusions&atfrom=B&atprop=ids|title
List unique transcluded titles.
api.php?action=query&list=alltransclusions&atunique=&atfrom=B
Gets all transcluded titles, marking the missing ones.
api.php?action=query&generator=alltransclusions&gatunique=&gatfrom=B
Gets pages containing the transclusions.
api.php?action=query&generator=alltransclusions&gatfrom=B

list=allusers (au)

  • This module requires read rights.

Enumerate all registered users.

Parameters:
aufrom

The user name to start enumerating from.

auto

The user name to stop enumerating at.

auprefix

Search for all users that begin with this value.

audir

Direction to sort in.

One value: ascending, descending
Default: ascending
augroup

Only include users in the given groups.

Values (separate with |): bot, sysop, bureaucrat
auexcludegroup

Exclude users in the given groups.

Values (separate with |): bot, sysop, bureaucrat
aurights

Only include users with the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with |): apihighlimits, applychangetags, autoconfirmed, autopatrol, bigdelete, block, blockemail, bot, browsearchive, changetags, createaccount, createpage, createtalk, delete, deletedhistory, deletedtext, deletelogentry, deleterevision, edit, editcontentmodel, editinterface, editprotected, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjs, editmywatchlist, editsemiprotected, editusercssjs, editusercss, edituserjs, hideuser, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, minoredit, move, movefile, move-categorypages, move-rootuserpages, move-subpages, nominornewtalk, noratelimit, override-export-depth, pagelang, passwordreset, patrol, patrolmarks, protect, proxyunbannable, purge, read, reupload, reupload-own, reupload-shared, rollback, sendemail, siteadmin, suppressionlog, suppressredirect, suppressrevision, unblockself, undelete, unwatchedpages, upload, upload_by_url, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed, writeapi, recreatecargodata, deletecargodata, viewedittab, editrestrictedfields, createclass, confirmaccount, requestips, lookupcredentials, approverevisions, viewlinktolatest
Maximum number of values is 50 (500 for bots).
auprop

Which pieces of information to include:

blockinfo
Adds the information about a current block on the user.
groups
Lists groups that the user is in. This uses more server resources and may return fewer results than the limit.
implicitgroups
Lists all the groups the user is automatically in.
rights
Lists rights that the user has.
editcount
Adds the edit count of the user.
registration
Adds the timestamp of when the user registered if available (may be blank).
Values (separate with |): blockinfo, groups, implicitgroups, rights, editcount, registration
aulimit

How many total user names to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
auwitheditsonly

Only list users who have made edits.

auactiveusers

Only list users active in the last 30 days.

Example:
List users starting at Y.
api.php?action=query&list=allusers&aufrom=Y
  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that link to the given page.

Parameters:
bltitle

Title to search. Cannot be used together with blpageid.

blpageid

Page ID to search. Cannot be used together with bltitle.

blcontinue

When more results are available, use this to continue.

blnamespace

The namespace to enumerate.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
bldir

The direction in which to list.

One value: ascending, descending
Default: ascending
blfilterredir

How to filter for redirects. If set to nonredirects when blredirect is enabled, this is only applied to the second level.

One value: all, redirects, nonredirects
Default: all
bllimit

How many total pages to return. If blredirect is enabled, limit applies to each level separately (which means up to 2 * bllimit results may be returned).

No more than 500 (5,000 for bots) allowed.
Default: 10
blredirect

If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.

Examples:
Show links to Main page.
api.php?action=query&list=backlinks&bltitle=Main%20Page
Get information about pages linking to Main page.
api.php?action=query&generator=backlinks&gbltitle=Main%20Page&prop=info

list=blocks (bk)

  • This module requires read rights.

List all blocked users and IP addresses.

Parameters:
bkstart

The timestamp to start enumerating from.

bkend

The timestamp to stop enumerating at.

bkdir

In which direction to enumerate:

newer
List oldest first. Note: bkstart has to be before bkend.
older
List newest first (default). Note: bkstart has to be later than bkend.
One value: newer, older
Default: older
bkids

List of block IDs to list (optional).

Separate values with |. Maximum number of values is 50 (500 for bots).
bkusers

List of users to search for (optional).

Separate values with |. Maximum number of values is 50 (500 for bots).
bkip

Get all blocks applying to this IP or CIDR range, including range blocks. Cannot be used together with bkusers. CIDR ranges broader than IPv4/16 or IPv6/19 are not accepted.

bklimit

The maximum number of blocks to list.

No more than 500 (5,000 for bots) allowed.
Default: 10
bkprop

Which properties to get:

id
Adds the ID of the block.
user
Adds the username of the blocked user.
userid
Adds the user ID of the blocked user.
by
Adds the username of the blocking user.
byid
Adds the user ID of the blocking user.
timestamp
Adds the timestamp of when the block was given.
expiry
Adds the timestamp of when the block expires.
reason
Adds the reason given for the block.
range
Adds the range of IP addresses affected by the block.
flags
Tags the ban with (autoblock, anononly, etc.).
Values (separate with |): id, user, userid, by, byid, timestamp, expiry, reason, range, flags
Default: id|user|by|timestamp|expiry|reason|flags
bkshow

Show only items that meet these criteria. For example, to see only indefinite blocks on IP addresses, set bkshow=ip|!temp.

Values (separate with |): account, !account, temp, !temp, ip, !ip, range, !range
bkcontinue

When more results are available, use this to continue.

Examples:
List blocks.
api.php?action=query&list=blocks
List blocks of users Alice and Bob.
api.php?action=query&list=blocks&bkusers=Alice|Bob

list=categorymembers (cm)

  • This module requires read rights.
  • This module can be used as a generator.

List all pages in a given category.

Parameters:
cmtitle

Which category to enumerate (required). Must include the Category: prefix. Cannot be used together with cmpageid.

cmpageid

Page ID of the category to enumerate. Cannot be used together with cmtitle.

cmprop

Which pieces of information to include:

ids
Adds the page ID.
title
Adds the title and namespace ID of the page.
sortkey
Adds the sortkey used for sorting in the category (hexadecimal string).
sortkeyprefix
Adds the sortkey prefix used for sorting in the category (human-readable part of the sortkey).
type
Adds the type that the page has been categorised as (page, subcat or file).
timestamp
Adds the timestamp of when the page was included.
Values (separate with |): ids, title, sortkey, sortkeyprefix, type, timestamp
Default: ids|title
cmnamespace

Only include pages in these namespaces. Note that cmtype=subcat or cmtype=file may be used instead of cmnamespace=14 or 6.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
cmtype

Which type of category members to include. Ignored when cmsort=timestamp is set.

Values (separate with |): page, subcat, file
Default: page|subcat|file
cmcontinue

When more results are available, use this to continue.

cmlimit

The maximum number of pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
cmsort

Property to sort by.

One value: sortkey, timestamp
Default: sortkey
cmdir

In which direction to sort.

One value: asc, desc, ascending, descending, newer, older
Default: ascending
cmstart

Timestamp to start listing from. Can only be used with cmsort=timestamp.

cmend

Timestamp to end listing at. Can only be used with cmsort=timestamp.

cmstarthexsortkey

Sortkey to start listing from, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.

cmendhexsortkey

Sortkey to end listing from, as returned by cmprop=sortkey. Can only be used with cmsort=sortkey.

cmstartsortkeyprefix

Sortkey prefix to start listing from. Can only be used with cmsort=sortkey. Overrides cmstarthexsortkey.

cmendsortkeyprefix

Sortkey prefix to end listing BEFORE (not at, if this value occurs it will not be included!). Can only be used with cmsort=sortkey. Overrides cmendhexsortkey.

cmstartsortkey
Deprecated.

Use cmstarthexsortkey instead.

cmendsortkey
Deprecated.

Use cmendhexsortkey instead.

Examples:
Get first 10 pages in Category:Physics.
api.php?action=query&list=categorymembers&cmtitle=Category:Physics
Get page info about first 10 pages in Category:Physics.
api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info

list=deletedrevs (dr)

  • This module is deprecated.
  • This module requires read rights.

List deleted revisions.

Operates in three modes:

  1. List deleted revisions for the given titles, sorted by timestamp.
  2. List deleted contributions for the given user, sorted by timestamp (no titles specified).
  3. List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, druser not set).

Certain parameters only apply to some modes and are ignored in others.

Parameters:
drstart

The timestamp to start enumerating from.

Modes: 1, 2
drend

The timestamp to stop enumerating at.

Modes: 1, 2
drdir

In which direction to enumerate:

newer
List oldest first. Note: drstart has to be before drend.
older
List newest first (default). Note: drstart has to be later than drend.
Modes: 1, 3
One value: newer, older
Default: older
drfrom

Start listing at this title.

Mode: 3
drto

Stop listing at this title.

Mode: 3
drprefix

Search for all page titles that begin with this value.

Mode: 3
drunique

List only one revision for each page.

Mode: 3
drnamespace

Only list pages in this namespace.

Mode: 3
One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
drtag

Only list revisions tagged with this tag.

druser

Only list revisions by this user.

drexcludeuser

Don't list revisions by this user.

drprop

Which properties to get:

revid
Adds the revision ID of the deleted revision.
parentid
Adds the revision ID of the previous revision to the page.
user
Adds the user who made the revision.
userid
Adds the user ID whom made the revision.
comment
Adds the comment of the revision.
parsedcomment
Adds the parsed comment of the revision.
minor
Tags if the revision is minor.
len
Adds the length (bytes) of the revision.
sha1
Adds the SHA-1 (base 16) of the revision.
content
Adds the content of the revision.
token
Deprecated. Gives the edit token.
tags
Tags for the revision.
Values (separate with |): revid, parentid, user, userid, comment, parsedcomment, minor, len, sha1, content, token, tags
Default: user|comment
drlimit

The maximum amount of revisions to list.

No more than 500 (5,000 for bots) allowed.
Default: 10
drcontinue

When more results are available, use this to continue.

Examples:
List the last deleted revisions of the pages Main Page and Talk:Main Page, with content (mode 1).
api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&drprop=user|comment|content
List the last 50 deleted contributions by Bob (mode 2).
api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50
List the first 50 deleted revisions in the main namespace (mode 3).
api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50
List the first 50 deleted pages in the Talk namespace (mode 3).
api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50&drnamespace=1&drunique=

list=embeddedin (ei)

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that embed (transclude) the given title.

Parameters:
eititle

Title to search. Cannot be used together with eipageid.

eipageid

Page ID to search. Cannot be used together with eititle.

eicontinue

When more results are available, use this to continue.

einamespace

The namespace to enumerate.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
eidir

The direction in which to list.

One value: ascending, descending
Default: ascending
eifilterredir

How to filter for redirects.

One value: all, redirects, nonredirects
Default: all
eilimit

How many total pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
Examples:
Show pages transcluding Template:Stub.
api.php?action=query&list=embeddedin&eititle=Template:Stub
Get information about pages transcluding Template:Stub.
api.php?action=query&generator=embeddedin&geititle=Template:Stub&prop=info

list=exturlusage (eu)

  • This module requires read rights.
  • This module can be used as a generator.

Enumerate pages that contain a given URL.

Parameters:
euprop

Which pieces of information to include:

ids
Adds the ID of page.
title
Adds the title and namespace ID of the page.
url
Adds the URL used in the page.
Values (separate with |): ids, title, url
Default: ids|title|url
euoffset

When more results are available, use this to continue.

euprotocol

Protocol of the URL. If empty and euquery set, the protocol is http. Leave both this and euquery empty to list all external links.

One value: Can be empty, or bitcoin, ftp, ftps, geo, git, gopher, http, https, irc, ircs, magnet, mailto, mms, news, nntp, redis, sftp, sip, sips, sms, ssh, svn, tel, telnet, urn, worldwind, xmpp
Default: (empty)
euquery

Search string without protocol. See Special:LinkSearch. Leave empty to list all external links.

eunamespace

The page namespaces to enumerate.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
eulimit

How many pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
euexpandurl

Expand protocol-relative URLs with the canonical protocol.

list=filearchive (fa)

  • This module requires read rights.

Enumerate all deleted files sequentially.

Parameters:
fafrom

The image title to start enumerating from.

fato

The image title to stop enumerating at.

faprefix

Search for all image titles that begin with this value.

fadir

The direction in which to list.

One value: ascending, descending
Default: ascending
fasha1

SHA1 hash of image. Overrides fasha1base36.

fasha1base36

SHA1 hash of image in base 36 (used in MediaWiki).

faprop

Which image information to get:

sha1
Adds SHA-1 hash for the image.
timestamp
Adds timestamp for the uploaded version.
user
Adds user who uploaded the image version.
size
Adds the size of the image in bytes and the height, width and page count (if applicable).
dimensions
Alias for size.
description
Adds description the image version.
parseddescription
Parse the description on the version.
mime
Adds MIME of the image.
mediatype
Adds the media type of the image.
metadata
Lists Exif metadata for the version of the image.
bitdepth
Adds the bit depth of the version.
archivename
Adds the filename of the archive version for non-latest versions.
Values (separate with |): sha1, timestamp, user, size, dimensions, description, parseddescription, mime, mediatype, metadata, bitdepth, archivename
Default: timestamp
falimit

How many images to return in total.

No more than 500 (5,000 for bots) allowed.
Default: 10
facontinue

When more results are available, use this to continue.

Example:
Show a list of all deleted files.
api.php?action=query&list=filearchive

list=imageusage (iu)

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that use the given image title.

Parameters:
iutitle

Title to search. Cannot be used together with iupageid.

iupageid

Page ID to search. Cannot be used together with iutitle.

iucontinue

When more results are available, use this to continue.

iunamespace

The namespace to enumerate.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
iudir

The direction in which to list.

One value: ascending, descending
Default: ascending
iufilterredir

How to filter for redirects. If set to nonredirects when iuredirect is enabled, this is only applied to the second level.

One value: all, redirects, nonredirects
Default: all
iulimit

How many total pages to return. If iuredirect is enabled, the limit applies to each level separately (which means up to 2 * iulimit results may be returned).

No more than 500 (5,000 for bots) allowed.
Default: 10
iuredirect

If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.

  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that link to the given interwiki link.

Can be used to find all links with a prefix, or all links to a title (with a given prefix). Using neither parameter is effectively "all interwiki links".

Parameters:
iwblprefix

Prefix for the interwiki.

iwbltitle

Interwiki link to search for. Must be used with iwblblprefix.

iwblcontinue

When more results are available, use this to continue.

iwbllimit

How many total pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
iwblprop

Which properties to get:

iwprefix
Adds the prefix of the interwiki.
iwtitle
Adds the title of the interwiki.
Values (separate with |): iwprefix, iwtitle
Default: (empty)
iwbldir

The direction in which to list.

One value: ascending, descending
Default: ascending
  • This module requires read rights.
  • This module can be used as a generator.

Find all pages that link to the given language link.

Can be used to find all links with a language code, or all links to a title (with a given language). Using neither parameter is effectively "all language links".

Note that this may not consider language links added by extensions.

Parameters:
lbllang

Language for the language link.

lbltitle

Language link to search for. Must be used with lbllang.

lblcontinue

When more results are available, use this to continue.

lbllimit

How many total pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
lblprop

Which properties to get:

lllang
Adds the language code of the language link.
lltitle
Adds the title of the language link.
Values (separate with |): lllang, lltitle
Default: (empty)
lbldir

The direction in which to list.

One value: ascending, descending
Default: ascending

list=logevents (le)

  • This module requires read rights.

Get events from logs.

Parameters:
leprop

Which properties to get:

ids
Adds the ID of the log event.
title
Adds the title of the page for the log event.
type
Adds the type of log event.
user
Adds the user responsible for the log event.
userid
Adds the user ID who was responsible for the log event.
timestamp
Adds the timestamp for the event.
comment
Adds the comment of the event.
parsedcomment
Adds the parsed comment of the event.
details
Lists additional details about the event.
tags
Lists tags for the event.
Values (separate with |): ids, title, type, user, userid, timestamp, comment, parsedcomment, details, tags
Default: ids|title|type|user|timestamp|comment|details
letype

Filter log entries to only this type.

One value: Can be empty, or block, protect, rights, delete, upload, move, import, patrol, merge, suppress, tag, managetags, approval, newusers
leaction

Filter log actions to only this action. Overrides letype. Wildcard actions like action/* allows to specify any string for the asterisk.

One value: protect/protect, protect/modify, protect/unprotect, protect/move_prot, approval/approve, approval/unapprove, move/move, move/move_redir, delete/delete, delete/restore, delete/revision, delete/event, suppress/revision, suppress/event, suppress/delete, patrol/patrol, rights/rights, rights/autopromote, upload/upload, upload/overwrite, upload/revert, merge/merge, tag/update, managetags/create, managetags/delete, managetags/activate, managetags/deactivate, block/block, block/unblock, block/reblock, suppress/block, suppress/reblock, import/upload, import/interwiki, newusers/newusers, newusers/create, newusers/create2, newusers/byemail, newusers/autocreate
lestart

The timestamp to start enumerating from.

leend

The timestamp to end enumerating.

ledir

In which direction to enumerate:

newer
List oldest first. Note: lestart has to be before leend.
older
List newest first (default). Note: lestart has to be later than leend.
One value: newer, older
Default: older
leuser

Filter entries to those made by the given user.

letitle

Filter entries to those related to a page.

lenamespace

Filter entries to those in the given namespace.

One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
leprefix

Filter entries that start with this prefix.

letag

Only list event entries tagged with this tag.

lelimit

How many total event entries to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
lecontinue

When more results are available, use this to continue.

Example:
List recent log events.
api.php?action=query&list=logevents

list=pagepropnames (ppn)

  • This module requires read rights.

List all page property names in use on the wiki.

Parameters:
ppncontinue

When more results are available, use this to continue.

ppnlimit

The maximum number of names to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
Example:
Get first 10 property names.
api.php?action=query&list=pagepropnames

list=pageswithprop (pwp)

  • This module requires read rights.
  • This module can be used as a generator.

List all pages using a given page property.

Parameters:
pwppropname

Page prop for which to enumerate pages.

This parameter is required.
pwpprop

Which pieces of information to include:

ids
Adds the page ID.
title
Adds the title and namespace ID of the page.
value
Adds the value of the page prop.
Values (separate with |): ids, title, value
Default: ids|title
pwpcontinue

When more results are available, use this to continue.

pwplimit

The maximum number of pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
pwpdir

In which direction to sort.

One value: ascending, descending
Default: ascending
Examples:
List the first 10 pages using {{DISPLAYTITLE:}}.
api.php?action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value
Get page info about first 10 pages using __NOTOC__.
api.php?action=query&generator=pageswithprop&gpwppropname=notoc&prop=info

list=prefixsearch (ps)

  • This module requires read rights.
  • This module can be used as a generator.

Perform a prefix search for page titles.

Parameters:
pssearch

Search string.

This parameter is required.
psnamespace

Namespaces to search.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
pslimit

Maximum number of results to return.

No more than 100 (200 for bots) allowed.
Default: 10
psoffset

Number of results to skip.

Default: 0
Example:
Search for page titles beginning with meaning.
api.php?action=query&list=prefixsearch&pssearch=meaning

list=protectedtitles (pt)

  • This module requires read rights.
  • This module can be used as a generator.

List all titles protected from creation.

Parameters:
ptnamespace

Only list titles in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
ptlevel

Only list titles with these protection levels.

Values (separate with |): autoconfirmed, sysop
ptlimit

How many total pages to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
ptdir

In which direction to enumerate:

newer
List oldest first. Note: ptstart has to be before ptend.
older
List newest first (default). Note: ptstart has to be later than ptend.
One value: newer, older
Default: older
ptstart

Start listing at this protection timestamp.

ptend

Stop listing at this protection timestamp.

ptprop

Which properties to get:

timestamp
Adds the timestamp of when protection was added.
user
Adds the user that added the protection.
userid
Adds the user ID that added the protection.
comment
Adds the comment for the protection.
parsedcomment
Adds the parsed comment for the protection.
expiry
Adds the timestamp of when the protection will be lifted.
level
Adds the protection level.
Values (separate with |): timestamp, user, userid, comment, parsedcomment, expiry, level
Default: timestamp|level
ptcontinue

When more results are available, use this to continue.

Examples:
List protected titles.
api.php?action=query&list=protectedtitles
Find links to protected titles in the main namespace.
api.php?action=query&generator=protectedtitles&gptnamespace=0&prop=linkshere

list=querypage (qp)

  • This module requires read rights.
  • This module can be used as a generator.

Get a list provided by a QueryPage-based special page.

Parameters:
qppage

The name of the special page. Note, this is case sensitive.

This parameter is required.
One value: Ancientpages, BrokenRedirects, Deadendpages, DoubleRedirects, ListDuplicatedFiles, Listredirects, Lonelypages, Longpages, MediaStatistics, Mostcategories, Mostimages, Mostinterwikis, Mostlinkedcategories, Mostlinkedtemplates, Mostlinked, Mostrevisions, Fewestrevisions, Shortpages, Uncategorizedcategories, Uncategorizedpages, Uncategorizedimages, Uncategorizedtemplates, Unusedcategories, Unusedimages, Wantedcategories, Wantedfiles, Wantedpages, Wantedtemplates, Unwatchedpages, Unusedtemplates, Withoutinterwiki
qpoffset

When more results are available, use this to continue.

Default: 0
qplimit

Number of results to return.

No more than 500 (5,000 for bots) allowed.
Default: 10

list=random (rn)

  • This module requires read rights.
  • This module can be used as a generator.

Get a set of random pages.

Pages are listed in a fixed sequence, only the starting point is random. This means that if, for example, Main Page is the first random page in the list, List of fictional monkeys will always be second, List of people on stamps of Vanuatu third, etc.

If the number of pages in the namespace is lower than rnlimit, fewer pages will be returned. The same page will not be returned twice.

Parameters:
rnnamespace

Return pages in these namespaces only.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
rnlimit

Limit how many random pages will be returned.

No more than 10 (20 for bots) allowed.
Default: 1
rnredirect

Load a random redirect instead of a random page.

Examples:
Return two random pages from the main namespace.
api.php?action=query&list=random&rnnamespace=0&rnlimit=2
Return page info about two random pages from the main namespace.
api.php?action=query&generator=random&grnnamespace=0&grnlimit=2&prop=info

list=recentchanges (rc)

  • This module requires read rights.
  • This module can be used as a generator.

Enumerate recent changes.

Parameters:
rcstart

The timestamp to start enumerating from.

rcend

The timestamp to end enumerating.

rcdir

In which direction to enumerate:

newer
List oldest first. Note: rcstart has to be before rcend.
older
List newest first (default). Note: rcstart has to be later than rcend.
One value: newer, older
Default: older
rcnamespace

Filter changes to only these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
rcuser

Only list changes by this user.

rcexcludeuser

Don't list changes by this user.

rctag

Only list changes tagged with this tag.

rcprop

Include additional pieces of information:

user
Adds the user responsible for the edit and tags if they are an IP.
userid
Adds the user ID responsible for the edit.
comment
Adds the comment for the edit.
parsedcomment
Adds the parsed comment for the edit.
flags
Adds flags for the edit.
timestamp
Adds timestamp of the edit.
title
Adds the page title of the edit.
ids
Adds the page ID, recent changes ID and the new and old revision ID.
sizes
Adds the new and old page length in bytes.
redirect
Tags edit if page is a redirect.
patrolled
Tags patrollable edits as being patrolled or unpatrolled.
loginfo
Adds log information (log ID, log type, etc) to log entries.
tags
Lists tags for the entry.
sha1
Adds the content checksum for entries associated with a revision.
Values (separate with |): user, userid, comment, parsedcomment, flags, timestamp, title, ids, sizes, redirect, patrolled, loginfo, tags, sha1
Default: title|timestamp|ids
rctoken
Deprecated.

Use action=query&meta=tokens instead.

Values (separate with |): patrol
rcshow

Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set rcshow=minor|!anon.

Values (separate with |): minor, !minor, bot, !bot, anon, !anon, redirect, !redirect, patrolled, !patrolled, unpatrolled
rclimit

How many total changes to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
rctype

Which types of changes to show.

Values (separate with |): edit, external, new, log
Default: edit|new|log
rctoponly

Only list changes which are the latest revision.

rccontinue

When more results are available, use this to continue.

Examples:
List recent changes.
api.php?action=query&list=recentchanges
Get page info about recent unpatrolled changes.
api.php?action=query&generator=recentchanges&grcshow=!patrolled&prop=info

list=search (sr)

  • This module requires read rights.
  • This module can be used as a generator.

Perform a full text search.

Parameters:
srsearch

Search for all page titles (or content) that have this value.

This parameter is required.
srnamespace

Search only within these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
Default: 0
srwhat

Which type of search to perform.

One value: title, text, nearmatch
srinfo

Which metadata to return.

Values (separate with |): totalhits, suggestion
Default: totalhits|suggestion
srprop

Which properties to return:

size
Adds the size of the page in bytes.
wordcount
Adds the word count of the page.
timestamp
Adds the timestamp of when the page was last edited.
snippet
Adds a parsed snippet of the page.
titlesnippet
Adds a parsed snippet of the page title.
redirectsnippet
Adds a parsed snippet of the redirect title.
redirecttitle
Adds the title of the matching redirect.
sectionsnippet
Adds a parsed snippet of the matching section title.
sectiontitle
Adds the title of the matching section.
score
Deprecated and ignored.
hasrelated
Deprecated and ignored.
Values (separate with |): size, wordcount, timestamp, score, snippet, titlesnippet, redirecttitle, redirectsnippet, sectiontitle, sectionsnippet, hasrelated
Default: size|wordcount|timestamp|snippet
sroffset

When more results are available, use this to continue.

Default: 0
srlimit

How many total pages to return.

No more than 50 (500 for bots) allowed.
Default: 10
srinterwiki

Include interwiki results in the search, if available.

Examples:
Search for meaning.
api.php?action=query&list=search&srsearch=meaning
Search texts for meaning.
api.php?action=query&list=search&srwhat=text&srsearch=meaning
Ger page info about the pages returned for a search for meaning.
api.php?action=query&generator=search&gsrsearch=meaning&prop=info

list=tags (tg)

  • This module requires read rights.

List change tags.

Parameters:
tgcontinue

When more results are available, use this to continue.

tglimit

The maximum number of tags to list.

No more than 500 (5,000 for bots) allowed.
Default: 10
tgprop

Which properties to get:

name
Adds name of tag.
displayname
Adds system message for the tag.
description
Adds description of the tag.
hitcount
Adds the number of revisions and log entries that have this tag.
defined
Indicate whether the tag is defined.
source
Gets the sources of the tag, which may include extension for extension-defined tags and manual for tags that may be applied manually by users.
active
Whether the tag is still being applied.
Values (separate with |): name, displayname, description, hitcount, defined, source, active
Default: name

list=usercontribs (uc)

  • This module requires read rights.

Get all edits by a user.

Parameters:
uclimit

The maximum number of contributions to return.

No more than 500 (5,000 for bots) allowed.
Default: 10
ucstart

The start timestamp to return from.

ucend

The end timestamp to return to.

uccontinue

When more results are available, use this to continue.

ucuser

The users to retrieve contributions for.

Separate values with |. Maximum number of values is 50 (500 for bots).
ucuserprefix

Retrieve contributions for all users whose names begin with this value. Overrides ucuser.

ucdir

In which direction to enumerate:

newer
List oldest first. Note: ucstart has to be before ucend.
older
List newest first (default). Note: ucstart has to be later than ucend.
One value: newer, older
Default: older
ucnamespace

Only list contributions in these namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
ucprop

Include additional pieces of information:

ids
Adds the page ID and revision ID.
title
Adds the title and namespace ID of the page.
timestamp
Adds the timestamp of the edit.
comment
Adds the comment of the edit.
parsedcomment
Adds the parsed comment of the edit.
size
Adds the new size of the edit.
sizediff
Adds the size delta of the edit against its parent.
flags
Adds flags of the edit.
patrolled
Tags patrolled edits.
tags
Lists tags for the edit.
Values (separate with |): ids, title, timestamp, comment, parsedcomment, size, sizediff, flags, patrolled, tags
Default: ids|title|timestamp|comment|size|flags
ucshow

Show only items that meet these criteria, e.g. non minor edits only: ucshow=!minor.

If ucshow=patrolled or ucshow=!patrolled is set, revisions older than $wgRCMaxAge (7776000 seconds) won't be shown.

Values (separate with |): minor, !minor, patrolled, !patrolled, top, !top, new, !new
uctag

Only list revisions tagged with this tag.

uctoponly
Deprecated.

Only list changes which are the latest revision.

Examples:
Show contributions of user Example.
api.php?action=query&list=usercontribs&ucuser=Example
Show contributions from all IP addresses with prefix 192.0.2..
api.php?action=query&list=usercontribs&ucuserprefix=192.0.2.

list=users (us)

  • This module requires read rights.

Get information about a list of users.

Parameters:
usprop

Which pieces of information to include:

blockinfo
Tags if the user is blocked, by whom, and for what reason.
groups
Lists all the groups each user belongs to.
implicitgroups
Lists all the groups a user is automatically a member of.
rights
Lists all the rights each user has.
editcount
Adds the user's edit count.
registration
Adds the user's registration timestamp.
emailable
Tags if the user can and wants to receive email through Special:Emailuser.
gender
Tags the gender of the user. Returns "male", "female", or "unknown".
Values (separate with |): blockinfo, groups, implicitgroups, rights, editcount, registration, emailable, gender
ususers

A list of users to obtain information for.

Separate values with |. Maximum number of values is 50 (500 for bots).
ustoken
Deprecated.

Use action=query&meta=tokens instead.

Values (separate with |): userrights

list=watchlist (wl)

  • This module requires read rights.
  • This module can be used as a generator.

Get recent changes to pages in the current user's watchlist.

Parameters:
wlallrev

Include multiple revisions of the same page within given timeframe.

wlstart

The timestamp to start enumerating from.

wlend

The timestamp to end enumerating.

wlnamespace

Filter changes to only the given namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
wluser

Only list changes by this user.

wlexcludeuser

Don't list changes by this user.

wldir

In which direction to enumerate:

newer
List oldest first. Note: wlstart has to be before wlend.
older
List newest first (default). Note: wlstart has to be later than wlend.
One value: newer, older
Default: older
wllimit

How many total results to return per request.

No more than 500 (5,000 for bots) allowed.
Default: 10
wlprop

Which additional items to get:

ids
Adds revision IDs and page IDs.
title
Adds title of the page.
flags
Adds flags for the edit.
user
Adds the user who made the edit.
userid
Adds user ID of whom made the edit.
comment
Adds comment of the edit.
parsedcomment
Adds parsed comment of the edit.
timestamp
Adds timestamp of the edit.
patrol
Tags edits that are patrolled.
sizes
Adds the old and new lengths of the page.
notificationtimestamp
Adds timestamp of when the user was last notified about the edit.
loginfo
Adds log information where appropriate.
Values (separate with |): ids, title, flags, user, userid, comment, parsedcomment, timestamp, patrol, sizes, notificationtimestamp, loginfo
Default: ids|title|flags
wlshow

Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set wlshow=minor|!anon.

Values (separate with |): minor, !minor, bot, !bot, anon, !anon, patrolled, !patrolled, unread, !unread
wltype

Which types of changes to show:

edit
Regular page edits.
external
External changes.
new
Page creations.
log
Log entries.
Values (separate with |): edit, external, new, log
Default: edit|new|log
wlowner

Used along with wltoken to access a different user's watchlist.

wltoken

A security token (available in the user's preferences) to allow access to another user's watchlist.

wlcontinue

When more results are available, use this to continue.

Examples:
List the top revision for recently changed pages on the current user's watchlist.
api.php?action=query&list=watchlist
Fetch additional information about the top revision for recently changed pages on the current user's watchlist.
api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment
Fetch information about all recent changes to pages on the current user's watchlist.
api.php?action=query&list=watchlist&wlallrev=&wlprop=ids|title|timestamp|user|comment
Fetch page info for recently changed pages on the current user's watchlist.
api.php?action=query&generator=watchlist&prop=info
Fetch revision info for recent changes to pages on the current user's watchlist.
api.php?action=query&generator=watchlist&gwlallrev=&prop=revisions&rvprop=timestamp|user
List the top revision for recently changed pages on the watchlist of user Example.
api.php?action=query&list=watchlist&wlowner=Example&wltoken=123ABC

list=watchlistraw (wr)

  • This module requires read rights.
  • This module can be used as a generator.

Get all pages on the current user's watchlist.

Parameters:
wrcontinue

When more results are available, use this to continue.

wrnamespace

Only list pages in the given namespaces.

Values (separate with |): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 106, 107
wrlimit

How many total results to return per request.

No more than 500 (5,000 for bots) allowed.
Default: 10
wrprop

Which additional properties to get:

changed
Adds timestamp of when the user was last notified about the edit.
Values (separate with |): changed
wrshow

Only list items that meet these criteria.

Values (separate with |): changed, !changed
wrowner

Used along with wrtoken to access a different user's watchlist.

wrtoken

A security token (available in the user's preferences) to allow access to another user's watchlist.

wrdir

In which direction to enumerate:

newer
List oldest first. Note: wrstart has to be before wrend.
older
List newest first (default). Note: wrstart has to be later than wrend.
One value: ascending, descending
Default: ascending
Examples:
List pages on the current user's watchlist.
api.php?action=query&list=watchlistraw
Fetch page info for pages on the current user's watchlist.
api.php?action=query&generator=watchlistraw&gwrshow=changed&prop=info

meta=allmessages (am)

  • This module requires read rights.

Return messages from this site.

Parameters:
ammessages

Which messages to output. * (default) means all messages.

Separate values with |. Maximum number of values is 50 (500 for bots).
Default: *
amprop

Which properties to get.

Values (separate with |): default
amenableparser

Set to enable parser, will preprocess the wikitext of message (substitute magic words, handle templates, etc.).

amnocontent

If set, do not include the content of the messages in the output.

amincludelocal

Also include local messages, i.e. messages that don't exist in the software but do exist as a MediaWiki: page. This lists all MediaWiki: pages, so it will also list those that aren't really messages such as Common.js.

amargs

Arguments to be substituted into message.

Separate values with |. Maximum number of values is 50 (500 for bots).
amfilter

Return only messages with names that contain this string.

amcustomised

Return only messages in this customisation state.

One value: all, modified, unmodified
Default: all
amlang

Return messages in this language.

amfrom

Return messages starting at this message.

amto

Return messages ending at this message.

amtitle

Page name to use as context when parsing message (for amenableparser option).

amprefix

Return messages with this prefix.

Examples:
Show messages starting with ipb-.
api.php?action=query&meta=allmessages&amprefix=ipb-
Show messages august and mainpage in German.
api.php?action=query&meta=allmessages&ammessages=august|mainpage&amlang=de

meta=filerepoinfo (fri)

  • This module requires read rights.

Return meta information about image repositories configured on the wiki.

Parameter:
friprop

Which repository properties to get (there may be more available on some wikis):

apiurl
URL to the repository API - helpful for getting image info from the host.
name
The key of the repository - used in e.g. $wgForeignFileRepos and imageinfo return values.
displayname
The human-readable name of the repository wiki.
rooturl
Root URL for image paths.
local
Whether that repository is the local one or not.
Values (separate with |): name, displayname, rootUrl, local, url, thumbUrl, initialCapital, scriptDirUrl, scriptExtension, favicon
Default: name|displayname|rootUrl|local|url|thumbUrl|initialCapital|scriptDirUrl|scriptExtension|favicon
Example:
Get information about file repositories.
api.php?action=query&meta=filerepoinfo&friprop=apiurl|name|displayname

meta=siteinfo (si)

  • This module requires read rights.

Return general information about the site.

Parameters:
siprop

Which information to get:

general
Overall system information.
namespaces
List of registered namespaces and their canonical names.
namespacealiases
List of registered namespace aliases.
specialpagealiases
List of special page aliases.
magicwords
List of magic words and their aliases.
statistics
Returns site statistics.
interwikimap
Returns interwiki map (optionally filtered, optionally localised by using siinlanguagecode).
dbrepllag
Returns database server with the highest replication lag.
usergroups
Returns user groups and the associated permissions.
libraries
Returns libraries installed on the wiki.
extensions
Returns extensions installed on the wiki.
fileextensions
Returns list of file extensions allowed to be uploaded.
rightsinfo
Returns wiki rights (license) information if available.
restrictions
Returns information on available restriction (protection) types.
languages
Returns a list of languages MediaWiki supports (optionally localised by using siinlanguagecode).
skins
Returns a list of all enabled skins (optionally localised by using siinlanguagecode, otherwise in the content language).
extensiontags
Returns a list of parser extension tags.
functionhooks
Returns a list of parser function hooks.
showhooks
Returns a list of all subscribed hooks (contents of $wgHooks).
variables
Returns a list of variable IDs.
protocols
Returns a list of protocols that are allowed in external links.
defaultoptions
Returns the default values for user preferences.
Values (separate with |): general, namespaces, namespacealiases, specialpagealiases, magicwords, interwikimap, dbrepllag, statistics, usergroups, libraries, extensions, fileextensions, rightsinfo, restrictions, languages, skins, extensiontags, functionhooks, showhooks, variables, protocols, defaultoptions
Default: general
sifilteriw

Return only local or only nonlocal entries of the interwiki map.

One value: local, !local
sishowalldb

List all database servers, not just the one lagging the most.

sinumberingroup

Lists the number of users in user groups.

siinlanguagecode

Language code for localised language names (best effort) and skin names.

meta=tokens

  • This module requires read rights.

Gets tokens for data-modifying actions.

Parameter:
type

Types of token to request.

Values (separate with |): csrf, patrol, rollback, userrights, watch
Default: csrf
Examples:
Retrieve a csrf token (the default).
api.php?action=query&meta=tokens
Retrieve a watch token and a patrol token.
api.php?action=query&meta=tokens&type=watch|patrol

meta=userinfo (ui)

  • This module requires read rights.

Get information about the current user.

Parameter:
uiprop

Which pieces of information to include:

blockinfo
Tags if the current user is blocked, by whom, and for what reason.
hasmsg
Adds a tag message if the current user has pending messages.
groups
Lists all the groups the current user belongs to.
implicitgroups
Lists all the groups the current user is automatically a member of.
rights
Lists all the rights the current user has.
changeablegroups
Lists the groups the current user can add to and remove from.
options
Lists all preferences the current user has set.
preferencestoken
Deprecated. Get a token to change current user's preferences.
editcount
Adds the current user's edit count.
ratelimits
Lists all rate limits applying to the current user.
realname
Adds the user's real name.
email
Adds the user's email address and email authentication date.
acceptlang
Echoes the Accept-Language header sent by the client in a structured format.
registrationdate
Adds the user's registration date.
unreadcount
Adds the count of unread pages on the user's watchlist (maximum 999; returns 1000+ if more).
Values (separate with |): blockinfo, hasmsg, groups, implicitgroups, rights, changeablegroups, options, preferencestoken, editcount, ratelimits, email, realname, acceptlang, registrationdate, unreadcount
Examples:
Get information about the current user.
api.php?action=query&meta=userinfo
Get additional information about the current user.
api.php?action=query&meta=userinfo&uiprop=blockinfo|groups|rights|hasmsg

action=revisiondelete

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Delete and undelete revisions.

Parameters:
type

Type of revision deletion being performed.

This parameter is required.
One value: revision, archive, oldimage, filearchive, logging
target

Page title for the revision deletion, if required for the type.

ids

Identifiers for the revisions to be deleted.

This parameter is required.
Separate values with |. Maximum number of values is 50 (500 for bots).
hide

What to hide for each revision.

Values (separate with |): content, comment, user
show

What to unhide for each revision.

Values (separate with |): content, comment, user
suppress

Whether to suppress data from administrators as well as others.

One value: yes, no, nochange
Default: nochange
reason

Reason for the deletion or undeletion.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=rollback

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Undo the last edit to the page.

If the last user who edited the page made multiple edits in a row, they will all be rolled back.

Parameters:
title

Title of the page to roll back. Cannot be used together with pageid.

pageid

Page ID of the page to roll back. Cannot be used together with title.

user

Name of the user whose edits are to be rolled back.

This parameter is required.
summary

Custom edit summary. If empty, default summary will be used.

Default: (empty)
markbot

Mark the reverted edits and the revert as bot edits.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
token

A "rollback" token retrieved from action=query&meta=tokens

For compatibility, the token used in the web UI is also accepted.

This parameter is required.
Examples:
Roll back the last edits to page Main Page by user Example.
api.php?action=rollback&title=Main%20Page&user=Example&token=123ABC
Roll back the last edits to page Main Page by IP user 192.0.2.5 with summary Reverting vandalism, and mark those edits and the revert as bot edits.
api.php?action=rollback&title=Main%20Page&user=192.0.2.5&token=123ABC&summary=Reverting%20vandalism&markbot=1

action=rsd

(main | rsd)

Export an RSD (Really Simple Discovery) schema.

Example:
Export the RSD schema.
api.php?action=rsd

action=setnotificationtimestamp

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Update the notification timestamp for watched pages.

This affects the highlighting of changed pages in the watchlist and history, and the sending of email when the "Email me when a page on my watchlist is changed" preference is enabled.

Parameters:
entirewatchlist

Work on all watched pages.

timestamp

Timestamp to which to set the notification timestamp.

torevid

Revision to set the notification timestamp to (one page only).

newerthanrevid

Revision to set the notification timestamp newer than (one page only).

continue

When more results are available, use this to continue.

titles

A list of titles to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
pageids

A list of page IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
revids

A list of revision IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
generator

Get the list of pages to work on by executing the specified query module.

Note: Generator parameter names must be prefixed with a "g", see examples.

One value: allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, backlinks, categories, categorymembers, deletedrevisions, duplicatefiles, embeddedin, exturlusage, fileusage, images, imageusage, iwbacklinks, langbacklinks, links, linkshere, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, templates, transcludedin, watchlist, watchlistraw
redirects

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

converttitles

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz, zh.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Examples:
Reset the notification status for the entire watchlist.
api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC
Reset the notification status for Main page.
api.php?action=setnotificationtimestamp&titles=Main_page&token=123ABC
Set the notification timestamp for Main page so all edits since 1 January 2012 are unviewed.
api.php?action=setnotificationtimestamp&titles=Main_page&timestamp=2012-01-01T00:00:00Z&token=123ABC
Reset the notification status for pages in the User namespace.
api.php?action=setnotificationtimestamp&generator=allpages&gapnamespace=2&token=123ABC

action=sfautocomplete

  • This module requires read rights.

Autocompletion call used by the Semantic Forms extension (http://www.mediawiki.org/Extension:Semantic_Forms)

Parameters:
limit
(no description)
No more than 500 (5,000 for bots) allowed.
Default: 10
substr

Search substring

property

Semantic property for which to search values

category

Category for which to search values

concept

Concept for which to search values

cargo_table
(no description)
cargo_field
(no description)
field_is_array
(no description)
namespace

Namespace for which to search values

external_url

Alias for external URL from which to get values

baseprop

A previous property in the form to check against

base_cargo_table
(no description)
base_cargo_field
(no description)
basevalue

The value to check for the previous property

action=sfautoedit

  • This module requires read rights.
  • This module requires write rights.

This module is used to remotely create or edit pages using Semantic Forms.

Add "template-name[field-name]=field-value" to the query string parameter, to set the value for a specific field. To set values for more than one field use "&", or rather its URL encoded version "%26": "template-name[field-name-1]=field-value-1%26template-name[field-name-2]=field-value-2". See the first example below.

In addition to the query parameter, any parameter in the URL of the form "template-name[field-name]=field-value" will be treated as part of the query. See the second example.

Parameters:
form

The form to use.

target

The target page.

query

The query string.

preload

The name of a page to preload

Example:
With query parameter: api.php?action=sfautoedit&form=form-name&target=page-name&query=template-name[field-name-1]=field-value-1%26template-name[field-name-2]=field-value-2
api.php?Without query parameter: api.php?action=sfautoedit&form=form-name&target=page-name&template-name[field-name-1]=field-value-1&template-name[field-name-2]=field-value-2

action=stashedit

  • This module is internal or unstable. Its operation may change without notice.
  • This module requires read rights.
  • This module only accepts POST requests.
Parameters:
title
(no description)
This parameter is required.
section
(no description)
sectiontitle
(no description)
text
(no description)
This parameter is required.
contentmodel
(no description)
This parameter is required.
One value: wikitext, javascript, json, css, text
contentformat
(no description)
This parameter is required.
One value: text/x-wiki, text/javascript, application/json, text/css, text/plain
baserevid
(no description)
This parameter is required.
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=tag

(main | tag)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Add or remove change tags from individual revisions or log entries.

Parameters:
rcid

One or more recent changes IDs from which to add or remove the tag.

Separate values with |. Maximum number of values is 50 (500 for bots).
revid

One or more revision IDs from which to add or remove the tag.

Separate values with |. Maximum number of values is 50 (500 for bots).
logid

One or more log entry IDs from which to add or remove the tag.

Separate values with |. Maximum number of values is 50 (500 for bots).
add

Tags to add. Only manually defined tags can be added.

Values (separate with |):
remove

Tags to remove. Only tags that are either manually defined or completely undefined can be removed.

Separate values with |. Maximum number of values is 50 (500 for bots).
reason

Reason for the change.

Default: (empty)
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Examples:
Add the vandalism tag from revision ID 123 without specifying a reason
api.php?action=tag&revid=123&add=vandalism&token=123ABC
Remove the spam tag from log entry ID 123 with the reason Wrongly applied
api.php?action=tag&logid=123&remove=spam&reason=Wrongly+applied&token=123ABC

action=tokens

  • This module is deprecated.
  • This module requires read rights.

Get tokens for data-modifying actions.

This module is deprecated in favor of action=query&meta=tokens.

Parameter:
type

Types of token to request.

Values (separate with |): block, delete, edit, email, import, move, options, patrol, protect, unblock, watch
Default: edit
Examples:
Retrieve an edit token (the default).
api.php?action=tokens
Retrieve an email token and a move token.
api.php?action=tokens&type=email|move

action=unblock

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Unblock a user.

Parameters:
id

ID of the block to unblock (obtained through list=blocks). Cannot be used together with user.

user

Username, IP address or IP range to unblock. Cannot be used together with id.

reason

Reason for unblock.

Default: (empty)
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.
Examples:
Unblock block ID #105.
api.php?action=unblock&id=105
Unblock user Bob with reason Sorry Bob.
api.php?action=unblock&user=Bob&reason=Sorry%20Bob

action=undelete

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Restore revisions of a deleted page.

A list of deleted revisions (including timestamps) can be retrieved through list=deletedrevs, and a list of deleted file IDs can be retrieved through list=filearchive.

Parameters:
title

Title of the page to restore.

This parameter is required.
reason

Reason for restoring.

Default: (empty)
timestamps

Timestamps of the revisions to restore. If both timestamps and fileids are empty, all will be restored.

Separate values with |. Maximum number of values is 50 (500 for bots).
fileids

IDs of the file revisions to restore. If both timestamps and fileids are empty, all will be restored.

Separate values with |. Maximum number of values is 50 (500 for bots).
watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, unwatch, preferences, nochange
Default: preferences
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=upload

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Upload a file, or get the status of pending uploads.

Several methods are available:

  • Upload file contents directly, using the file parameter.
  • Upload the file in pieces, using the filesize, chunk, and offset parameters.* Have the MediaWiki server fetch a file from a URL, using the url parameter.
  • Complete an earlier upload that failed due to warnings, using the filekey parameter.

Note that the HTTP POST must be done as a file upload (i.e. using multipart/form-data) when sending the file.

Parameters:
filename

Target filename.

comment

Upload comment. Also used as the initial page text for new files if text is not specified.

Default: (empty)
text

Initial page text for new files.

watch
Deprecated.

Watch the page.

watchlist

Unconditionally add or remove the page from the current user's watchlist, use preferences or do not change watch.

One value: watch, preferences, nochange
Default: preferences
ignorewarnings

Ignore any warnings.

file

File contents.

Must be posted as a file upload using multipart/form-data.
url

URL to fetch the file from.

filekey

Key that identifies a previous upload that was stashed temporarily.

sessionkey
Deprecated.

Same as filekey, maintained for backward compatibility.

stash

If set, the server will stash the file temporarily instead of adding it to the repository.

filesize

Filesize of entire upload.

offset

Offset of chunk in bytes.

chunk

Chunk contents.

Must be posted as a file upload using multipart/form-data.
async

Make potentially large file operations asynchronous when possible.

asyncdownload

Make fetching a URL asynchronous.

leavemessage

If asyncdownload is used, leave a message on the user talk page if finished.

statuskey

Fetch the upload status for this file key (upload by URL).

checkstatus

Only fetch the upload status for the given file key.

token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.

action=userrights

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Change a user's group membership.

Parameters:
user

User name.

userid

User ID.

add

Add the user to these groups.

Values (separate with |): bot, sysop, bureaucrat
remove

Remove the user from these groups.

Values (separate with |): bot, sysop, bureaucrat
reason

Reason for the change.

Default: (empty)
token

A "userrights" token retrieved from action=query&meta=tokens

For compatibility, the token used in the web UI is also accepted.

This parameter is required.
Examples:
Add user FooBot to group bot, and remove from groups sysop and bureaucrat.
api.php?action=userrights&user=FooBot&add=bot&remove=sysop|bureaucrat&token=123ABC
Add the user with ID 123 to group bot, and remove from groups sysop and bureaucrat.
api.php?action=userrights&userid=123&add=bot&remove=sysop|bureaucrat&token=123ABC

action=watch

  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.

Add or remove pages from the current user's watchlist.

Parameters:
title
Deprecated.

The page to (un)watch. Use titles instead.

unwatch

If set the page will be unwatched rather than watched.

continue

When more results are available, use this to continue.

titles

A list of titles to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
pageids

A list of page IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
revids

A list of revision IDs to work on.

Separate values with |. Maximum number of values is 50 (500 for bots).
generator

Get the list of pages to work on by executing the specified query module.

Note: Generator parameter names must be prefixed with a "g", see examples.

One value: allcategories, alldeletedrevisions, allfileusages, allimages, alllinks, allpages, allredirects, alltransclusions, backlinks, categories, categorymembers, deletedrevisions, duplicatefiles, embeddedin, exturlusage, fileusage, images, imageusage, iwbacklinks, langbacklinks, links, linkshere, pageswithprop, prefixsearch, protectedtitles, querypage, random, recentchanges, redirects, revisions, search, templates, transcludedin, watchlist, watchlistraw
redirects

Automatically resolve redirects in titles, pageids, and revids, and in pages returned by generator.

converttitles

Convert titles to other variants if necessary. Only works if the wiki's content language supports variant conversion. Languages that support variant conversion include gan, iu, kk, ku, shi, sr, tg, uz, zh.

token

A "watch" token retrieved from action=query&meta=tokens

This parameter is required.

format=dbg

(main | dbg)
  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's var_export() format.

Example:
Format the query result in the DBG format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=dbg

format=dbgfm

  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's var_export() format (pretty-print in HTML).

Example:
Format the query result in the DBG format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=dbgfm

format=dump

  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's var_dump() format.

Example:
Format the query result in the DUMP format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=dump

format=dumpfm

  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's var_dump() format (pretty-print in HTML).

Example:
Format the query result in the DUMP format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=dumpfm

format=json

  • This module requires read rights.

Output data in JSON format.

Parameters:
callback

If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.

utf8

If specified, encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default when formatversion is not 1.

ascii

If specified, encodes all non-ASCII using hexadecimal escape sequences. Default when formatversion is 1.

formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the JSON format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=json

format=jsonfm

  • This module requires read rights.

Output data in JSON format (pretty-print in HTML).

Parameters:
callback

If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.

utf8

If specified, encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default when formatversion is not 1.

ascii

If specified, encodes all non-ASCII using hexadecimal escape sequences. Default when formatversion is 1.

formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the JSON format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=jsonfm

format=none

  • This module requires read rights.

Output nothing.

Example:
Format the query result in the NONE format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=none

format=php

(main | php)
  • This module requires read rights.

Output data in serialized PHP format.

Parameter:
formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the PHP format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=php

format=phpfm

  • This module requires read rights.

Output data in serialized PHP format (pretty-print in HTML).

Parameter:
formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the PHP format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=phpfm

format=rawfm

  • This module requires read rights.

Output data with the debugging elements in JSON format (pretty-print in HTML).

Example:
Format the query result in the RAW format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=rawfm

format=txt

(main | txt)
  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's print_r() format.

Example:
Format the query result in the TXT format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=txt

format=txtfm

  • This module is deprecated.
  • This module requires read rights.

Output data in PHP's print_r() format (pretty-print in HTML).

Example:
Format the query result in the TXT format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=txtfm

format=wddx

  • This module is deprecated.
  • This module requires read rights.

Output data in WDDX format.

Example:
Format the query result in the WDDX format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=wddx

format=wddxfm

  • This module is deprecated.
  • This module requires read rights.

Output data in WDDX format (pretty-print in HTML).

Example:
Format the query result in the WDDX format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=wddxfm

format=xml

(main | xml)
  • This module requires read rights.

Output data in XML format.

Parameters:
xslt

If specified, adds the named page as an XSL stylesheet. The value must be a title in the MediaWiki namespace ending in .xsl.

includexmlnamespace

If specified, adds an XML namespace.

Example:
Format the query result in the XML format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml

format=xmlfm

  • This module requires read rights.

Output data in XML format (pretty-print in HTML).

Parameters:
xslt

If specified, adds the named page as an XSL stylesheet. The value must be a title in the MediaWiki namespace ending in .xsl.

includexmlnamespace

If specified, adds an XML namespace.

Example:
Format the query result in the XML format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=xmlfm

format=yaml

  • This module is deprecated.
  • This module requires read rights.

Output data in YAML format.

Parameters:
callback

If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.

utf8

If specified, encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default when formatversion is not 1.

ascii

If specified, encodes all non-ASCII using hexadecimal escape sequences. Default when formatversion is 1.

formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the YAML format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=yaml

format=yamlfm

  • This module is deprecated.
  • This module requires read rights.

Output data in YAML format (pretty-print in HTML).

Parameters:
callback

If specified, wraps the output into a given function call. For safety, all user-specific data will be restricted.

utf8

If specified, encodes most (but not all) non-ASCII characters as UTF-8 instead of replacing them with hexadecimal escape sequences. Default when formatversion is not 1.

ascii

If specified, encodes all non-ASCII using hexadecimal escape sequences. Default when formatversion is 1.

formatversion

Output formatting:

1
Backwards-compatible format (XML-style booleans, * keys for content nodes, etc.).
2
Experimental modern format. Details may change!
latest
Use the latest format (currently 2), may change without warning.
One value: 1, 2, latest
Default: 1
Example:
Format the query result in the YAML format.
api.php?action=query&meta=siteinfo&siprop=namespaces&format=yamlfm

Credits

API developers:

  • Roan Kattouw (lead developer Sep 2007–2009)
  • Victor Vasiliev
  • Bryan Tong Minh
  • Sam Reed
  • Yuri Astrakhan (creator, lead developer Sep 2006–Sep 2007)
  • Brad Jorsch (lead developer 2013–present)

Please send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org or file a bug report at https://phabricator.wikimedia.org/.