MediaWiki Core REST API (Wiktionary)

The newer MediaWiki Core REST API is exposed at /w/rest.php on every wiki. It offers a smaller, more streamlined surface than the Action API for fetching pages, history, search, files, and revisions. On Wiktionary it serves the same content as the Action API in a more developer-friendly JSON shape. Endpoints include /v1/page/{title}, /v1/page/{title}/html, /v1/page/{title}/history, /v1/search/page, /v1/search/title, /v1/file/{title}.

Documentation

Specifications

Examples

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-file-metadata-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-history-count-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-history-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-latest-revision-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-license-info-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-page-source-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-page-with-html-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-revision-detail-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-search-page-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/core-rest-api-search-response-schema.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-file-metadata-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-history-count-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-history-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-latest-revision-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-license-info-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-page-source-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-page-with-html-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-revision-detail-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-search-page-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/core-rest-api-search-response-structure.json

Other Resources

OpenAPI Specification

wiktionary-core-rest-api-openapi-original.yml Raw ↑
openapi: 3.0.3
info:
  title: Wiktionary MediaWiki Core REST API
  description: >-
    The newer MediaWiki Core REST API, exposed per wiki at /w/rest.php. It
    offers a smaller, streamlined surface than the Action API for fetching
    page content, history, search, files, and revisions. On Wiktionary it
    serves the same content as the Action API in a more developer-friendly
    JSON shape. All content is CC BY-SA 4.0.
  version: '1.0.0'
  termsOfService: https://foundation.wikimedia.org/wiki/Terms_of_Use
  contact:
    name: Wikimedia Foundation
    url: https://www.mediawiki.org/wiki/API:REST_API
  license:
    name: CC BY-SA 4.0
    url: https://creativecommons.org/licenses/by-sa/4.0/
  x-generated-from: documentation
  x-last-validated: '2026-05-30'
servers:
  - url: https://en.wiktionary.org/w/rest.php
    description: English Wiktionary Core REST endpoint
security:
  - {}
  - oauth2: []
tags:
  - name: Page
    description: Page content, source, and HTML
  - name: History
    description: Page history and revision details
  - name: Search
    description: Title-prefix and full-text search
  - name: File
    description: File and media metadata
paths:
  /v1/page/{title}:
    get:
      operationId: getPage
      summary: Wiktionary Get Page
      description: >-
        Fetch the source wikitext and metadata for a Wiktionary page by title.
      tags:
        - Page
      parameters:
        - $ref: '#/components/parameters/Title'
      responses:
        '200':
          description: Page source response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageSourceResponse'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/page/{title}/html:
    get:
      operationId: getPageHtml
      summary: Wiktionary Get Page HTML
      description: Fetch the rendered HTML body for a Wiktionary page.
      tags:
        - Page
      parameters:
        - $ref: '#/components/parameters/Title'
      responses:
        '200':
          description: Page HTML.
          content:
            text/html:
              schema:
                type: string
                description: Rendered HTML.
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/page/{title}/with_html:
    get:
      operationId: getPageWithHtml
      summary: Wiktionary Get Page with HTML
      description: Fetch both the source and rendered HTML for a page in one response.
      tags:
        - Page
      parameters:
        - $ref: '#/components/parameters/Title'
      responses:
        '200':
          description: Combined source + HTML response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PageWithHtmlResponse'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/page/{title}/history:
    get:
      operationId: getPageHistory
      summary: Wiktionary Get Page History
      description: Return a paged list of revisions for a page.
      tags:
        - History
      parameters:
        - $ref: '#/components/parameters/Title'
        - name: older_than
          in: query
          required: false
          description: Return revisions older than this revision id.
          schema:
            type: integer
        - name: newer_than
          in: query
          required: false
          description: Return revisions newer than this revision id.
          schema:
            type: integer
        - name: filter
          in: query
          required: false
          description: Filter revisions (reverted, anonymous, bot, minor).
          schema:
            type: string
            enum: [reverted, anonymous, bot, minor]
      responses:
        '200':
          description: Revision list.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoryResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/page/{title}/history/counts/{type}:
    get:
      operationId: getPageHistoryCount
      summary: Wiktionary Get Page History Count
      description: Return a single numeric count of revisions for a page filtered by type.
      tags:
        - History
      parameters:
        - $ref: '#/components/parameters/Title'
        - name: type
          in: path
          required: true
          description: Which kind of revisions to count.
          schema:
            type: string
            enum: [anonymous, bot, editors, edits, minor, reverted]
      responses:
        '200':
          description: Revision count response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HistoryCountResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/revision/{id}/bare:
    get:
      operationId: getRevisionBare
      summary: Wiktionary Get Revision Bare
      description: Fetch the bare metadata for a single revision id.
      tags:
        - History
      parameters:
        - name: id
          in: path
          required: true
          description: Revision id.
          schema:
            type: integer
          example: 7654321
      responses:
        '200':
          description: Revision metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevisionDetail'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/search/page:
    get:
      operationId: searchPage
      summary: Wiktionary Search Page
      description: Full-text search across Wiktionary pages.
      tags:
        - Search
      parameters:
        - name: q
          in: query
          required: true
          description: Search query string.
          schema:
            type: string
          example: greeting
        - name: limit
          in: query
          required: false
          description: Maximum results to return (1-100, default 50).
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
      responses:
        '200':
          description: Search results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/search/title:
    get:
      operationId: searchTitle
      summary: Wiktionary Search Title
      description: Title-prefix autocomplete search for Wiktionary pages.
      tags:
        - Search
      parameters:
        - name: q
          in: query
          required: true
          description: Title prefix to autocomplete.
          schema:
            type: string
          example: hel
        - name: limit
          in: query
          required: false
          description: Maximum results to return.
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
      responses:
        '200':
          description: Title autocomplete results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /v1/file/{title}:
    get:
      operationId: getFile
      summary: Wiktionary Get File
      description: Fetch metadata for a file (image, audio, video) hosted on Wiktionary or Commons.
      tags:
        - File
      parameters:
        - name: title
          in: path
          required: true
          description: URL-encoded file title (e.g. `File:Hello.ogg`).
          schema:
            type: string
          example: File:En-us-hello.ogg
      responses:
        '200':
          description: File metadata.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileMetadata'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  parameters:
    Title:
      name: title
      in: path
      required: true
      description: URL-encoded page title.
      schema:
        type: string
      example: hello
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
  securitySchemes:
    oauth2:
      type: oauth2
      description: OAuth 2.0 access tokens issued via api.wikimedia.org.
      flows:
        authorizationCode:
          authorizationUrl: https://meta.wikimedia.org/w/rest.php/oauth2/authorize
          tokenUrl: https://meta.wikimedia.org/w/rest.php/oauth2/access_token
          scopes:
            basic: Basic read access to user identity
  schemas:
    PageSourceResponse:
      title: PageSourceResponse
      description: Source representation of a Wiktionary page.
      type: object
      properties:
        id:
          type: integer
          example: 12345
        key:
          type: string
          example: hello
        title:
          type: string
          example: hello
        latest:
          $ref: '#/components/schemas/LatestRevision'
        content_model:
          type: string
          example: wikitext
        license:
          $ref: '#/components/schemas/LicenseInfo'
        source:
          type: string
          description: Raw wikitext source.
          example: "==English==\n===Interjection===\n# A standard greeting."
    PageWithHtmlResponse:
      title: PageWithHtmlResponse
      type: object
      properties:
        id:
          type: integer
          example: 12345
        key:
          type: string
          example: hello
        title:
          type: string
          example: hello
        latest:
          $ref: '#/components/schemas/LatestRevision'
        content_model:
          type: string
          example: wikitext
        license:
          $ref: '#/components/schemas/LicenseInfo'
        source:
          type: string
          example: "==English==\n===Interjection===\n# A standard greeting."
        html:
          type: string
          example: '<p>A standard greeting.</p>'
    LatestRevision:
      title: LatestRevision
      type: object
      properties:
        id:
          type: integer
          example: 7654321
        timestamp:
          type: string
          format: date-time
          example: '2025-03-15T14:30:00Z'
    LicenseInfo:
      title: LicenseInfo
      type: object
      properties:
        url:
          type: string
          format: uri
          example: https://creativecommons.org/licenses/by-sa/4.0/
        title:
          type: string
          example: Creative Commons Attribution-Share Alike 4.0 International
    HistoryResponse:
      title: HistoryResponse
      type: object
      properties:
        revisions:
          type: array
          items:
            $ref: '#/components/schemas/RevisionDetail'
        latest:
          type: string
          format: uri
          example: https://en.wiktionary.org/w/rest.php/v1/page/hello/history
        older:
          type: string
          format: uri
          example: https://en.wiktionary.org/w/rest.php/v1/page/hello/history?older_than=7654321
        newer:
          type: string
          format: uri
          example: https://en.wiktionary.org/w/rest.php/v1/page/hello/history?newer_than=7654321
    HistoryCountResponse:
      title: HistoryCountResponse
      type: object
      properties:
        count:
          type: integer
          example: 412
        limit:
          type: boolean
          description: True if the count was capped (e.g., >10000).
          example: false
    RevisionDetail:
      title: RevisionDetail
      type: object
      properties:
        id:
          type: integer
          example: 7654321
        page:
          type: object
          properties:
            id:
              type: integer
              example: 12345
            title:
              type: string
              example: hello
        size:
          type: integer
          example: 4321
        minor:
          type: boolean
          example: false
        timestamp:
          type: string
          format: date-time
          example: '2025-03-15T14:30:00Z'
        content_model:
          type: string
          example: wikitext
        license:
          $ref: '#/components/schemas/LicenseInfo'
        user:
          type: object
          properties:
            id:
              type: integer
              example: 1
            name:
              type: string
              example: ExampleEditor
        comment:
          type: string
          example: typo fix
        delta:
          type: integer
          description: Byte delta from the parent revision.
          example: 12
    SearchResponse:
      title: SearchResponse
      type: object
      properties:
        pages:
          type: array
          items:
            $ref: '#/components/schemas/SearchPage'
    SearchPage:
      title: SearchPage
      type: object
      properties:
        id:
          type: integer
          example: 12345
        key:
          type: string
          example: hello
        title:
          type: string
          example: hello
        excerpt:
          type: string
          example: 'A standard <span class="searchmatch">greeting</span>.'
        matched_title:
          type: string
          nullable: true
          example: null
        description:
          type: string
          example: English interjection.
        thumbnail:
          type: object
          nullable: true
          properties:
            url:
              type: string
              format: uri
              example: https://upload.wikimedia.org/wikipedia/commons/thumb/example.png
            width:
              type: integer
              example: 60
            height:
              type: integer
              example: 60
    FileMetadata:
      title: FileMetadata
      type: object
      properties:
        title:
          type: string
          example: File:En-us-hello.ogg
        file_description_url:
          type: string
          format: uri
          example: https://commons.wikimedia.org/wiki/File:En-us-hello.ogg
        latest:
          type: object
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2025-03-15T14:30:00Z'
            user:
              type: object
              properties:
                id:
                  type: integer
                  example: 1
                name:
                  type: string
                  example: ExampleUploader
        preferred:
          type: object
          properties:
            mediatype:
              type: string
              example: AUDIO
            size:
              type: integer
              example: 8192
            width:
              type: integer
              nullable: true
              example: null
            height:
              type: integer
              nullable: true
              example: null
            duration:
              type: number
              example: 1.4
            url:
              type: string
              format: uri
              example: https://upload.wikimedia.org/wikipedia/commons/example/En-us-hello.ogg
        original:
          type: object
          additionalProperties: true
    ProblemDetails:
      title: ProblemDetails
      description: RFC 7807 problem-details error envelope.
      type: object
      properties:
        type:
          type: string
          format: uri
          example: https://mediawiki.org/wiki/HyperSwitch/errors/not_found
        title:
          type: string
          example: Not found.
        detail:
          type: string
          example: Page not found.
        instance:
          type: string
          example: /v1/page/nonexistentword
        status:
          type: integer
          example: 404