SAFTCheck
Blog

Updated 2026-10-01 3 min read

ATCUD format errors and how to fix them

The validation code (at least 8 characters), the dash, the document number: what AT expects since 2023 and the patterns that fail.

What 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. Each document carries an ATCUD that links it to a registered series at the AT and to a sequential position within that series.

The format AT expects

An ATCUD has two parts joined by a dash:

<VALIDATION-CODE>-<SEQUENCE-NUMBER>
  • 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 number: the document's number within the series, i.e. the digits after the / in the document number (FT A/123 → 123).

Examples that match:

AAJFK4DH-1
BCDEF123-99
1234ABCD-1000000
AAJFK4DHX9-12
AAJFK4DH-0001

Examples that fail:

aaaaaaaa-1       (lowercase validation code)
AAJFK4DH1        (missing dash)
AAJFK4DH-0       (sequence cannot be 0)
SHORTCD-1        (validation code less than 8 chars)
ATCUD:AAJFK4DH-1 (the label belongs on the printed invoice, not in SAF-T)

The literal value 0 is also accepted as a sentinel for documents whose series predates ATCUD obligations — but you should not be emitting new documents with this sentinel in 2026.

What the rules say

Portaria n.º 195/2020 (article 3) defines the format: the series validation code issued by AT, with at least 8 characters, a dash, and the document's sequential number, which is the digits after the slash in the document number. AT's FAQ 4333 adds that the validation code has no maximum length. As a regex:

/^[A-Z0-9]{8,}-(?!0+$)\d+$/

If your ERP produces values that don't match, AT rejects the file. Common causes: the validation code exported in lowercase, the dash missing, or the ATCUD: label copied into the SAF-T field.

Where to find errors fast

SAFTCheck scans every <ATCUD> element in your file and lists each one that doesn't match. You get the offending value and the rule that fired, so you can grep it back to the originating document in your ERP and re-emit.

Validate your SAF-T file. It's free: 3 checks a day without an account, 5 when signed in.

Other posts