The MediaWiki Action API is a web service that allows access to some wiki-features like authentication, page operations, and search. It can provide meta information about the wiki and the logged-in user.
Status: The MediaWiki API is a mature and stable interface that is actively supported and improved. While we try to avoid it, we may occasionally need to make breaking changes; 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.
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.
Set the s-maxage HTTP cache control header to this many seconds. Errors are never cached.
Set the max-age HTTP cache control header to this many seconds. Errors are never cached.
Verify that the user is logged in if set to user, not logged in if set to anon, or has the bot user right if bot.
One of the following values: anon, bot, user
Verify the current user is the named user.
Type: user, by user name
Any value given here will be included in the response. May be used to distinguish requests.
Include the hostname that served the request in the results.
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).
For authenticated requests, 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 allowed, the Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers will be set.
For non-authenticated requests, specify the value *. This will cause the Access-Control-Allow-Origin header to be set, but Access-Control-Allow-Credentials will be false and all user-specific data will be restricted.
Language to use for message translations. action=query&meta=siteinfo with siprop=languages returns a list of language codes, or specify user to use the current user's language preference, or specify content to use this wiki's content language.
Variant of the language. Only works if the base language supports variant conversion.
Format to use for warning and error text output
Wikitext with HTML tags removed and entities replaced.
Message key and parameters.
No text output, only the error codes.
Format used prior to MediaWiki 1.29. errorlang and errorsuselocal are ignored.
One of the following values: bc, html, none, plaintext, raw, wikitext
Language to use for warnings and errors. action=query&meta=siteinfo with siprop=languages returns a list of language codes, or specify content to use this wiki's content language, or specify uselang to use the same value as the uselang parameter.
If given, error texts will use locally-customized messages from the MediaWiki namespace.
When accessing the API using a cross-domain AJAX request (CORS), use this to authenticate as the current SUL user. Use action=centralauthtoken on this wiki to retrieve the token, before making the CORS request. Each token may only be used once, and expires after 10 seconds. This should be included in any pre-flight request, and therefore should be included in the request URI (not the POST body).
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 and sysop
If you do not find what you are looking for in this API documentation, there are many other APIs related to Wikimedia projects.See the Web APIs hub for information on other APIs for Wikimedia project data and their usage.
For the REST API included with MediaWiki 1.35 and later, see API:REST API.