---
id: "th_subdistrict_code"
kind: "datatype"
status: "draft"
is_pii: false
name: "Thai subdistrict code (tambon, khwaeng)"
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{4}$"
categories: ["geo", "government"]
country: ["TH"]
langs: ["common"]
quality: 90
url: "https://registry.apicrafter.io/datatype/th_subdistrict_code"
---

# Thai subdistrict code (tambon, khwaeng) (`th_subdistrict_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.

Six-digit code of a subdistrict of Thailand (tambon, or khwaeng in Bangkok): the four-digit district code (th_district_code) and two digits of the subdistrict, as in 100101 for Phra Borom Maha Ratchawang in the Phra Nakhon district of Bangkok. The open data of the Bangkok Metropolitan Administration carries it in a column named scode.

- 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{4}$
```

## Examples

- `100101` — Phra Borom Maha Ratchawang, Phra Nakhon, Bangkok
- `100501` — Anusawari, Bang Khen, Bangkok
- `290101` (invalid example) — 29 is not a province code

## Metacrafter rules

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

- `thsubdistrictcodebyname` (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/Tambon>

## Quality

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

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