---
id: "de_ags"
kind: "datatype"
status: "stable"
is_pii: false
categories: ["geo"]
country: ["DE"]
langs: ["common"]
quality: 90
url: "http://registry.apicrafter.io/datatype/de_ags"
---

# German municipality key (Amtlicher Gemeindeschlüssel, AGS) (`de_ags`)

Eight-digit official code of a German municipality that the statistical offices publish in the municipality directory (Gemeindeverzeichnis): two digits for the state (01 Schleswig-Holstein to 16 Thüringen), one for the government region, two for the district and three for the municipality. The first five digits are the district key (Kreisschlüssel).

- Personal data (PII): no
- Categories: Geographic identifiers (geo)
- Countries: Germany (DE)
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:0[1-9]|1[0-6])\d{6}$
```

## Examples

- `03459033` — Wallenhorst
- `12060020` — Bernau bei Berlin
- `3459033` (invalid example) — Leading zero dropped
- `17060020` (invalid example) — There is no state 17

## Mappings

- wikidata: `P439`

## Translations

- de: Amtlicher Gemeindeschlüssel (AGS)
- ru: Официальный код общины Германии (AGS): Восьмизначный код общины - две цифры земли, одна цифра административного округа, две цифры района и три цифры общины.

## Sources

- wikipedia: <https://de.wikipedia.org/wiki/Amtlicher_Gemeindeschl%C3%BCssel>
- wikidata: <https://www.wikidata.org/wiki/Property:P439>
- doc: <https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/_inhalt.html>

## Quality

Score 90/100. Missing: detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/de_ags.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/DE/geo/de_ags.yaml>
