TF Fiscal

Audit

POST/api/audit/run

Run tax audit

Runs the digital tax audit over the invoices already stored for the authenticated company — without generating a file or relying on an external validator. Scope: NF-e (model 55), production invoices only (homologation is ignored). It runs two rules: numbering gaps/omissions (numbers missing between the lowest and highest authorized number, per series) and duplicates (the same key stored more than once, or the same order authorized more than once). The period is optional; without a period, it audits all of the company's invoices.

Required headers

tokenstringstringCompany token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body — parameters (all optional)

monthnumbernumberMonth (1–12).
yearnumbernumberYear of month (default: current year).
start_datestringstringStart of the period, in dd/MM/yyyy or dd/MM/yyyy HH:mm:ss format.
end_datestringstringEnd of the period (same format).
start_create_timenumbernumberStart of the period as a Unix timestamp (milliseconds).
end_create_timenumbernumberEnd of the period as a Unix timestamp (milliseconds, exclusive).

All fields are optional. Precedence: month (+year) › start_date/end_date › start_create_time/end_create_time › none (audits all invoices).

Response — fields

company_idnumbernumberID of the audited company
periodoobjectobjectPeriod actually audited (São Paulo time zone, format dd/MM/yyyy HH:mm:ss), with de and ate; an end that was not specified is null.
notas_puladasarrayarrayNumbering rule.
notas_duplicadasarrayarrayDuplicate rule.

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/audit/run" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json