Skip to main content
The Pages API provides endpoints for reading page content in multiple formats, browsing revision history, listing links, and creating or updating pages. All endpoints are served under /w/rest.php/v1/page/.

GET /v1/page/{title}

Returns the latest revision’s wikitext source, metadata, and license information for a page.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth

Path parameters

title
string
required
The page title, URL-encoded. Use underscores instead of spaces (e.g., Talk:Main_Page).

Response

id
integer
required
The page ID.
key
string
required
The page title in URL-key form (with underscores).
title
string
required
The page title with spaces as it appears on the wiki.
latest
object
required
Information about the most recent revision.
content_model
string
required
The content model identifier (e.g., wikitext, json, css).
license
object
required
The license under which this page’s content is available.
source
string
required
The raw wikitext source of the latest revision.
redirect_target
string
Present only when the page is a redirect and the redirect=no query parameter was passed. Contains the URL of the redirect target.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth

GET /v1/page/{title}/bare

Returns page metadata without the wikitext source, plus a URL pointing to the HTML representation. Useful for clients that need only page identity and a pointer to rendered content.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/bare

Path parameters

title
string
required
The page title, URL-encoded.

Response

id
integer
required
The page ID.
key
string
required
The page title in URL-key form.
title
string
required
The page title with spaces.
latest
object
required
Latest revision ID and timestamp.
content_model
string
required
The content model identifier.
license
object
required
License URL and title.
html_url
string
required
The URL from which the Parsoid HTML for this page can be fetched (points to the /html endpoint).
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/bare

GET /v1/page/{title}/html

Returns the Parsoid HTML for the latest revision of a page. The response body is text/html, not JSON.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/html

Path parameters

title
string
required
The page title, URL-encoded.

Headers

Accept-Language
string
A BCP 47 language tag for variant conversion (e.g., zh-hans for Simplified Chinese). When provided, the HTML is variant-converted before being returned.
The response is text/html, not JSON. The HTML is produced by Parsoid and conforms to the MediaWiki Parsoid HTML specification.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/html

GET /v1/page/{title}/with_html

Returns the same metadata as /v1/page/{title} (without the source field) combined with the Parsoid HTML in a single JSON response.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/with_html

Path parameters

title
string
required
The page title, URL-encoded.

Response

Same fields as the /bare endpoint, plus:
html
string
required
The full Parsoid HTML of the page as a string.
redirect_target
string
Present only when the page is a redirect and redirect=no was passed.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/with_html

GET /v1/page/{title}/history

Returns up to 20 revisions of a page per request, ordered from newest to oldest by default. Supports cursor-based pagination and optional filtering by revision type.
curl "https://en.wikipedia.org/w/rest.php/v1/page/Earth/history"

Path parameters

title
string
required
The page title, URL-encoded.

Query parameters

older_than
integer
Return revisions older than this revision ID. Cannot be combined with newer_than.
newer_than
integer
Return revisions newer than this revision ID. Cannot be combined with older_than.
filter
string
Limit results to revisions of a specific type. One of: anonymous, bot, reverted, minor.

Response

revisions
array
required
Up to 20 revision objects, each containing:
latest
string
required
URL to this endpoint without pagination parameters (the canonical URL for this page’s history).
older
string
URL to fetch the next (older) page of results. Absent when there are no older revisions.
newer
string
URL to fetch the previous (newer) page of results. Absent when there are no newer revisions.
curl "https://en.wikipedia.org/w/rest.php/v1/page/Earth/history"

GET /v1/page/{title}/history/counts/{type}

Returns a count of revisions of the specified type. Counts are capped at a type-specific maximum and cached.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/history/counts/edits

Path parameters

title
string
required
The page title, URL-encoded.
type
string
required
The type of revision to count. One of: anonymous, temporary, bot, editors, edits, minor, reverted.

Query parameters

from
integer
Count revisions starting from this revision ID (inclusive). Only valid for edits and editors types; both from and to must be provided together.
to
integer
Count revisions up to this revision ID (inclusive). Only valid for edits and editors types.

Response

count
integer
required
The count of revisions. Capped at a maximum that varies by type (e.g., 30,000 for edits, 25,000 for editors, 1,000 for minor).
limit
boolean
required
true when the actual count exceeds the maximum and the returned count is the cap value.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/history/counts/edits

GET /v1/page/{title}/links/language

Returns all interlanguage links for a page — links to the same topic in other language wikis.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/links/language

Path parameters

title
string
required
The page title, URL-encoded.

Response

An array of language link objects, ordered by language code:
code
string
BCP 47 language code (e.g., fr, de, zh).
name
string
The language name in the content language of the current wiki.
key
string
The page title in the target wiki in DB-key form (with underscores).
title
string
The page title in the target wiki with spaces.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/links/language

GET /v1/page/{title}/links/media

Returns a list of media files (images, videos, audio files) used on the page.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/links/media

Path parameters

title
string
required
The page title, URL-encoded.

Response

See the Files API for the structure of individual file objects. The response is an array of file metadata objects.
curl https://en.wikipedia.org/w/rest.php/v1/page/Earth/links/media

PUT /v1/page/{title}

Creates a new page or updates an existing one by replacing its wikitext. Requires authentication.
To update an existing page without overwriting concurrent edits, provide the latest.id field in the request body. Omitting it causes the request to behave as a creation-only operation; if the page already exists, a 409 Conflict is returned.
curl -X PUT \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"source": "Hello, world!", "comment": "Initial content", "content_model": "wikitext"}' \
  https://example.wiki/w/rest.php/v1/page/My_New_Page

Path parameters

title
string
required
The page title to create or update, URL-encoded.

Body parameters

source
string
required
The full wikitext source for the new revision.
comment
string
required
The edit summary.
content_model
string
The content model for the page (e.g., wikitext, json). Defaults to the page’s existing content model or wikitext for new pages.
latest
object
Must be provided when updating an existing page. Contains id (integer) — the revision ID the edit is based on. If the page has been edited since this revision, a 409 Conflict edit-conflict response is returned.
token
string
Required when authenticating with cookies. Retrieve via action=query&meta=tokens. Not required when using OAuth.

Response

On success, returns the same structure as GET /v1/page/{title} (page source and metadata) with HTTP 200 for an update or 201 for a creation.
curl -X PUT \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"source": "This is the page content.", "comment": "Creating page"}' \
  https://example.wiki/w/rest.php/v1/page/New_Page

POST /v1/page

Creates a new page. Returns 409 Conflict if a page with the given title already exists. Requires authentication.
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title": "My New Page", "source": "Page content here.", "comment": "Creating new page"}' \
  https://example.wiki/w/rest.php/v1/page

Body parameters

title
string
required
The title of the page to create.
source
string
required
The full wikitext source for the new page.
comment
string
required
The edit summary for the creation.
content_model
string
The content model for the new page. Defaults to wikitext.
token
string
Required when authenticating with cookies. Not required when using OAuth.

Response

On success, returns HTTP 201 Created with the page source and metadata (same structure as GET /v1/page/{title}), plus a Location response header pointing to the newly created page’s canonical REST URL.
curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title": "My New Page", "source": "Hello, wiki!", "comment": "First edit"}' \
  https://example.wiki/w/rest.php/v1/page

Build docs developers (and LLMs) love