Wikisource Transforms API

convert content between HTML and Wikitext

Operations 9

POST /transform/html/to/wikitext Transform HTML to Wikitext #
POST /transform/html/to/wikitext/{title} Transform HTML to Wikitext #
POST /transform/html/to/wikitext/{title}/{revision} Transform HTML to Wikitext #
POST /transform/wikitext/to/html Transform Wikitext to HTML #
POST /transform/wikitext/to/html/{title} Transform Wikitext to HTML #
POST /transform/wikitext/to/html/{title}/{revision} Transform Wikitext to HTML #
POST /transform/wikitext/to/lint Check Wikitext for lint errors #
POST /transform/wikitext/to/lint/{title} Check Wikitext for lint errors #
POST /transform/wikitext/to/lint/{title}/{revision} Check Wikitext for lint errors #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/wikisource-transforms-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

wikisource-transforms-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 1.0.0
  title: Wikimedia REST Transforms API
  description: This API provides cacheable and straightforward access to Wikimedia content and data, in machine-readable formats.
  termsOfService: https://wikimediafoundation.org/wiki/Terms_of_Use
  contact:
    name: the Wikimedia Services team
    url: http://mediawiki.org/wiki/Wikimedia_REST_API
  license:
    name: Apache2
    url: http://www.apache.org/licenses/LICENSE-2.0
servers:
- url: /api/rest_v1
tags:
- name: Transforms
  description: convert content between HTML and Wikitext
paths:
  /transform/html/to/wikitext:
    post:
      tags:
      - Transforms
      summary: Transform HTML to Wikitext
      description: 'Transform Parsoid HTML

        to Wikitext.


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

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

        Parsoid preserve small

        syntactic variations in wikitext, which ensures that diffs are

        readable.


        - Stability: 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
      operationId: postTransformHtmlToWikitext
      x-operation-id-source: derived
  /transform/html/to/wikitext/{title}:
    post:
      tags:
      - Transforms
      summary: Transform HTML to Wikitext
      description: 'Transform Parsoid HTML

        to Wikitext.


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

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

        Parsoid preserve small

        syntactic variations in wikitext, which ensures that diffs are

        readable.


        - Stability: 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: 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
      operationId: postTransformHtmlToWikitextByTitle
      x-operation-id-source: derived
  /transform/html/to/wikitext/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: Transform HTML to Wikitext
      description: 'Transform Parsoid HTML

        to Wikitext.


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

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

        Parsoid preserve small

        syntactic variations in wikitext, which ensures that diffs are

        readable.


        - Stability: 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
      operationId: postTransformHtmlToWikitextByTitleByRevision
      x-operation-id-source: derived
  /transform/wikitext/to/html:
    post:
      tags:
      - Transforms
      summary: 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

        - 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
      operationId: postTransformWikitextToHtml
      x-operation-id-source: derived
  /transform/wikitext/to/html/{title}:
    post:
      tags:
      - Transforms
      summary: 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

        - 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: true
      parameters:
      - name: title
        in: path
        description: 'Page title. Use underscores instead of spaces. Use percent-encoding. Example: `Main_Page`.'
        required: true
        schema:
          type: string
      x-amples:
      - title: Transform wikitext to html
        request:
          params:
            domain: en.wikipedia.org
            title: User:BSitzmann_(WMF)/MCS/Test/Frankenstein
          body:
            wikitext: == Heading ==
            body_only: true
        response:
          status: 200
          headers:
            content-type: /^text\/html.+/
          body: /^<h2.*>Heading<\/h2>$/
      operationId: postTransformWikitextToHtmlByTitle
      x-operation-id-source: derived
  /transform/wikitext/to/html/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: 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

        - 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
      operationId: postTransformWikitextToHtmlByTitleByRevision
      x-operation-id-source: derived
  /transform/wikitext/to/lint:
    post:
      tags:
      - Transforms
      summary: Check Wikitext for lint errors
      description: 'Parse the supplied wikitext and check it for lint errors.


        - Stability: 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
      operationId: postTransformWikitextToLint
      x-operation-id-source: derived
  /transform/wikitext/to/lint/{title}:
    post:
      tags:
      - Transforms
      summary: Check Wikitext for lint errors
      description: 'Parse the supplied wikitext and check it for lint errors.


        - Stability: 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
      operationId: postTransformWikitextToLintByTitle
      x-operation-id-source: derived
  /transform/wikitext/to/lint/{title}/{revision}:
    post:
      tags:
      - Transforms
      summary: Check Wikitext for lint errors
      description: 'Parse the supplied wikitext and check it for lint errors.


        - Stability: 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
      operationId: postTransformWikitextToLintByTitleByRevision
      x-operation-id-source: derived
components:
  schemas:
    problem:
      required:
      - type
      type: object
      properties:
        type:
          type: string
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
x-host-basePath: /api/rest_v1
x-default-params: {}