MediaWiki Action API (Wiktionary)

The MediaWiki Action API is the original Wikimedia query/edit API exposed at /w/api.php on every Wikimedia project. For Wiktionary it provides access to wikitext definitions, page parsing, full-text search, and OpenSearch suggestions. Actions include action=query (prop=wikitext, prop=extracts, prop=revisions, list=search), action=parse (rendered wikitext HTML and section trees), action=opensearch (suggestions), and action=expandtemplates. Supports both GET and POST with format=json|xml.

Documentation

Specifications

Examples

📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-action-api-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-expand-templates-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-extract-page-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-open-search-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-parse-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-parse-section-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-query-extracts-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-query-revisions-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-query-search-response-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-revision-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-revision-page-example.json
📝
Example
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/examples/mediawiki-action-api-search-hit-example.json

Schemas & Data

📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-action-api-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-expand-templates-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-extract-page-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-open-search-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-parse-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-parse-section-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-query-extracts-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-query-revisions-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-query-search-response-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-revision-page-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-revision-schema.json
📊
JSONSchema
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-schema/mediawiki-action-api-search-hit-schema.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-action-api-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-expand-templates-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-extract-page-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-open-search-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-parse-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-parse-section-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-query-extracts-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-query-revisions-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-query-search-response-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-revision-page-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-revision-structure.json
📊
JSONStructure
https://raw.githubusercontent.com/api-evangelist/wiktionary/refs/heads/main/json-structure/mediawiki-action-api-search-hit-structure.json

Other Resources

OpenAPI Specification

wiktionary-mediawiki-action-api-openapi-original.yml Raw ↑
openapi: 3.0.3
info:
  title: Wiktionary MediaWiki Action API
  description: >-
    The MediaWiki Action API is the canonical query/edit API exposed on every
    Wikimedia project at /w/api.php. This spec captures the most commonly used
    read actions against English Wiktionary: action=query (with prop=wikitext,
    prop=extracts, prop=revisions, list=search), action=parse, action=opensearch,
    action=expandtemplates. All Wiktionary content is licensed CC BY-SA 4.0.
  version: '1.0'
  termsOfService: https://foundation.wikimedia.org/wiki/Terms_of_Use
  contact:
    name: Wikimedia Foundation
    url: https://www.mediawiki.org/wiki/API:Main_page
  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
    description: English Wiktionary MediaWiki endpoint
security:
  - {}
  - oauth2: []
  - botPassword: []
tags:
  - name: Query
    description: action=query — Fetch wikitext, extracts, revisions, and search results
  - name: Parse
    description: action=parse — Render wikitext to HTML and parse section trees
  - name: OpenSearch
    description: action=opensearch — OpenSearch suggestions protocol
  - name: ExpandTemplates
    description: action=expandtemplates — Expand wikitext templates server-side
paths:
  /api.php:
    get:
      operationId: queryAction
      summary: Wiktionary Query Action
      description: >-
        Dispatch any read-only MediaWiki Action API call. The `action` query
        parameter selects the module (query, parse, opensearch,
        expandtemplates). Use the more specific operations below for typed
        access, or pass arbitrary `action`/`format` values here.
      tags:
        - Query
      parameters:
        - $ref: '#/components/parameters/Action'
        - $ref: '#/components/parameters/Format'
        - name: titles
          in: query
          required: false
          description: Pipe-separated list of page titles (max 50 per request).
          schema:
            type: string
        - name: prop
          in: query
          required: false
          description: Properties to fetch (e.g. wikitext, extracts, revisions, links).
          schema:
            type: string
        - name: list
          in: query
          required: false
          description: Lists to fetch (e.g. search, allpages, recentchanges).
          schema:
            type: string
        - name: meta
          in: query
          required: false
          description: Meta information (e.g. siteinfo, tokens, userinfo).
          schema:
            type: string
      responses:
        '200':
          description: Action API response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionApiResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '429':
          $ref: '#/components/responses/TooManyRequests'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#query-wikitext:
    get:
      operationId: queryWikitext
      summary: Wiktionary Query Wikitext
      description: >-
        Fetch the raw wikitext for one or more pages via
        action=query&prop=revisions&rvprop=content.
      tags:
        - Query
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [query]
            default: query
          description: Must be `query`.
        - name: prop
          in: query
          required: true
          schema:
            type: string
            enum: [revisions]
            default: revisions
          description: Must be `revisions`.
        - name: rvprop
          in: query
          required: true
          schema:
            type: string
            default: content
          description: Revision properties to fetch (use `content` for wikitext).
        - name: titles
          in: query
          required: true
          schema:
            type: string
          description: Pipe-separated page titles.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: Wikitext content for the requested pages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryRevisionsResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#query-extracts:
    get:
      operationId: queryExtracts
      summary: Wiktionary Query Extracts
      description: >-
        Fetch plain-text or limited-HTML extracts of pages via
        action=query&prop=extracts. Powered by the TextExtracts extension.
      tags:
        - Query
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [query]
            default: query
          description: Must be `query`.
        - name: prop
          in: query
          required: true
          schema:
            type: string
            enum: [extracts]
            default: extracts
          description: Must be `extracts`.
        - name: titles
          in: query
          required: true
          schema:
            type: string
          description: Pipe-separated page titles.
        - name: exintro
          in: query
          required: false
          schema:
            type: boolean
          description: Return only the lead section.
        - name: explaintext
          in: query
          required: false
          schema:
            type: boolean
          description: Return plain text instead of limited HTML.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: Page extracts response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryExtractsResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#query-search:
    get:
      operationId: querySearch
      summary: Wiktionary Query Search
      description: >-
        Full-text search across Wiktionary pages via
        action=query&list=search. Backed by ElasticSearch (CirrusSearch).
      tags:
        - Query
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [query]
            default: query
          description: Must be `query`.
        - name: list
          in: query
          required: true
          schema:
            type: string
            enum: [search]
            default: search
          description: Must be `search`.
        - name: srsearch
          in: query
          required: true
          schema:
            type: string
          description: Search query string.
        - name: srlimit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 10
          description: Number of results to return (max 500).
        - name: sroffset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
          description: Offset into the result set for paging.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: Search response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuerySearchResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#parse:
    get:
      operationId: parsePage
      summary: Wiktionary Parse Page
      description: >-
        Parse the wikitext of a page (or supplied text) and return rendered
        HTML, section structure, links, categories, and other parser output.
      tags:
        - Parse
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [parse]
            default: parse
          description: Must be `parse`.
        - name: page
          in: query
          required: false
          schema:
            type: string
          description: Title of the page to parse.
        - name: text
          in: query
          required: false
          schema:
            type: string
          description: Wikitext to parse instead of an existing page.
        - name: prop
          in: query
          required: false
          schema:
            type: string
            default: text|sections|links|categories
          description: Which parts of the parser output to return.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: Parser output.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ParseResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#opensearch:
    get:
      operationId: openSearchSuggest
      summary: Wiktionary OpenSearch Suggest
      description: >-
        Return autocomplete suggestions following the OpenSearch suggestions
        protocol. Response is a 4-element array (query, titles, descriptions,
        urls).
      tags:
        - OpenSearch
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [opensearch]
            default: opensearch
          description: Must be `opensearch`.
        - name: search
          in: query
          required: true
          schema:
            type: string
          description: Prefix to autocomplete.
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 10
          description: Maximum number of suggestions to return.
        - name: namespace
          in: query
          required: false
          schema:
            type: string
            default: '0'
          description: Pipe-separated namespace numbers to search within.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: OpenSearch suggestions response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenSearchResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api.php#expandtemplates:
    get:
      operationId: expandTemplates
      summary: Wiktionary Expand Templates
      description: >-
        Expand templates and parser functions in supplied wikitext and return
        the result.
      tags:
        - ExpandTemplates
      parameters:
        - name: action
          in: query
          required: true
          schema:
            type: string
            enum: [expandtemplates]
            default: expandtemplates
          description: Must be `expandtemplates`.
        - name: text
          in: query
          required: true
          schema:
            type: string
          description: Wikitext containing templates to expand.
        - name: title
          in: query
          required: false
          schema:
            type: string
          description: Page title context for the expansion.
        - name: prop
          in: query
          required: false
          schema:
            type: string
            default: wikitext
          description: Which expansion properties to return.
        - $ref: '#/components/parameters/Format'
      responses:
        '200':
          description: Expanded templates response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExpandTemplatesResponse'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  parameters:
    Action:
      name: action
      in: query
      required: true
      description: Which Action API module to dispatch.
      schema:
        type: string
        enum: [query, parse, opensearch, expandtemplates, sitematrix, paraminfo]
        default: query
    Format:
      name: format
      in: query
      required: false
      description: Response format.
      schema:
        type: string
        enum: [json, jsonfm, xml, xmlfm, php, phpfm, none]
        default: json
  responses:
    BadRequest:
      description: Request was malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    TooManyRequests:
      description: Rate limit exceeded (shared cap is ~200 req/s; set a unique User-Agent).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  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
            createeditmovepage: Create, edit, and move pages
            highvolume: Higher rate limits for bot use
    botPassword:
      type: http
      scheme: basic
      description: Legacy BotPassword scoped credentials.
  schemas:
    ActionApiResponse:
      title: ActionApiResponse
      description: Generic envelope for any Action API response.
      type: object
      properties:
        batchcomplete:
          type: string
          description: Present when all sub-queries completed in one batch.
          example: ''
        continue:
          type: object
          description: Continuation cursor for paged result sets.
          additionalProperties: true
        query:
          type: object
          description: Container for `prop`/`list`/`meta` results when action=query.
          additionalProperties: true
        parse:
          type: object
          description: Container for action=parse output.
          additionalProperties: true
        warnings:
          type: object
          description: Per-module warning messages.
          additionalProperties: true
        error:
          $ref: '#/components/schemas/ApiError'
    QueryRevisionsResponse:
      title: QueryRevisionsResponse
      description: action=query&prop=revisions result containing page wikitext.
      type: object
      properties:
        batchcomplete:
          type: string
          example: ''
        query:
          type: object
          properties:
            pages:
              type: object
              description: Map of pageid → page object.
              additionalProperties:
                $ref: '#/components/schemas/RevisionPage'
    RevisionPage:
      title: RevisionPage
      type: object
      properties:
        pageid:
          type: integer
          example: 12345
        ns:
          type: integer
          example: 0
        title:
          type: string
          example: hello
        revisions:
          type: array
          items:
            $ref: '#/components/schemas/Revision'
    Revision:
      title: Revision
      type: object
      properties:
        contentformat:
          type: string
          example: text/x-wiki
        contentmodel:
          type: string
          example: wikitext
        '*':
          type: string
          description: Raw wikitext body.
          example: "==English==\n===Interjection===\n# A standard greeting."
    QueryExtractsResponse:
      title: QueryExtractsResponse
      description: action=query&prop=extracts result.
      type: object
      properties:
        query:
          type: object
          properties:
            pages:
              type: object
              additionalProperties:
                $ref: '#/components/schemas/ExtractPage'
    ExtractPage:
      title: ExtractPage
      type: object
      properties:
        pageid:
          type: integer
          example: 12345
        ns:
          type: integer
          example: 0
        title:
          type: string
          example: hello
        extract:
          type: string
          description: Plain-text or limited-HTML extract.
          example: A standard greeting; an expression of puzzlement or discovery.
    QuerySearchResponse:
      title: QuerySearchResponse
      description: action=query&list=search result.
      type: object
      properties:
        batchcomplete:
          type: string
          example: ''
        continue:
          type: object
          additionalProperties: true
        query:
          type: object
          properties:
            searchinfo:
              type: object
              properties:
                totalhits:
                  type: integer
                  example: 1234
            search:
              type: array
              items:
                $ref: '#/components/schemas/SearchHit'
    SearchHit:
      title: SearchHit
      type: object
      properties:
        ns:
          type: integer
          example: 0
        title:
          type: string
          example: hello
        pageid:
          type: integer
          example: 12345
        size:
          type: integer
          example: 4321
        wordcount:
          type: integer
          example: 412
        snippet:
          type: string
          description: HTML snippet of the matching excerpt.
          example: 'A standard <span class="searchmatch">greeting</span>.'
        timestamp:
          type: string
          format: date-time
          example: '2025-03-15T14:30:00Z'
    ParseResponse:
      title: ParseResponse
      description: action=parse result containing parser output for a page or text.
      type: object
      properties:
        parse:
          type: object
          properties:
            title:
              type: string
              example: hello
            pageid:
              type: integer
              example: 12345
            text:
              type: object
              properties:
                '*':
                  type: string
                  description: Rendered HTML.
                  example: '<p><b>hello</b> — a standard greeting.</p>'
            sections:
              type: array
              items:
                $ref: '#/components/schemas/ParseSection'
            links:
              type: array
              items:
                type: object
                additionalProperties: true
            categories:
              type: array
              items:
                type: object
                additionalProperties: true
    ParseSection:
      title: ParseSection
      type: object
      properties:
        toclevel:
          type: integer
          example: 1
        level:
          type: string
          example: '2'
        line:
          type: string
          example: English
        number:
          type: string
          example: '1'
        index:
          type: string
          example: '1'
        fromtitle:
          type: string
          example: hello
        anchor:
          type: string
          example: English
    OpenSearchResponse:
      title: OpenSearchResponse
      description: >-
        OpenSearch suggestions protocol 4-tuple: [query, titles, descriptions,
        urls].
      type: array
      minItems: 4
      maxItems: 4
      items:
        oneOf:
          - type: string
          - type: array
            items:
              type: string
      example:
        - hel
        - [hello, help, helmet]
        - ['', '', '']
        - [https://en.wiktionary.org/wiki/hello, https://en.wiktionary.org/wiki/help, https://en.wiktionary.org/wiki/helmet]
    ExpandTemplatesResponse:
      title: ExpandTemplatesResponse
      description: action=expandtemplates result.
      type: object
      properties:
        expandtemplates:
          type: object
          properties:
            wikitext:
              type: string
              description: Wikitext after template expansion.
              example: 'A standard greeting.'
    ApiError:
      title: ApiError
      description: Standard MediaWiki Action API error envelope.
      type: object
      properties:
        code:
          type: string
          example: badvalue
        info:
          type: string
          example: Unrecognized value for parameter "action".
        '*':
          type: string
          description: Additional error context.
          example: See https://en.wiktionary.org/w/api.php for help.