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

# Identifiers

An identifier is the value that addresses one resource in the Wikimedia Enterprise API. It is the most reused parameter in the API: almost every path ends in `/{identifier}`, and the format it expects depends on what you are addressing. A snapshot identifier looks nothing like a language identifier, for instance. This page is the reference for all of them.

## Identifier by resource

Every row is an endpoint that takes an `{identifier}` path parameter.

| Resource                            | Identifier looks like                            | Where the value comes from                                                                                                                                                                                                  |
| ----------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Full Snapshot bundle                | `enwiki_namespace_0`                             | [Snapshots Available](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots), or the [recipe below](#how-a-snapshot-identifier-is-built)                                                                |
| Structured Contents snapshot (Beta) | `dewiki_namespace_0`                             | Same recipe, limited to the [beta projects](#structured-contents-is-a-subset)                                                                                                                                               |
| Snapshot chunk                      | `dewiki_namespace_0_chunk_0`, or the chunk index | The `chunks` array in [Snapshot Info](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots/{identifier})                                                                                               |
| Hourly batch                        | `afwiki_namespace_0`                             | [Hourly Batch Files Available](https://enterprise.wikimedia.com/docs/api/#tag/batches/GET/v2/batches/{date}/{hour}) for that date and hour                                                                                  |
| Wikidata snapshot                   | `items` or `properties`                          | Restricted to two options, [Wikidata Snapshots Available](https://enterprise.wikimedia.com/docs/api/#tag/wikidata-snapshots/GET/v2/snapshots/wikidata) lists both                                                           |
| Wikidata snapshot chunk             | `wikidata_items_chunk_0`                         | Restricted to one value in the `chunks` array in [Wikidata Snapshot Info](https://enterprise.wikimedia.com/docs/api/#tag/wikidata-snapshots/GET/v2/snapshots/wikidata/{identifier})                                         |
| Wikidata hourly batch               | `items` or `properties`                          | Restricted to two options, scoped by the date and hour in the path of [Wikidata Hourly Batch File Info](https://enterprise.wikimedia.com/docs/api/#tag/wikidata-batches/GET/v2/batches/{date}/{hour}/wikidata/{identifier}) |
| Project                             | `enwiki`                                         | [Projects Available](https://enterprise.wikimedia.com/docs/api/#tag/projects/GET/v2/projects)                                                                                                                               |
| Language                            | `en`                                             | [Languages Available](https://enterprise.wikimedia.com/docs/api/#tag/languages/GET/v2/languages)                                                                                                                            |
| Project code                        | `wiki`                                           | [Project Codes Available](https://enterprise.wikimedia.com/docs/api/#tag/codes/GET/v2/codes)                                                                                                                                |
| Namespace                           | `0`, an integer                                  | [Namespaces Available](https://enterprise.wikimedia.com/docs/api/#tag/namespaces/GET/v2/namespaces)                                                                                                                         |
| Wikidata item                       | `Q42`                                            | The QID on [Wikidata](https://www.wikidata.org/)                                                                                                                                                                            |
| Wikidata property                   | `P31`                                            | The PID on [Wikidata](https://www.wikidata.org/)                                                                                                                                                                            |
| Wikidata label                      | `Q42` or `P31`                                   | Either a QID or a PID                                                                                                                                                                                                       |
| On-demand article                   | `Squirrel`                                       | the [article name](#article-names)                                                                                                                                                                                          |

## How a snapshot identifier is built

Snapshot bundles, Structured Contents snapshots, and hourly batch files all share one recipe:

```text
<language><project_code>_namespace_<number>
```

| Identifier                  | Language | Project code | Namespace     | Contains                          |
| --------------------------- | -------- | ------------ | ------------- | --------------------------------- |
| `enwiki_namespace_0`        | `en`     | `wiki`       | 0 (Main)      | Articles from en.wikipedia.org    |
| `dewiki_namespace_14`       | `de`     | `wiki`       | 14 (Category) | Categories from de.wikipedia.org  |
| `frwikivoyage_namespace_10` | `fr`     | `wikivoyage` | 10 (Template) | Templates from fr.wikivoyage.org  |
| `nlwikibooks_namespace_6`   | `nl`     | `wikibooks`  | 6 (Files)     | Media files from nl.wikibooks.org |

The language and project code together are the **project identifier**, also found in the `identifier` field of the [Projects Available](https://enterprise.wikimedia.com/docs/api/#tag/projects/GET/v2/projects) endpoint, e.g. `eswikivoyage`. It's safer to read the `identifier` value rather than assembling the string yourself. Language codes do not all follow one standard and can be two or three characters (e.g. `chy` for Cheyenne), and not every project has a predictable project code (e.g. Wikidata's project identifier is `wikidatawiki`).

Chunk identifiers extend the same value with `_chunk_<number>`, so `dewiki_namespace_0` chunks are `dewiki_namespace_0_chunk_0`, `dewiki_namespace_0_chunk_1`, and so on. Take them from the `chunks` array of a [Snapshot Info](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots/{identifier}) response. The number of chunks varies per snapshot bundle.

Wikidata is the exception to the recipe. Its snapshots and hourly batches are addressed by `items` or `properties`, the bundles report `wikidata_items` and `wikidata_properties` as their `identifier`, and their chunks are `wikidata_items_chunk_0` and up. See [Wikidata snapshots](https://enterprise.wikimedia.com/docs/snapshot/#wikidata-snapshots).

Wikimedia Enterprise serves namespaces 0 (Main), 6 (File), 10 (Template), and 14 (Category). See [Namespaces](https://enterprise.wikimedia.com/docs/metadata/#namespaces) for info on what data each Namespace contains.

### Structured Contents is a subset

Structured Contents snapshots use the same identifier format, but are restricted to a smaller subset of projects that have been thoroughly tested and released in beta. Structured Contents snapshots currently cover the following projects: `enwiki_namespace_0`, `dewiki_namespace_0`, `frwiki_namespace_0`, `eswiki_namespace_0`, `ptwiki_namespace_0`, `itwiki_namespace_0`, `nlwiki_namespace_0`, `cywiki_namespace_0`, and `idwiki_namespace_0`.

## How to find a valid identifier

Discover identifiers by:

1. **Requesting metadata endpoints** [Snapshots Available](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots) returns every available snapshot bundle, [Hourly Batch Files Available](https://enterprise.wikimedia.com/docs/api/#tag/batches/GET/v2/batches/{date}/{hour}) does the same per date and hour, and [Snapshot Info](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots/{identifier}) lists a bundle's chunk identifiers. [Wikidata Snapshot Info](https://enterprise.wikimedia.com/docs/api/#tag/wikidata-snapshots/GET/v2/snapshots/wikidata/{identifier}) lists identifiers and metadata for the two Wikidata bundles.
2. **Building identifiers from multiple metadata fields** Call the [utility endpoints](https://enterprise.wikimedia.com/docs/metadata/#endpoints) in order (codes, languages, projects, namespaces) to confirm each part before you compose it. That reference data changes rarely, so cache it instead of requesting it on every run.

The recommended way to discover project snapshot identifiers is to request the [Snapshots Available](https://enterprise.wikimedia.com/docs/api/#tag/snapshots/GET/v2/snapshots) endpoint using the `fields` request body parameter to pass the `identifier` field. See the example request below.

```bash
curl --location 'https://api.enterprise.wikimedia.com/v2/snapshots' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--data '{ "fields": ["identifier"] }'
```

```json
[
  { "identifier": "abwiki_namespace_0" },
  { "identifier": "abwiki_namespace_6" },
  { "identifier": "abwiki_namespace_10" }
]
```

A request with a well-formed but nonexistent identifier returns [404](https://enterprise.wikimedia.com/docs/status-codes/), not a validation error, so a typo and an unavailable bundle look the same from the outside.

## Article names

The [On-demand API](https://enterprise.wikimedia.com/docs/on-demand/) addresses articles by name, which aren't unique identifiers: `/v2/articles/{name}` and `/v2/structured-contents/{name}` both take the article title as it appears on the wiki. Names are case sensitive, and spaces are passed as underscores (`Josephine_Baker`) or percent-encoded (`Josephine%20Baker`).

A name is not unique across Wikimedia projects. An unfiltered lookup returns a match from every project that has an article by that name, so filter on `is_part_of.identifier` for a project or `in_language.identifier` for a language to pin the result to one wiki. See [Fields, Filters, and Limit](https://enterprise.wikimedia.com/docs/filtering/) for the syntax.

## Identifiers inside a payload

Response bodies use `identifier` as a field name too, at several levels of the same object. They are not interchangeable with the path identifiers above.

| Field                    | Type   | Identifies                        | Example      |
| ------------------------ | ------ | --------------------------------- | ------------ |
| `identifier`             | number | The article's MediaWiki page ID   | `28492`      |
| `version.identifier`     | number | The revision, not the article     | `1041549311` |
| `is_part_of.identifier`  | string | The project                       | `enwiki`     |
| `in_language.identifier` | string | The language                      | `en`         |
| `namespace.identifier`   | number | The namespace                     | `0`          |
| `main_entity.identifier` | string | The Wikidata item for the article | `Q42`        |

An article `identifier` is a page ID, which is not the same as the article name. Page IDs can't be used as input to the On-demand API. The `version.identifier` is a revision ID that changes with every edit. Find definitions for all of the identifiers above in the [article model](https://enterprise.wikimedia.com/docs/api/#models/article).

## See also

- [Metadata](https://enterprise.wikimedia.com/docs/metadata/) - the utility endpoints that supply every part of an identifier.
- [Snapshot API](https://enterprise.wikimedia.com/docs/snapshot/) - download entire projects as compressed NDJSON tarballs.
- [Realtime API](https://enterprise.wikimedia.com/docs/realtime/) - hourly batches reuse the snapshot identifier format.
- [On-demand API](https://enterprise.wikimedia.com/docs/on-demand/) - article lookups by name.
- [Data Model](https://enterprise.wikimedia.com/docs/data-dictionary/) - how the objects in a payload fit together.
