Skip to main content
Skip to main content

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:

PositionFieldLengthMeaningExample
1-3Country3 digitsCode 506506
4-9Date6 digitsDDMMAA290924
10-21Emitter12 digitsTax Identification003101123456
22-41Consecutive20 digitsBranch, POS, Type, Sequential00100001010000000001
42Situation1 digit1, 2 or 31
43-50Security8 digitsSecurity code12345678

Validation Algorithm

Validation sequence executed:

Length = 50 decimal digits
  1. 1. Remove hyphens and whitespace characters.
  2. 2. Ensure exact length of 50 decimal digits.
  3. 3. Confirm country prefix is '506'.
  4. 4. Validate Gregorian day and month values.
  5. 5. Validate recognized document type codes.
  6. 6. Confirm valid situation and security codes.

Frequently Asked Questions (FAQ)