action=query is the main read interface of the MediaWiki Action API. It is implemented in ApiQuery and works by assembling a set of pages (the page set) and then running one or more sub-modules against that set to collect data.
Query sub-modules come in three types:
| Type | Parameter | Purpose |
|---|---|---|
| prop | prop= | Retrieve properties of the pages in the page set |
| list | list= | Enumerate items from an index (not page-specific) |
| meta | meta= | Return information about the wiki or the current session |
Specifying pages
The page set is populated through one of these mutually exclusive parameters:Pipe-separated list of page titles. E.g.,
titles=MediaWiki|Help:Contents.Pipe-separated list of page IDs. E.g.,
pageids=1|2|3.Pipe-separated list of revision IDs. Resolves to the pages those revisions belong to.
apihighlimits right, typically bots and sysops).
Prop modules
Prop modules attach data to each page in the page set. They are passed as a pipe-separated list inprop=.
revisions
Fetches revision data for each page. Returns the most recent revision by default.rvprop values:
| Value | Description |
|---|---|
ids | Revision ID and parent revision ID |
flags | Minor-edit flag |
timestamp | Timestamp of the revision |
user | Username of the editor |
userid | User ID of the editor |
comment | Edit summary |
parsedcomment | Edit summary rendered as HTML |
content | Full wikitext of the revision (expensive; use with care) |
tags | Change tags applied to the revision |
roles | Slot roles present in the revision |
sha1 | SHA-1 hash of the revision content |
size | Size of the revision in bytes |
info
Returns basic page information: namespace, last-edit timestamp, page ID, talk page, redirect target, protection levels, and more. Implemented inApiQueryInfo.
categories
Lists the categories a page belongs to.links
Lists all internal wiki links on a page.images
Lists all files (images, audio, etc.) embedded on a page.templates
Lists all templates transcluded on a page.imageinfo
Returns file metadata for each file page in the page set: dimensions, MIME type, upload timestamp, uploader, SHA-1 hash, and URLs.pageprops
Returns key-value pairs stored as page properties (e.g.,wikibase_item for Wikidata entity IDs, defaultsort for sort keys).
extlinks
Lists all external URLs present in the page’s wikitext.langlinks
Lists interlanguage links on the page.contributors
Returns the list of non-anonymous editors who have contributed to the page.deletedrevisions
Lists deleted revisions for the specified pages. Requires thedeletedhistory permission.
List modules
List modules enumerate items from database indexes. They are passed inlist=.
allpages
Enumerates all pages in a given namespace.allrevisions
Enumerates all revisions (across all pages), filterable by user, namespace, and date range.recentchanges
Returns recent changes to the wiki, equivalent toSpecial:RecentChanges.
watchlist
Returns recent changes to pages on the authenticated user’s watchlist. Requires authentication.categorymembers
Lists all pages in a given category.search
Performs a full-text search.logevents
Enumerates log entries (move, delete, protect, block, etc.).usercontribs
Returns all edits made by a specific user.blocks
Lists active blocks.allcategories
Enumerates all categories on the wiki.allusers
Enumerates registered user accounts.backlinks / embeddedin / imageusage
Return pages that link to, transclude, or use a given page or file.Meta modules
Meta modules return information about the wiki or the current session. They are passed inmeta=.
siteinfo
Returns wiki-wide configuration. Implemented inApiQuerySiteinfo.
siprop values: general, namespaces, namespacealias, specialpagealiases, statistics, skins, extensiontags, usergroups, libraries, extensions, fileextensions, rightsinfo, interwikimap.
userinfo
Returns information about the currently authenticated user: username, user ID, groups, rights, email address, edit count, and preferences.tokens
Returns security tokens required for write operations. See the Edit API and Authentication pages for usage. Token types (fromApiQueryTokens): csrf, watch, patrol, rollback, userrights, login, createaccount.
authmanagerinfo
Returns information about the available authentication providers — useful before initiating aclientlogin flow.
Continuation
When a query returns more results than the limit, the response includes acontinue object. Pass all key-value pairs from continue back to the next request to retrieve the next page of results.
Always iterate using the
continue object wholesale — do not attempt to manually construct continuation parameters. The keys and values in continue are opaque and may change between MediaWiki versions.Generator pattern
A generator turns a list module into a page-set source, feeding its results as input to prop modules. This avoids a two-step request (first list pages, then query properties for each). Prefix the list module name withgenerator= and its parameters with g:
Category:MediaWiki category in a single request.
Common query patterns
Get wikitext content of a page
The raw wikitext of the page’s main slot.
Get the latest revision ID
Check whether pages exist
"missing": true in formatversion=2.
