Costa Rica Electronic Invoice Key Validator (Clave de Factura)
Validate structural syntax, document type classifications, and metadata of 50-digit Costa Rican invoice keys.
How does invoice key validation work?
The validator verifies strict 50-digit numerical length, country code 506 for Costa Rica, Gregorian calendar validity of the emission date, emitter ID format, consecutive segment components, situation code, and security code integrity.
Both continuous 50-digit numerical strings and hyphenated formatted inputs are supported.
50-Digit Structural Layout
Functional fields inside the key:
| Position | Field | Length | Meaning | Example |
|---|---|---|---|---|
| 1-3 | Country | 3 digits | Code 506 | 506 |
| 4-9 | Date | 6 digits | DDMMAA | 290924 |
| 10-21 | Emitter | 12 digits | Tax Identification | 003101123456 |
| 22-41 | Consecutive | 20 digits | Branch, POS, Type, Sequential | 00100001010000000001 |
| 42 | Situation | 1 digit | 1, 2 or 3 | 1 |
| 43-50 | Security | 8 digits | Security code | 12345678 |
Validation Algorithm
Validation sequence executed:
Length = 50 decimal digits
- 1. Remove hyphens and whitespace characters.
- 2. Ensure exact length of 50 decimal digits.
- 3. Confirm country prefix is '506'.
- 4. Validate Gregorian day and month values.
- 5. Validate recognized document type codes.
- 6. Confirm valid situation and security codes.