# Units and codes
> The document’s code lists: UNECE units with the words printed for them, ISO currencies and countries, VAT categories, payment means, document types, identifiers, ECLASS.
>
> Before: [The document](https://ocost.io/docs/en/document.md)

The code lists [`ocost.document.v1`](https://ocost.io/docs/en/document.md) uses, the standard behind each, and how Ocost gets from the printed word to the code. A value that is no code of its list is `null`, never the printed text.

## Units

`lines[].unit` is a code of UNECE [Recommendation 20](https://unece.org/trade/uncefact/cl-recommendations), or a package of Recommendation 21 as `X` and its code. These are the ones Ocost writes most:

| Code | Meaning | Printed as |
| --- | --- | --- |
| `C62` | One, a piece | Stück, Stk, St., шт., од. |
| `H87` | Piece | Carried by e-invoices |
| `HUR` | Hour | Std., h, год. |
| `DAY` | Day | Tag, день |
| `MON` | Month | Monat, міс. |
| `KGM` | Kilogram | kg, кг |
| `MTR` | Metre | m, lfm, м |
| `MTK` | Square metre | m², qm, м² |
| `LTR` | Litre | l, л |
| `KWH` | Kilowatt hour | kWh, кВт·год |
| `SET` | Set | Satz, компл. |
| `LS` | Lump sum | pauschal, psch. |
| `E48` | Service unit | послуга |
| `XCT` | Carton | Karton, Ktn |
| `XPK` | Package | Paket, VE, уп. |
| `XPX` | Pallet | Palette, Pal. |

Ocost asks the reading model for the code. A German, Ukrainian or Russian word it answers instead is mapped by a fixed table. A word that names no single unit, such as Kiste, stays unknown. `unit` is then `null`, never `C62`. An e-invoice's code is kept as it is. A bare `PF` is the pallet `XPX`.

## Currencies

`currency` is an [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) code. A printed sign becomes its code: € is `EUR`, £ `GBP`, ₴ and грн `UAH`, zł `PLN`. A sign several countries use, such as $ or kr, goes by the issuer's country. Without either, Ocost takes the supplier's usual currency, else your company's.

## Countries

An address's `country` is an [ISO 3166-1 alpha-2](https://www.iso.org/iso-3166-country-codes.html) code, such as `DE`, `UA` or `GB`.

## VAT categories

`vat_breakdown[].category` and `lines[].vat_category` are [UNCL 5305](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL5305/) as EN 16931 uses it: `S`, `Z`, `E`, `AE`, `K`, `G`, `O`, and `L`, `M`, `B` for Spain's and Italy's own. [Values](https://ocost.io/docs/en/document.md#values) explains each. Each country page shows how they are printed there.

## Payment means

`payment.means_code` is [UNCL 4461](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL4461/): `58` a SEPA credit transfer, `59` a SEPA direct debit, `48` a card. `payment.means` says the same as a word.

## Document types

`kind` and `kind_detail` are Ocost's own. `type_code` is [UNCL 1001](https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL1001-inv/), such as `380` for an invoice or `381` for a credit note. Where the document prints none, Ocost writes the code of its kind.

## Identifiers

`identifiers[].scheme` is Ocost's own list, such as `EU_VAT`, `DE_STNR`, `UA_EDRPOU`, `PL_NIP`, `US_EIN` or `MD_IDNO`. [Values](https://ocost.io/docs/en/document.md#values) lists them all. The country pages say how each is checked.

## Categories

[Search](https://ocost.io/docs/en/search.md) filters by `category`, an [ECLASS](https://eclass.eu) code of eight digits, such as `24000000`.

## Numbers and dates

Amounts and quantities are exact JSON numbers, rates are percents, dates are ISO 8601. [The document](https://ocost.io/docs/en/document.md#how-values-are-written) says how to read them.

## See also

- [The document](https://ocost.io/docs/en/document.md): The ocost.document.v1 schema in EN 16931 terms (maps to UBL and CII): an example, kind and direction, sources, checks, versions, and every field and value.
- [Search](https://ocost.io/docs/en/search.md): Search every document by words and by meaning: parameters, filters, results, examples.
- [Germany](https://ocost.io/docs/en/germany.md): German documents: Rechnung to Lieferschein by kind, USt-IdNr. and Steuernummer, VAT categories, the § 14 UStG check, XRechnung and ZUGFeRD.
