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

# Metadata

Metadata endpoints provide the reference data you'll need to use the APIs effectively. These utility endpoints return project codes, language identifiers, and namespace mappings. This information helps you build accurate API queries, filter results by project or language, and understand the structure of article responses. The reference data changes rarely, so call these endpoints once and cache the results rather than requesting them on every run.

## At a glance

- **Base URL:** `https://api.enterprise.wikimedia.com`
- **Auth:** JWT Bearer access token ([Authentication](https://enterprise.wikimedia.com/docs/authentication/))
- **Formats:** JSON
- **Response models:** [project](https://enterprise.wikimedia.com/docs/api/#models/project), [language](https://enterprise.wikimedia.com/docs/api/#models/language), [namespace](https://enterprise.wikimedia.com/docs/api/#models/namespace), [code](https://enterprise.wikimedia.com/docs/api/#models/code)
- **Access:** included with every account

## Endpoints

- [`/v2/codes`](https://enterprise.wikimedia.com/docs/api/#tag/codes/GET/v2/codes) - List all project codes (GET, POST)
- [`/v2/codes/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/codes/GET/v2/codes/{identifier}) - Receive info for one project code (GET, POST)
- [`/v2/languages`](https://enterprise.wikimedia.com/docs/api/#tag/languages/GET/v2/languages) - List all languages (GET, POST)
- [`/v2/languages/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/languages/GET/v2/languages/{identifier}) - Receive info for one language (GET, POST)
- [`/v2/projects`](https://enterprise.wikimedia.com/docs/api/#tag/projects/GET/v2/projects) - List all projects (GET, POST)
- [`/v2/projects/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/projects/GET/v2/projects/{identifier}) - Receive info for one project (GET, POST)
- [`/v2/namespaces`](https://enterprise.wikimedia.com/docs/api/#tag/namespaces/GET/v2/namespaces) - List all namespaces (GET, POST)
- [`/v2/namespaces/{identifier}`](https://enterprise.wikimedia.com/docs/api/#tag/namespaces/GET/v2/namespaces/{identifier}) - Receive info for one namespace (GET, POST)

Project codes correspond with different Wikimedia projects, e.g. `wiki` for Wikipedia and `wikibooks` for Wikibooks. Get metadata about a single project by requesting the `/{identifier}` variant of the endpoint. The worked example below shows what this looks like for English Wikipedia, `enwiki`. Every endpoint can be requested with GET or POST methods. You can use [filters and fields](https://enterprise.wikimedia.com/docs/filtering/) to narrow the response.

Use the utility endpoints in this order to find the correct project and language codes for your use case:

1. Find the projects you want data for by requesting GET [Project Codes Available](https://enterprise.wikimedia.com/docs/api/#tag/codes/GET/v2/codes), which will get you e.g. the identifier `wiki` for Wikipedia projects.
2. Request GET [Languages Available](https://enterprise.wikimedia.com/docs/api/#tag/languages/GET/v2/languages) to get the correct codes for the language(s) you need, e.g. `en` for English or `de` for German. The language codes for wiki projects don't all follow a specific ISO standard or other language code convention. Language codes can have two or three characters (*e.g. `chy` for Cheyenne*).
3. To find all project codes for a specific language, request POST [Projects Available](https://enterprise.wikimedia.com/docs/api/#tag/projects/GET/v2/projects) and use a filter to only receive project codes for a specific language.
4. Lastly, request GET [Namespaces Available](https://enterprise.wikimedia.com/docs/api/#tag/namespaces/GET/v2/namespaces) to get a list and description of the Namespaces you can request data for.

Example request body for step 3, returning all project codes with the language code `de` for German. The same pattern filters on any field, e.g. `code` with the value `wikibooks`.

```json
{
  "filters": [
    {
      "field": "in_language.identifier", "value": "de"
    }
  ]
}
```

## Worked example

Look up a single project to confirm its identifier and language before you construct Snapshot or Realtime requests. This call fetches English Wikipedia by its project identifier, `enwiki`.

The response is the complete [project model](https://enterprise.wikimedia.com/docs/api/#models/project): the human-readable name, the identifier you'll pass to other endpoints, the project URL, its project code, and the language it's written in.

```bash
curl -H "Authorization: Bearer ACCESS_TOKEN" \
  https://api.enterprise.wikimedia.com/v2/projects/enwiki
```

```json
{
  "name": "Wikipedia",
  "identifier": "enwiki",
  "url": "https://en.wikipedia.org",
  "code": "wiki",
  "in_language": {
    "identifier": "en"
  }
}
```

## Namespaces

Wikimedia Enterprise gives access to these namespaces:

| Identifier | Name     | Description                                                                                                                                                                                                                           |
| ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0          | (Main)   | The Article namespace, also known as the main or mainspace, is where a project's primary content resides.                                                                                                                             |
| 6          | File     | The Media namespace, identified as the File namespace, hosts all of a project's multimedia content. This includes images, videos, audio clips, and other media files, each starting with the prefix 'File:'.                          |
| 10         | Template | The Template namespace is dedicated to storing wikitext templates for inclusion on multiple pages, primarily through transclusion. While most templates are in this namespace, some may reside in others, like the User namespace.    |
| 14         | Category | The Category namespace groups pages on similar topics, using a MediaWiki feature that automatically lists pages marked with \[\[Category:XYZ]] in their markup. This helps in navigating and discovering related articles and topics. |

The namespace number is the last part of a Snapshot, Structured Contents, or hourly batch identifier, as in `dewikibooks_namespace_0`. The [Identifiers](https://enterprise.wikimedia.com/docs/identifiers/) guide covers how the rest of that value is composed from the codes, languages, and projects endpoints above.

For a deeper understanding of namespaces, see [Wikipedia:Namespace](https://en.wikipedia.org/wiki/Wikipedia:Namespace).

## Response model

Metadata endpoints return the [project](https://enterprise.wikimedia.com/docs/api/#models/project), [language](https://enterprise.wikimedia.com/docs/api/#models/language), [namespace](https://enterprise.wikimedia.com/docs/api/#models/namespace), and [code](https://enterprise.wikimedia.com/docs/api/#models/code) models. Project responses embed the language model under `in_language`, as in the worked example above. Article payloads from the other APIs reference the same identifiers under `is_part_of`, `in_language`, and `namespace`, so the values you cache here match what comes back everywhere else.

## See also

- [Identifiers](https://enterprise.wikimedia.com/docs/identifiers/) - what each endpoint's `{identifier}` expects, and how snapshot identifiers are composed from this reference data.
- [Fields, Filters, and Limit](https://enterprise.wikimedia.com/docs/filtering/) - narrow any metadata response to just the fields you need.
- [Getting Started](https://enterprise.wikimedia.com/docs/) - make your first authenticated call.
- [Supported projects](https://enterprise.wikimedia.com/project-data/) - the human-readable project list.
