---
id: "unece_rec20_unit_code"
kind: "pattern"
status: "draft"
is_pii: false
categories: ["values"]
langs: ["common"]
quality: 85
url: "https://registry.apicrafter.io/datatype/unece_rec20_unit_code"
---

# UN/ECE Recommendation 20 unit code (UN/CEFACT common code) (`unece_rec20_unit_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.

Two- or three-character code of a unit of measure from UN/ECE Recommendation 20, used in trade documents such as UN/EDIFACT and UBL invoices, for example KGM for kilogram or H87 for piece. Codes use uppercase letters and digits. Some lists, such as Peppol, add package codes from Recommendation 21 with an X prefix; they have the same shape but are not units.

- Pattern of: `unit_of_measure`
- Personal data (PII): no
- Categories: All measurable values (percentage, amount and e.t.c) (values)
- Countries: global
- Languages: Common to most languages (common)
- Classification: categorical

## Detection

Regular expression (Python `re`):

```
^[A-Z0-9]{2,3}$
```

## Examples

- `KGM` — kilogram
- `MTR` — metre
- `LTR` — litre
- `C62` — one (unit)
- `H87` — piece
- `KGMS` (invalid example) — four characters

## Mappings

- wikidata: `P6512`

## Sources

- doc: <https://unece.org/trade/documents/2021/06/uncefact-rec20-0>
- wikidata: <https://www.wikidata.org/wiki/Property:P6512>
- other: <https://github.com/datasets/unece-units-of-measure>

## Quality

Score 85/100. Missing: translation, detector coverage.

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