Wikipedia / MediaWiki Transforms API

Wikitext HTML transformation

OpenAPI Specification

wikipedia-transforms-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: MediaWiki Action articles Transforms API
  description: 'The MediaWiki Action API is the original programmatic interface to MediaWiki, exposed under /w/api.php on every MediaWiki installation. All operations dispatch via the ?action= query parameter. The API supports JSON, XML, and PHP serialization; JSON is the recommended format.


    Wikimedia projects strongly recommend serial (not parallel) calls, the use of maxlag for non-interactive jobs, and a contactable User-Agent header. The Action API remains the primary write interface (edit, upload, login, patrol) even where the Core REST API is also available.'
  version: '1.45'
  x-generated-from: documentation
  x-source-url: https://www.mediawiki.org/wiki/API:Main_page
  x-last-validated: '2026-05-29'
  contact:
    name: Wikimedia Foundation
    url: https://www.mediawiki.org/wiki/API:Etiquette
  license:
    name: CC BY-SA 4.0
    url: https://creativecommons.org/licenses/by-sa/4.0/
servers:
- url: https://en.wikipedia.org/w
  description: English Wikipedia
- url: https://{lang}.wikipedia.org/w
  description: Per-language Wikipedia
  variables:
    lang:
      default: en
      description: Language code
- url: https://commons.wikimedia.org/w
  description: Wikimedia Commons
- url: https://www.wikidata.org/w
  description: Wikidata
- url: https://www.mediawiki.org/w
  description: MediaWiki.org
tags:
- name: Transforms
  description: Wikitext <-> HTML transformation
paths:
  /transform/wikitext/to/html/{title}:
    post:
      operationId: transformWikitextToHtml
      summary: MediaWiki Core REST Transform Wikitext to HTML
      description: Convert wikitext into rendered HTML in the context of a given title.
      tags:
      - Transforms
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
      parameters:
      - name: title
        in: path
        required: true
        schema:
          type: string
        description: URL-encoded page title
        example: Earth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  example: '''''''Hello, world.'''''''
                body_only:
                  type: boolean
      responses:
        '200':
          description: HTML output
          content:
            text/html:
              schema:
                type: string
  /transform/html/to/wikitext/{title}:
    post:
      operationId: transformHtmlToWikitext
      summary: MediaWiki Core REST Transform HTML to Wikitext
      description: Convert HTML into wikitext in the context of a given title.
      tags:
      - Transforms
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
      parameters:
      - name: title
        in: path
        required: true
        schema:
          type: string
        description: URL-encoded page title
        example: Earth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - html
              properties:
                html:
                  type: string
                body_only:
                  type: boolean
      responses:
        '200':
          description: Wikitext output
          content:
            text/plain:
              schema:
                type: string
  /transform/wikitext/to/lint/{title}:
    post:
      operationId: transformWikitextToLint
      summary: MediaWiki Core REST Lint Wikitext for Errors
      description: Identify lint errors in wikitext (e.g. broken HTML, deprecated syntax).
      tags:
      - Transforms
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
      parameters:
      - name: title
        in: path
        required: true
        schema:
          type: string
        description: URL-encoded page title
        example: Earth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
      responses:
        '200':
          description: List of lint errors
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
  /transform/html/to/wikitext:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Transform HTML to Wikitext
      description: 'Transform [Parsoid HTML](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec)

        to Wikitext.


        When converting pre-existing (possibly modified) content, you should

        pass in the `title`, `revision`, and `If-Match` header. This lets

        [Parsoid](https://www.mediawiki.org/wiki/Parsoid) preserve small

        syntactic variations in wikitext, which ensures that diffs are

        readable.


        - Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)

        - Rate limit: 25 req/s

        '
      parameters:
      - name: if-match
        in: header
        description: 'The `ETag` header of the original render indicating it''s revision and timeuuid.

          Required if both `title` and `revision` parameters are present.

          '
        schema:
          type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - html
              properties:
                html:
                  type: string
                  description: The HTML to transform
                  x-textarea: true
                scrub_wikitext:
                  type: boolean
                  description: Normalise the DOM to yield cleaner wikitext?
        required: true
      responses:
        '200':
          description: MediaWiki Wikitext.
          content:
            text/plain; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/wikitext/1.0.0":
              schema:
                type: string
        '403':
          description: Access to the specific revision is restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '404':
          description: Unknown page title or revision
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/html/to/wikitext/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Transform HTML to Wikitext
      description: 'Transform [Parsoid HTML](https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec)

        to Wikitext.


        When converting pre-existing (possibly modified) content, you should

        pass in the `title`, `revision`, and `If-Match` header. This lets

        [Parsoid](https://www.mediawiki.org/wiki/Parsoid) preserve small

        syntactic variations in wikitext, which ensures that diffs are

        readable.


        - Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)

        - Rate limit: 25 req/s

        '
      parameters:
      - name: title
        in: path
        description: 'Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.'
        required: true
        schema:
          type: string
      - name: revision
        in: path
        description: The page revision
        required: true
        schema:
          type: integer
      - name: if-match
        in: header
        description: 'The `ETag` header of the original render indicating it''s revision and timeuuid.

          Required if both `title` and `revision` parameters are present.

          '
        schema:
          type: string
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - html
              properties:
                html:
                  type: string
                  description: The HTML to transform
                  x-textarea: true
                scrub_wikitext:
                  type: boolean
                  description: Normalise the DOM to yield cleaner wikitext?
        required: true
      responses:
        '200':
          description: MediaWiki Wikitext.
          content:
            text/plain; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/wikitext/1.0.0":
              schema:
                type: string
        '403':
          description: Access to the specific revision is restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '404':
          description: Unknown page title or revision
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/wikitext/to/html:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Transform Wikitext to HTML
      description: 'Transform wikitext to HTML. Note that if you set `stash: true`, you

        also need to supply the title.


        - Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)

        - Rate limit: 25 req/s (5 req/s when `stash: true`)

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to transform to HTML
                  x-textarea: true
                body_only:
                  type: boolean
                  description: Return only `body.innerHTML`
                stash:
                  type: boolean
                  description: Whether to temporarily stash the result of the transformation
        required: true
      responses:
        '200':
          description: See wikipage https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec
          content:
            text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.1.0":
              schema:
                type: string
        '403':
          description: access to the specific revision is restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '404':
          description: Unknown page title or revision
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/wikitext/to/html/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Transform Wikitext to HTML
      description: 'Transform wikitext to HTML. Note that if you set `stash: true`, you

        also need to supply the title.


        - Stability: [stable](https://www.mediawiki.org/wiki/API_versioning#Stable)

        - Rate limit: 25 req/s (5 req/s when `stash: true`)

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to transform to HTML
                  x-textarea: true
                body_only:
                  type: boolean
                  description: Return only `body.innerHTML`
                stash:
                  type: boolean
                  description: Whether to temporarily stash the result of the transformation
        required: true
      responses:
        '200':
          description: See wikipage https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec
          content:
            text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/2.1.0":
              schema:
                type: string
        '403':
          description: access to the specific revision is restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '404':
          description: Unknown page title or revision
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      parameters:
      - name: title
        in: path
        description: 'Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.'
        required: true
        schema:
          type: string
      - name: revision
        in: path
        description: The page revision
        required: true
        schema:
          type: integer
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/wikitext/to/lint:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Check Wikitext for Lint Errors
      description: 'Parse the supplied wikitext and check it for lint errors.


        - Stability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)

        - Rate limit: 25 req/s

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to check
                  x-textarea: true
          application/json:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to check
                  x-textarea: true
        required: true
      responses:
        '200':
          description: Linter errors, if any, as a JSON blob
          content:
            application/json:
              schema:
                type: object
        '404':
          description: Unknown page title
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Latest revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/wikitext/to/lint/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Check Wikitext for Lint Errors
      description: 'Parse the supplied wikitext and check it for lint errors.


        - Stability: [experimental](https://www.mediawiki.org/wiki/API_versioning#Experimental)

        - Rate limit: 25 req/s

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to check
                  x-textarea: true
        required: true
      responses:
        '200':
          description: Linter errors, if any, as a JSON blob
          content:
            application/json:
              schema:
                type: object
        '404':
          description: Unknown page title
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '409':
          description: Latest revision was restricted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        '410':
          description: Page was deleted
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      x-monitor: false
      parameters:
      - name: title
        in: path
        description: 'Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.'
        required: true
        schema:
          type: string
      - name: revision
        in: path
        description: The page revision
        required: true
        schema:
          type: integer
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /transform/wikitext/to/mobile-html/{title}:
    post:
      tags:
      - Transforms
      summary: Wikimedia REST Transform Wikitext to Mobile HTML
      description: 'Transform wikitext to Mobile HTML.


        - Stability: [stable](https://www.mediawiki.org/wiki/Wikimedia_Product/Wikimedia_Product_Infrastructure_team/API_endpoint_stability_policy#Stable)

        - Rate limit: 25 req/s (5 req/s when `stash: true`)


        Please follow [wikitech-l](https://lists.wikimedia.org/mailman/listinfo/wikitech-l) or [mediawiki-api-announce](https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce) for announcements of breaking changes.

        '
      parameters:
      - name: title
        in: path
        description: 'Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.'
        required: true
        schema:
          type: string
      - name: Accept-Language
        in: header
        description: 'The desired language variant code for wikis where LanguageConverter is enabled. Example: `sr-el` for Latin transcription of the Serbian language.

          '
        schema:
          type: string
      - name: output-mode
        in: header
        description: Output mode for mobile-html. Default is `editPreview`.
        required: false
        schema:
          type: string
          enum:
          - editPreview
          - contentAndReferences
          - content
          - references
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - wikitext
              properties:
                wikitext:
                  type: string
                  description: The Wikitext to transform to HTML
                  x-textarea: true
        required: true
      responses:
        '200':
          description: See wikipage https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec
          content:
            text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/Mobile-HTML/1.0.0":
              schema:
                type: string
        '404':
          description: Unknown page title
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
        default:
          description: Error
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/problem'
      operationId: transformWikitextToMobileHtml
      x-monitor: false
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    problem:
      required:
      - type
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: OAuth 2.0 bearer token from meta.wikimedia.org
    CookieAuth:
      type: apiKey
      in: cookie
      name: '{wiki}wikiUserID'
      description: Session cookie obtained via action=login or action=clientlogin