atcud.format
ATCUD format: free checker and the rules since 2023
Mandatory unique-document code: a validation code of at least 8 characters, a dash, and the document number. Includes a free ATCUD checker.
Check an ATCUD
This checks the format only. It does not confirm that AT issued the code for your series.
Checking ATCUDs one by one? SAFTCheck checks every ATCUD in your SAF-T file at once, along with NIFs, dates and encoding.
Validate your SAF-T, freeWhat ATCUD is
ATCUD (Código Único de Documento) is a unique document code AT mandates on every invoice, receipt, transport document and SAF-T entry since 1 January 2023. It links the document to a registered series at AT plus a sequential position within that series.
The format
ATCUD has two parts joined by a single dash:
<VALIDATION-CODE>-<SEQUENCE>
- Validation code: at least 8 uppercase letters and digits (A–Z, 0–9), with no maximum length. AT issues this when you register a document series.
- Sequence: the document's number within the series (the digits after the
/in the document number, e.g.FT A/123→123).
SAFTCheck applies the regex:
/^[A-Z0-9]{8,}-(?!0+$)\d+$/
Source: Portaria n.º 195/2020, article 3, and AT FAQ 4333 ("there is no maximum length for the series validation code").
Examples
| Value | Verdict | Why |
|---|---|---|
AAJFK4DH-1 | ✓ | 8 uppercase + dash + 1 |
BCDEF123-99 | ✓ | 8 uppercase + dash + 99 |
1234ABCD-1000000 | ✓ | Mix of digits + letters OK |
AAJFK4DHX9-12 | ✓ | Codes longer than 8 characters are valid |
0 | ✓ (sentinel) | Allowed for documents whose series predates ATCUD obligations |
aaaaaaaa-1 | ✗ | Lowercase validation code |
AAJFK4DH1 | ✗ | Missing dash |
AAJFK4DH-0 | ✗ | Sequence must be ≥ 1 |
AAJFK4DH-001 | ✓ | Leading zeros are fine: the number comes from the document number (FT A/001) |
SHORTCD-1 | ✗ | Validation code must have at least 8 characters |
ATCUD:AAJFK4DH-1 | ✗ | The ATCUD: label belongs on the printed invoice, not in SAF-T |
How to fix
Look at the offending document in your ERP and the series registration on the AT portal:
- Confirm the series validation code with AT (Portal das Finanças → Faturação → Comunicação de séries).
- Make sure the ERP stores the validation code in uppercase exactly as AT issued it.
- Re-emit the document with the corrected ATCUD — or use the inline editor to patch this one occurrence in place. The editor includes a one-click UPPERCASE button for the common lowercase-validation-code case.
Related
- NIF Mod-11 — the entity-level identifier, separate from ATCUD.
- Inline editor — fix an ATCUD without re-emitting the document.
- Walkthrough: ATCUD format errors and how to fix them