# Wikipedia Revision Compare API

Get Wikipedia Revision Compare data via REST or OpenAny MCP—with pay-per-use pricing, no subscription, and no proxies required. Powered by Wikimedia, configure supported query parameters and filters, and retrieve structured data including base revision identifier, target revision identifier, diff line number, diff record type code, and diff source text to review article edits, build a change viewer, and connect history to comparison.

Documentation: https://openany.si/wikipedia/wikipedia-revision-comparison/
API ID: 3d335b12-22fc-4020-a559-4b62def37b72
Provider: wikimedia
Contract revision: 4
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/wikimedia/revision/{from}/compare/{to}
Page update time: 2026-12-03T02:37:00.251Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0 / call
The published contract currently has no usage charge. Authentication and service limits still apply.
Price source: OpenAny public API contract.
Contract update time: 2026-12-03T02:37:00.251Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "fixed",
  "priceMicroUsd": "0",
  "rounding": null,
  "unit": "call",
  "unitQuantity": null
}
```

## Usage and limits
## Wikipedia Revision Compare API

Place the base revision ID in from and the target revision ID in to. The response contains diff records plus from and to revision metadata, including section references where provided.

## What You Can Build

- **Review article edits**: Inspect source differences between two known revisions.
- **Build a change viewer**: Render diff records with revision identifiers and line context.
- **Connect history to comparison**: Use revision IDs from a separate article-history lookup.

## Returned Data

| Field | Meaning |
| --- | --- |
| `from.id` | Base revision identifier |
| `to.id` | Target revision identifier |
| `diff[].lineNumber` | Diff line number |
| `diff[].type` | Diff record type code |
| `diff[].text` | Diff source text |
| `diff[].offset` | Source offsets for comparison |
| `from.sections[]` | Base revision section metadata |

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Wikipedia Revision Compare API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {
        "from": {
          "type": "integer",
          "description": "Base revision ID.",
          "minimum": 1
        },
        "to": {
          "type": "integer",
          "description": "Target revision ID from the same article.",
          "minimum": 1
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "query": {
      "type": "object",
      "properties": {}
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "diff": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lineNumber": {
            "type": "integer"
          },
          "offset": {
            "type": "object",
            "properties": {
              "from": {
                "type": "integer"
              },
              "to": {
                "type": "integer"
              }
            }
          },
          "text": {
            "type": "string"
          },
          "type": {
            "type": "integer"
          },
          "highlightRanges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "length": {
                  "type": "integer"
                },
                "start": {
                  "type": "integer"
                },
                "type": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "from": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "sections": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "heading": {
                "type": "string"
              },
              "level": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              }
            }
          }
        },
        "slot_role": {
          "type": "string"
        }
      }
    },
    "to": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "sections": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "heading": {
                "type": "string"
              },
              "level": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              }
            }
          }
        },
        "slot_role": {
          "type": "string"
        }
      }
    }
  }
}
```

## Request example
Scenario: Documentation example
```bash
curl \
  'https://api.openany.si/v1/agent-apis/wikimedia/revision/1382821990/compare/1382916556' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Published documentation example. Verify the actual response after an approved call.
Sample response · Documented HTTP 200
```json
{
  "diff": [
    {
      "lineNumber": 94,
      "offset": {
        "from": 12128,
        "to": 12128
      },
      "text": "The [[Modern English]] word {{anchor|Name|Etymology}} ''Earth'' developed, via [[Middle English]], from an [[Old English]] noun most often spelled ''{{linktext|lang=ang|eorðe}}''.<ref name=\"oedearth\">{{cite book|title=Oxford English Dictionary|edition=3|chapter=earth, ''n.1''|publisher=[[Oxford University Press]]|place=[[Oxford]], England|year=2010|isbn=978-0-19-957112-3|doi=10.1093/acref/9780199571123.001.0001}}</ref> It has cognates in every [[Germanic language]], from which {{lang|gem-x-proto|erþō}} has been reconstructed. In its earliest attestation, the word ''{{lang|ang|eorðe}}'' was used to translate the many senses of Latin ''{{linktext|lang=la|terra}}'' and Greek {{Wktl|grc|γῆ|gē}}: the ground, its soil, dry land, the human world, the surface of the world (including the sea), and the globe itself. As with [[Roman Empire|Roman]] {{langr|la|[[Terra (goddess)|Terra]]}} (or {{langr|la|Tellus}}) and [[Greeks|Greek]] {{langr|grc-Latn|[[Gaia]]}}, Earth may have been a [[earth goddess|personified goddess]] in [[Germanic paganism]]: late [[Norse mythology]] included {{langr|non|[[Jörð]]}} ('Earth'), a giantess often given as the mother of [[Thor]].<ref>{{cite book|last=Simek|first=Rudolf|author-link=Rudolf Simek|translator-last=Hall|translator-first=Angela|title=Dictionary of Northern Mythology|page=179|publisher=[[D. S. Brewer]]|year=2007|isbn=978-0-85991-513-7}}</ref>",
      "type": 0
    },
    {
      "lineNumber": 95,
      "offset": {
        "from": 13531,
        "to": 13531
      },
      "text": "",
      "type": 0
    },
    {
      "highlightRanges": [
        {
          "length": 4,
          "start": 932,
          "type": 1
        }
      ],
      "lineNumber": 96,
      "offset": {
        "from": 13532,
        "to": 13532
      },
      "text": "Historically, ''Earth'' has been written in lowercase. During the [[Early Middle English]] period, its [[Definite article|definite sense]] as \"the globe\" began being expressed using the phrase ''the earth''. By the period of [[Early Modern English]], [[Capitalization in English#History of English capitalization|capitalization of nouns began to prevail]], and ''the earth'' was also written ''the Earth'', particularly when referenced along with other heavenly bodies. More recently, the name is sometimes simply given as ''Earth'', by analogy with the names of the [[Solar System|other planets]], though ''earth'' and forms with ''the earth'' remain common.<ref name=\"oedearth\" /> [[Style guide|House styles]] now vary: [[Oxford spelling]] recognizes the lowercase form as the more common, with the capitalized form an acceptable variant. Another convention capitalizes ''Earth'' when appearing as a name, such as a description of the \"Earth's atmosphere\", but employs the lowercase when it is preceded by ''the'', such as \"the atmosphere of the earth\". It almost always appears in lowercase in colloquial expressions such as \"what on earth are you doing?\"<ref>{{cite book|title=The New Oxford Dictionary of English|edition=1st|chapter=earth|publisher=[[Oxford University Press]]|location=Oxford|year=1998|isbn=978-0-19-861263-6}}</ref>",
      "type": 3
    },
    {
      "lineNumber": 97,
      "offset": {
        "from": 14871,
        "to": 14867
      },
      "text": "",
      "type": 0
    },
    {
      "lineNumber": 98,
      "offset": {
        "from": 14872,
        "to": 14868
      },
      "text": "The name ''Terra'' {{IPAc-en|ˈ|t|ɛr|ə}} {{respell|TERR|ə}} is occasionally used in scientific writing; it also sees use in science fiction to distinguish humanity's inhabited planet from others,<ref>{{OED|Terra}}</ref> while in poetry ''Tellus'' {{IPAc-en|ˈ|t|ɛ|l|ə|s}} {{respell|TELL|əs}} has been used to denote personification of the Earth.<ref>{{OED|Tellus}}</ref> ''Terra'' is also the name of the planet in some [[Romance languages]], languages that evolved from Latin, like Italian and Portuguese, while in other Romance languages the word gave rise to names with slightly altered spellings, like the Spanish {{lang|es|Tierra}} and the French {{lang|fr|Terre}}. The Latinate form {{lang|la|Gaea}} ({{IPAc-en|lang|'|dʒ|iː|.|ə}} {{respell|DJEE|ə}}) of the Greek poetic name {{tlit|grc|[[Gaia]]}} ({{IPA|grc|ɡâi̯.a|lang|label=}} or {{IPA|el|ɡâj.ja|}}) is rare, though the alternative spelling ''Gaia'' has become common due to the [[Gaia hypothesis]], in which case its pronunciation is {{IPAc-en|ˈ|g|aɪ|.|ə}} {{respell|GYE|ə}} rather than the more traditional English {{IPAc-en|ˈ|g|eɪ|.|ə}} {{respell|GAY|ə}}.<ref>{{OED|Gaia}}</ref>",
      "type": 0
    }
  ],
  "from": {
    "id": 1382821990,
    "sections": [
      {
        "heading": "== Etymology ==",
        "level": 2,
        "offset": 12112
      },
      {
        "heading": "== Natural history ==",
        "level": 2,
        "offset": 16956
      },
      {
        "heading": "=== Formation ===",
        "level": 3,
        "offset": 17033
      },
      {
        "heading": "=== After formation ===",
        "level": 3,
        "offset": 21087
      },
      {
        "heading": "=== Origin of life and evolution ===",
        "level": 3,
        "offset": 28770
      },
      {
        "heading": "=== Future ===",
        "level": 3,
        "offset": 37519
      },
      {
        "heading": "== Composition and structure ==",
        "level": 2,
        "offset": 40987
      },
      {
        "heading": "=== Chemical composition ===",
        "level": 3,
        "offset": 43321
      },
      {
        "heading": "=== Internal structure ===",
        "level": 3,
        "offset": 44506
      },
      {
        "heading": "=== Internal heat ===",
        "level": 3,
        "offset": 48459
      },
      {
        "heading": "=== Tectonic plates ===",
        "level": 3,
        "offset": 51072
      },
      {
        "heading": "=== Crust ===",
        "level": 3,
        "offset": 54372
      },
      {
        "heading": "=== <span class=\"anchor\" id=\"Surface\"></span> Surface ===",
        "level": 3,
        "offset": 56201
      },
      {
        "heading": "===Surface topography===",
        "level": 3,
        "offset": 67817
      },
      {
        "heading": "=== Shape ===",
        "level": 3,
        "offset": 68854
      },
      {
        "heading": "==Gravity and magnetic field==",
        "level": 2,
        "offset": 73087
      },
      {
        "heading": "=== Magnetic field ===",
        "level": 3,
        "offset": 73118
      },
      {
        "heading": "=== Gravitational field ===",
        "level": 3,
        "offset": 78896
      },
      {
        "heading": "== <span class=\"anchor\" id=\"Earth–Moon system\"></span> Moon and orbital space ==",
        "level": 2,
        "offset": 80189
      },
      {
        "heading": "=== Moon ===",
        "level": 3,
        "offset": 80315
      },
      {
        "heading": "=== Asteroids and artificial satellites ===",
        "level": 3,
        "offset": 89669
      },
      {
        "heading": "== Orbit and rotation ==",
        "level": 2,
        "offset": 92430
      },
      {
        "heading": "=== Rotation ===",
        "level": 3,
        "offset": 92455
      },
      {
        "heading": "=== Orbit and location ===",
        "level": 3,
        "offset": 94713
      },
      {
        "heading": "=== Axial tilt and seasons ===",
        "level": 3,
        "offset": 97487
      },
      {
        "heading": "== Atmosphere and climate==",
        "level": 2,
        "offset": 103535
      },
      {
        "heading": "===Exosphere===",
        "level": 3,
        "offset": 107244
      },
      {
        "heading": "=== Upper atmosphere ===",
        "level": 3,
        "offset": 108671
      },
      {
        "heading": "===Troposphere===",
        "level": 3,
        "offset": 110349
      },
      {
        "heading": "=== Weather and climate ===",
        "level": 3,
        "offset": 111574
      },
      {
        "heading": "== Hydrosphere ==",
        "level": 2,
        "offset": 118842
      },
      {
        "heading": "== Biosphere ==",
        "level": 2,
        "offset": 126252
      },
      {
        "heading": "===Challenges for life on Earth===",
        "level": 3,
        "offset": 129751
      },
      {
        "heading": "== Human geography ==",
        "level": 2,
        "offset": 133684
      },
      {
        "heading": "=== Natural resources and land use ===",
        "level": 3,
        "offset": 140471
      },
      {
        "heading": "=== Environmental impact ===",
        "level": 3,
        "offset": 145211
      },
      {
        "heading": "== In culture ==",
        "level": 2,
        "offset": 152002
      },
      {
        "heading": "==See also==",
        "level": 2,
        "offset": 164117
      },
      {
        "heading": "== Notes ==",
        "level": 2,
        "offset": 164501
      },
      {
        "heading": "== References ==",
        "level": 2,
        "offset": 167569
      },
      {
        "heading": "== External links ==",
        "level": 2,
        "offset": 224462
      }
    ],
    "slot_role": "main"
  },
  "to": {
    "id": 1382916556,
    "sections": [
      {
        "heading": "== Etymology ==",
        "level": 2,
        "offset": 12112
      },
      {
        "heading": "== Natural history ==",
        "level": 2,
        "offset": 16952
      },
      {
        "heading": "=== Formation ===",
        "level": 3,
        "offset": 17029
      },
      {
        "heading": "=== After formation ===",
        "level": 3,
        "offset": 21083
      },
      {
        "heading": "=== Origin of life and evolution ===",
        "level": 3,
        "offset": 28766
      },
      {
        "heading": "=== Future ===",
        "level": 3,
        "offset": 37515
      },
      {
        "heading": "== Composition and structure ==",
        "level": 2,
        "offset": 40983
      },
      {
        "heading": "=== Chemical composition ===",
        "level": 3,
        "offset": 43317
      },
      {
        "heading": "=== Internal structure ===",
        "level": 3,
        "offset": 44502
      },
      {
        "heading": "=== Internal heat ===",
        "level": 3,
        "offset": 48455
      },
      {
        "heading": "=== Tectonic plates ===",
        "level": 3,
        "offset": 51068
      },
      {
        "heading": "=== Crust ===",
        "level": 3,
        "offset": 54368
      },
      {
        "heading": "=== <span class=\"anchor\" id=\"Surface\"></span> Surface ===",
        "level": 3,
        "offset": 56197
      },
      {
        "heading": "===Surface topography===",
        "level": 3,
        "offset": 67813
      },
      {
        "heading": "=== Shape ===",
        "level": 3,
        "offset": 68850
      },
      {
        "heading": "==Gravity and magnetic field==",
        "level": 2,
        "offset": 73083
      },
      {
        "heading": "=== Magnetic field ===",
        "level": 3,
        "offset": 73114
      },
      {
        "heading": "=== Gravitational field ===",
        "level": 3,
        "offset": 78892
      },
      {
        "heading": "== <span class=\"anchor\" id=\"Earth–Moon system\"></span> Moon and orbital space ==",
        "level": 2,
        "offset": 80185
      },
      {
        "heading": "=== Moon ===",
        "level": 3,
        "offset": 80311
      },
      {
        "heading": "=== Asteroids and artificial satellites ===",
        "level": 3,
        "offset": 89665
      },
      {
        "heading": "== Orbit and rotation ==",
        "level": 2,
        "offset": 92426
      },
      {
        "heading": "=== Rotation ===",
        "level": 3,
        "offset": 92451
      },
      {
        "heading": "=== Orbit and location ===",
        "level": 3,
        "offset": 94709
      },
      {
        "heading": "=== Axial tilt and seasons ===",
        "level": 3,
        "offset": 97483
      },
      {
        "heading": "== Atmosphere and climate==",
        "level": 2,
        "offset": 103531
      },
      {
        "heading": "===Exosphere===",
        "level": 3,
        "offset": 107240
      },
      {
        "heading": "=== Upper atmosphere ===",
        "level": 3,
        "offset": 108667
      },
      {
        "heading": "===Troposphere===",
        "level": 3,
        "offset": 110345
      },
      {
        "heading": "=== Weather and climate ===",
        "level": 3,
        "offset": 111570
      },
      {
        "heading": "== Hydrosphere ==",
        "level": 2,
        "offset": 118838
      },
      {
        "heading": "== Biosphere ==",
        "level": 2,
        "offset": 126248
      },
      {
        "heading": "===Challenges for life on Earth===",
        "level": 3,
        "offset": 129747
      },
      {
        "heading": "== Human geography ==",
        "level": 2,
        "offset": 133680
      },
      {
        "heading": "=== Natural resources and land use ===",
        "level": 3,
        "offset": 140467
      },
      {
        "heading": "=== Environmental impact ===",
        "level": 3,
        "offset": 145207
      },
      {
        "heading": "== In culture ==",
        "level": 2,
        "offset": 151998
      },
      {
        "heading": "==See also==",
        "level": 2,
        "offset": 164113
      },
      {
        "heading": "== Notes ==",
        "level": 2,
        "offset": 164497
      },
      {
        "heading": "== References ==",
        "level": 2,
        "offset": 167565
      },
      {
        "heading": "== External links ==",
        "level": 2,
        "offset": 224458
      }
    ],
    "slot_role": "main"
  }
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Common questions
### Can I compare revisions from different articles?
Use revision IDs from the same article as required by the target revision input description.

### Where do I find revision IDs?
Use the Wikipedia Article Revision History API to obtain revid values for an article.

### Is diff.text rendered article HTML?
It is source text in a diff record and can contain wiki markup. It is not a complete rendered article.

### What does the numeric type mean?
Treat type as a diff-format code. Use the relevant format documentation rather than inferring its meaning from one example value.

### Does this endpoint monitor future edits automatically?
No. It compares two supplied revisions. Scheduling history checks and selecting revisions are application tasks.

### Should I render diff text as trusted HTML?
No. Escape or sanitize source content according to your application's diff-rendering policy.

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
