API:REST API

The MediaWiki REST API provides access to wiki content and functionality in apps and on the web. Like most web APIs, the MediaWiki REST API accepts HTTP requests at unique URLs and returns structured data. You can use the REST API to build apps that:


 * Display content from a wiki
 * Visualize information about wiki history

Data format
The REST API returns all data as JSON. Page content is available as HTML within JSON-formatted responses.

Methods
The REST API supports standard HTTP request methods like GET, HEAD, POST, and DELETE.

URL structure
API endpoints share a consistent URL structure that includes the wiki's base URL and the API version.

Endpoints

 * History API: Explore page history, compare revisions, get page HTML. (Available in MediaWiki 1.35 and later)

Versioning
Following semantic versioning principles, the API major version increments in the event of breaking changes: changes to an endpoint that are incompatible with the previous version, such as removing an endpoint or changing a request structure in a backwards-incompatible way. Parameters, response types, and response codes are guaranteed to be backwards compatible within a major version. The API minor version increments for backwards-compatible changes, such as adding an endpoint or adding an attribute to a response body. The major version is included in the API path (for example: ); the minor version is listed in the documentation only.

Accessing Wikimedia projects using the REST API
The REST API is disabled on all Wikimedia wikis, including Wikipedia, Wikivoyage, and Wiktionary. To start experimenting with the API, we recommend using a test wiki populated with a data dump.

Developers can expect to authenticate API requests to Wikimedia projects using OAuth 1.0 tokens and secrets. To learn about registering an application and making requests on behalf of users, see the OAuth developer guide.

Enabling the REST API on your wiki
The REST API is available in MediaWiki 1.34 and later as disabled by default. To enable the REST API on your wiki, add  to.

Extension endpoints
MediaWiki extensions can surface extension-specific API endpoints using the REST API interface. For documentation for REST API endpoints provided by extensions, see the extension docs. The REST API extension interface is available in MediaWiki 1.34 and later.

Other APIs
There are two families of REST APIs related to Wikimedia projects: the MediaWiki REST API described on this page and the REST API built on RESTBase. While the MediaWiki REST API is part of the MediaWiki platform and can be enabled on any wiki running MediaWiki 1.34 or later, the RESTBase API serves content specific to Wikimedia projects. If you're looking for the full-featured, RPC-style MediaWiki API, see the Action API.