Costa Rican invoice key reader
Paste the 50 positions of a key and you get which document it is, whose, and from what date. It is for identifying a document when the key is all you have: in an email, in a report or in a spreadsheet.
What a key carries inside it
The key is neither a running number nor a random identifier: it is a composite value, which is why it can be read without asking anyone anything. The 50 positions go like this:
| Positions | What it is |
|---|---|
| 1 – 3 | Country code. Costa Rica is 506 |
| 4 – 9 | Day, month and year of issue |
| 10 – 21 | The issuer's ID, padded with leading zeros |
| 22 – 41 | The sequential number: branch, terminal, document type and number |
| 42 | Situation: normal, contingency or offline |
| 43 – 50 | Security code, generated by the issuer |
A warning almost nobody gives: the key admits letters. Since decree 44648-MJ, new company IDs can contain them, and the key embeds the issuer's ID. Software that validates the key as “fifty digits” will work until the first company with a new-style ID turns up — and will then fail silently.
When you do not have to start from the key
Each document is found by customer, by date or by amount, and its status with the tax authority is next to it, with the signed response kept.
See how it works