---
id: "th_district_code"
kind: "datatype"
status: "draft"
is_pii: false
name: "Thai district code (amphoe, khet)"
regexp: "^(?:1[0-9]|2[0-7]|[34][0-9]|5[0-8]|6[0-7]|7[0-7]|8[0-6]|9[0-6])\\d{2}$"
categories: ["geo", "government"]
country: ["TH"]
langs: ["common"]
quality: 90
url: "https://registry.apicrafter.io/datatype/th_district_code"
---

# Thai district code (amphoe, khet) (`th_district_code`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Four-digit code of a district of Thailand (amphoe, or khet in Bangkok): the two-digit province code (th_province_code) and two digits of the district, as in 1001 for Phra Nakhon and 1030 for Chatuchak in Bangkok. The open data of the Bangkok Metropolitan Administration carries it in a column named dcode beside the district name.

- Personal data (PII): no
- Categories: Geographic identifiers (geo), Government related (government)
- Countries: Thailand (TH)
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:1[0-9]|2[0-7]|[34][0-9]|5[0-8]|6[0-7]|7[0-7]|8[0-6]|9[0-6])\d{2}$
```

## Examples

- `1001` — Phra Nakhon district, Bangkok
- `1030` — Chatuchak district, Bangkok
- `8301` — Mueang Phuket district
- `2801` (invalid example) — 28 is not a province code

## Metacrafter rules

1 rules: 1 match the field name, 0 match values.

- `thdistrictcodebyname` (field, `th/th_codes.yaml`)

## Supported by tools

- [`metacrafter`](https://registry.apicrafter.io/tool/metacrafter.md)

## Translations

- th: รหัสอำเภอ
- ru: Код района Таиланда (ампхе, кхет)

## Sources

- wikipedia: <https://en.wikipedia.org/wiki/List_of_districts_of_Bangkok>

## Quality

Score 90/100. Missing: mapping (Wikidata, Schema.org, ...).

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