<!-- Wikimedia Enterprise docs. Canonical page: https://enterprise.wikimedia.com/docs/on-demand/ -->

# On-demand API

Our On-demand REST API returns the current version of any article from all [supported Wikimedia projects](https://enterprise.wikimedia.com/project-data/). Query by article name across all projects or use [fields and filtering](https://enterprise.wikimedia.com/docs/filtering/) to restrict which projects or languages to query, and to define which fields should be returned. On-demand endpoints return JSON by default. Include `Accept: application/x-ndjson` in the request header to receive a response in NDJSON format.

## At a glance

- **Base URL:** `https://api.enterprise.wikimedia.com`
- **Auth:** JWT Bearer access token ([Authentication](https://enterprise.wikimedia.com/docs/authentication/))
- **Formats:** JSON (default); NDJSON if the `Accept: application/x-ndjson` header is present
- **Response models:** [article](https://enterprise.wikimedia.com/docs/api/#models/article), [structured\_content](https://enterprise.wikimedia.com/docs/api/#models/structured-content) (beta), [wikidata\_article](https://enterprise.wikimedia.com/docs/api/#models/wikidata-article) (beta)
- **Access:** free account: 50,000 lookups per month
- **Status:** Article Lookup endpoint is fully released, Structured Contents and Wikidata endpoints are in beta

## When to use

Use On-demand when you need the current version of specific articles you have the exact name of. On-demand endpoints aren't search endpoints, they only return payloads for exact name matches. If you want every article in a project, download it once from the [Snapshot API](https://enterprise.wikimedia.com/docs/snapshot/) instead. And if you want changes pushed to you as they happen, connect to the [Realtime API](https://enterprise.wikimedia.com/docs/realtime/).

## Endpoints

- [`/v2/articles/{name}`](https://enterprise.wikimedia.com/docs/api/#tag/articles/GET/v2/articles/{name}) - Download the current revision of one article (GET, POST)
- [`/v2/structured-contents/{name}`](https://enterprise.wikimedia.com/docs/api/#tag/structured-contents/GET/v2/structured-contents/{name}) - Download the current revision of one pre-parsed article (beta) (GET, POST)
- [`/v2/wikidata/items/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/wikidata/GET/v2/wikidata/items/{identifier}) - Download one Wikidata item by QID (beta) (GET, POST)
- [`/v2/wikidata/properties/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/wikidata/GET/v2/wikidata/properties/{identifier}) - Download one Wikidata property by PID (beta) (GET, POST)
- [`/v2/wikidata/labels/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/wikidata/GET/v2/wikidata/labels/{identifier}) - List every language label for a QID or PID (beta) (GET, POST)

Article Lookup is the production endpoint: GET by article name, or POST with [filters, fields, and limit](https://enterprise.wikimedia.com/docs/filtering/) to narrow the response. Structured Contents return pre-parsed [Structured Contents](https://enterprise.wikimedia.com/api/structured-contents/) JSON, and the Wikidata endpoints look up an item, a property, or a set of labels by Wikidata identifier.

## Worked examples

### Article lookup

Look up the current version of *Squirrel* on English Wikipedia. It uses `filters` to only return matches in English Wikipedia, `enwiki`. The `fields` parameter narrows the response to just nine specific fields. The result comes back as an array of exact matches against this query. Since there is only one article for 'Squirrel' in English Wikipedia, the request returns one matching article.

Article names are case sensitive, and spaces in names are passed as underscores, e.g. `Josephine_Baker`, or percent-encoded, e.g. `Josephine%20Baker`.

```bash
curl -X POST 'https://api.enterprise.wikimedia.com/v2/articles/Squirrel' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": [
      { "field": "is_part_of.identifier", "value": "enwiki" }
    ],
    "fields": [
      "name", "identifier", "abstract", "url", "date_modified",
      "version.identifier", "version.editor.name",
      "event.type", "event.date_created"
    ]
  }'
```

```json title="Response"
[
  {
    "abstract": "Squirrels are members of the family Sciuridae, a family that includes small or medium-sized rodents. ...",
    "date_modified": "2026-06-10T08:38:57Z",
    "event": {
      "date_created": "2026-06-10T08:39:03.755241Z",
      "type": "update"
    },
    "identifier": 28492,
    "name": "Squirrel",
    "url": "https://en.wikipedia.org/wiki/Squirrel",
    "version": {
      "editor": {
        "name": "Orenburg1"
      },
      "identifier": 1358688336
    }
  }
]
```

### Structured Contents lookup (beta)

The Structured Contents Article Lookup endpoint functions the same as the Article Lookup endpoint, but returns info from the `article_body` extracted into neatly parsed JSON objects. Learn more about how Structured Contents works on our [Structured Contents initiative page](https://enterprise.wikimedia.com/api/structured-contents/). The following example looks up the Structured Contents article for *Josephine Baker*, in English Wikipedia.

```bash
curl -X POST 'https://api.enterprise.wikimedia.com/v2/structured-contents/Josephine_Baker' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "filters": [
      { "field": "is_part_of.identifier", "value": "enwiki" }
    ]
  }'
```

```json title="Response"
[
  {
    "name": "Josephine Baker",
    "identifier": 255083,
    "abstract": "Freda Josephine Baker, also spelled Joséphine Baker, was an American-born French dancer, singer, actress, and spy for the French Resistance. ...",
    "description": "American-born French entertainer (1906–1975)",
    "url": "https://en.wikipedia.org/wiki/Josephine_Baker",
    "date_modified": "2026-07-08T21:32:39Z",
    "in_language": {
      "identifier": "en"
    },
    "is_part_of": {
      "identifier": "enwiki"
    },
    "image": {
      "content_url": "https://upload.wikimedia.org/wikipedia/commons/0/0b/Baker_Harcourt_1940_2.jpg",
      "width": 540,
      "height": 756
    },
    "infoboxes": [
      {
        "name": "Infobox person",
        "type": "infobox",
        "has_parts": "... (truncated)"
      }
    ],
    "sections": [
      {
        "name": "Abstract",
        "type": "section",
        "has_parts": "... (truncated)"
      }
    ],
    "references": "... (232 items, truncated)"
  }
]
```

### Wikidata item lookup (beta)

Fetch a Wikidata entity by its Q-number. The `entity` object carries the item's labels, descriptions, aliases, sitelinks, and statements. For the whole Main Graph at once, use [Wikidata snapshots](https://enterprise.wikimedia.com/docs/snapshot/#wikidata-snapshots).

Items whose JSON exceeds 1 MiB currently return 500 on every request. Retrying does not help; read those items from the Wikidata items snapshot.

```bash
curl -H 'Authorization: Bearer ACCESS_TOKEN' \
  https://api.enterprise.wikimedia.com/v2/wikidata/items/Q42
```

```json title="Response"
{
  "name": "Q42",
  "identifier": 138,
  "date_modified": "2026-07-12T21:34:04Z",
  "url": "https://www.wikidata.org/wiki/Q42",
  "version": {
    "identifier": 2516783698
  },
  "event": {
    "type": "update"
  },
  "entity": {
    "identifier": "Q42",
    "type": "item",
    "labels": {
      "ar": "دوغلاس آدمز",
      "bg": "Дъглас Адамс"
    },
    "descriptions": {
      "en": "British science fiction writer and humorist (1952–2001)"
    },
    "sitelinks": {
      "enwiki": {
        "badges": [
          "Q17437798"
        ],
        "title": "Douglas Adams",
        "url": ""
      }
    },
    "statements": "... (truncated)"
  }
}
```

## Requesting exactly what you need

The On-demand API only returns exact matches for an article name across all supported projects. An unfiltered lookup returns the latest article revision from every project that has an article by that name. Use the `is_part_of.identifier` response field to filter down to specific projects. Use the `in_language.identifier` field to filter down to specific project languages. The `fields`, `filters`, and `limit` request parameters work identically on all Enterprise API endpoints: see [Fields, Filters, and Limit](https://enterprise.wikimedia.com/docs/filtering/) for the full syntax guide. Include the `Accept: application/x-ndjson` header in your request to return NDJSON instead of the default JSON.

## Response model

Article lookups return the [article model](https://enterprise.wikimedia.com/docs/api/#models/article) (25 properties), which is also the line format of Snapshot NDJSON files, so one parser covers both. Structured Contents lookups return the [structured\_content model](https://enterprise.wikimedia.com/docs/api/#models/structured-content): it adds `description`, `infoboxes`, `sections`, `references`, and `tables`, but does not carry `article_body`, `categories`, `templates`, `redirects`, `protection`, `visibility`, `watchers_count`, `event`, or `previous_version`. Wikidata lookups return the [wikidata\_article model](https://enterprise.wikimedia.com/docs/api/#models/wikidata-article).

## See also

- [Fields, Filters, and Limit](https://enterprise.wikimedia.com/docs/filtering/) - narrow any lookup to just the fields you need.
- [Identifiers](https://enterprise.wikimedia.com/docs/identifiers/) - information about article names, how to find identifiers to use in `fields` and `filters`, and where to find Wikidata Q-numbers.
- [Structured Contents Initiative](https://enterprise.wikimedia.com/api/structured-contents/) - how Structured Contents works and how you can best leverage it.
- [Credibility Signals](https://enterprise.wikimedia.com/api/credibility-signals/) - deciding what content to trust.
