Generator · Latvian data
Latvian registracijas numurs
Endpoint GET /v1/lv/registracijas-numurs
What it covers
Returns a valid Latvian registracijas numurs (legal-entity registration number) satisfying the official weighted-sum validity rule. Use `format` for the LV VAT number. Set `invalid=true` for a number with a deliberately broken validity rule.
How it’s calculated
A Latvian legal-entity registration number is valid when the position-weighted sum of all 11 digits is congruent to 3 modulo 11; the last digit acts as the check digit that forces this residue.
Algorithm
- Take the 11-digit number as digits d1 d2 … d11, read left to right. d1 is the leading digit (4 or 5 for legal entities). d11 is the trailing/check digit.
- Use the fixed position weights w = [9, 1, 4, 8, 3, 10, 2, 5, 7, 6, 1], aligned so that w1=9 multiplies d1, w2=1 multiplies d2, …, w11=1 multiplies d11.
- Compute the weighted sum S = Σ (wi × di) for i = 1..11 (multiply each digit by its weight and add all eleven products).
- The number is valid when S mod 11 == 3. There is no complement and no overflow/'X' handling — the rule is a plain congruence check on the whole number, not a formula that derives an isolated check digit.
- To CHOOSE a check digit d11 for a known payload d1..d10: compute the partial sum P = Σ (wi × di) for i = 1..10. Because w11 = 1, you need (P + d11) mod 11 == 3, i.e. d11 = ((3 − P) mod 11 + 11) mod 11. If that value is 10 the number cannot be made valid with a single digit at that position, so redraw the payload (the generator loops, drawing all ten free digits again, until a candidate satisfies S mod 11 == 3).
Worked example
Latvian registracijas numurs 400030030 3? (leading 4, weights [9,1,4,8,3,10,2,5,7,6,1])
First 10 digits d1..d10 = 4 0 0 0 3 0 0 3 0 3; weights w1..w10 = 9 1 4 8 3 10 2 5 7 6.
Products: 9×4=36, 1×0=0, 4×0=0, 8×0=0, 3×3=9, 10×0=0, 2×0=0, 5×3=15, 7×0=0, 6×3=18.
Partial sum P = 36+0+0+0+9+0+0+15+0+18 = 78. P mod 11 = 1 (78 = 7×11 + 1).
Need (P + w11×d11) mod 11 == 3 with w11 = 1, so (78 + d11) mod 11 == 3, i.e. d11 = ((3 − 1) mod 11) = 2.
Check: total S = 78 + 1×2 = 80; 80 mod 11 = 3 (80 = 7×11 + 3). Rule satisfied.The check digit is 2, giving the full valid registracijas numurs 40003003032.
Edge cases
- A valid number ending in 0 (zero-tail) is explicitly generated as an edge case — d11 = 0 is legitimate whenever the partial sum P already satisfies P mod 11 == 3.
- Legal-entity numbers must begin with 4 or 5 (LEGAL_ENTITY_LEADS); the generator forces d1 into {4,5}, and edge mode can force either lead individually.
Gotchas
- The scheme has no dedicated check-digit derivation step in the source. The generator draws all ten free digits and keeps the candidate only if the whole 11-digit weighted sum ≡ 3 (mod 11); it does not solve for the last digit. Because the last weight is 1, the last digit nonetheless functions as the effective check digit.
- The target residue is 3, not 0 — a common mistake is assuming Σ·w mod 11 == 0. Here validity means S mod 11 == 3.
- When the required last digit would be 10 (no single decimal digit), that payload is simply unusable and the loop redraws — so not every arbitrary 10-digit prefix can be completed to a valid number.
Parameters
| Parameter | Type | Description |
|---|---|---|
| count | integer1–1000 | Number of records to return, 1–1000 (your plan may lower this). Omitted returns a single record; set it for a batch. |
| edge | boolean | Restrict output to valid edge-case numbers from the rare corners. |
| extreme | boolean | Return a correct value wrapped in a hostile encoding (untrimmed whitespace, invisible/zero-width characters, BOM, or bidi/combining marks). Homoglyphs are excluded so the value stays machine-parseable; it still validates after normalisation. |
| format | "national" | "vat" | Rendering: bare 11-digit number (default) or LV VAT number. |
| invalid | boolean | Return a number with a deliberately broken validity rule. |
| seed | integer | Integer seed for reproducible output: the same seed always yields the same record. |
Response fields
| Field | Type | Description |
|---|---|---|
| value | string | The identifier in the requested format (national or VAT). |
| digits | string | The canonical, unprefixed 11-digit number. |
Other generators for Latvia
Latvian companyLatvian company nameLatvian email addressLatvian IBANLatvian personLatvian person nameLatvian personas kodsLatvian product or service offeringLatvian vehicle registration plate
See all generators for Latvia →The same kind of identifier elsewhere
Austrian data · Austrian FirmenbuchnummerAustrian data · Austrian SteuernummerAustrian data · Austrian UIDBelgian data · Belgian OndernemingsnummerBulgarian data · Bulgarian EIKCzech data · Czech IČODanish data · Danish CVRDutch data · Dutch btw-idDutch data · Dutch KvK numberDutch data · Dutch RSINEstonian data · Estonian KMKREstonian data · Estonian registrikoodFrench data · French SIRENGerman data · German HandelsregisternummerGerman data · German Personalausweis numberGerman data · German USt-IdNrGerman data · German Wirtschafts-IdNrHungarian data · Hungarian adószámHungarian data · Hungarian cégjegyzékszámIrish data · Irish CRO numberIrish data · Irish VAT numberItalian data · Italian Partita IVALithuanian data · Lithuanian įmonės kodasLithuanian data · Lithuanian PVM (VAT) numberLuxembourg data · Luxembourg TVAMaltese data · Maltese identity card numberMaltese data · Maltese VAT numberPolish data · Polish driving licence numberPolish data · Polish ID card numberPolish data · Polish KRS numberPolish data · Polish land and mortgage register numberPolish data · Polish NIPPolish data · Polish passport numberPolish data · Polish REGONPortuguese data · Portuguese Cartão de Cidadão numberRomanian data · Romanian CUI/CIFSlovak data · Slovak IČ DPHSlovak data · Slovak IČOSpanish data · Spanish CIFSwedish data · Swedish organisationsnummer
Try it