---
title: "XAF Audit Export"
space: "ERPNext"
url: "https://www.prilk.com/docs/erpnext/localization/netherlands/xaf-export"
updated: "2026-05-14"
---

# XAF Audit Export

When the Belastingdienst comes knocking — or you're handing your books to a
new accountant, or doing a due-diligence review for an acquisition — you'll
need to produce an audit file in **XAF 3.2.1** format. This module
generates one from your ERPNext data, validates it against the official
XSD, and saves the result as an attachment.

## What XAF is

XAF (Standard Audit File for Tax — Netherlands flavour) is the
Belastingdienst-specified XML format for sharing accounting data with tax
inspectors. Every accounting system used in NL is expected to be able to
produce one. The current schema is **3.2.1**.

The format covers everything an inspector wants to verify:

- **Company info** — name, tax number, period, currency, software version
- **Chart of Accounts** — every GL account with its RGS reference
- **Customers and Suppliers** — name, IBAN, VAT number, KVK number, address
- **General Ledger transactions** — every journal entry in the period with
  date, debit/credit, description, source document reference
- **VAT codes** — the tax codes applied per line
- **Opening balances** — starting position at the period start

## When you'd need it

- **Belastingdienst audit** — they ask for an XAF covering the audit
  period; you give them this file.
- **Year-end archival** — many accountants ask for a yearly XAF as part of
  the close.
- **Due diligence** — when a buyer or investor is reviewing your books, an
  XAF is the cleanest way to hand over everything they need without
  exposing your live system.
- **Switching accountants** — the new firm can ingest an XAF directly into
  their audit tooling.

## Generating an XAF file

1. Search **NL Audit File** in the awesomebar → **New**.
2. **Company** — pick the company.
3. **From Date / To Date** — the audit period. Typically a calendar year
   for yearly archives; can be any range for an inspection.
4. **Save**. The form now shows a **Generate XAF** button.
5. **Click Generate XAF**. The module:
   - Pulls every GL Entry in the period
   - Builds the XAF tree (header → company → general ledger → transactions → VAT codes)
   - Validates the result against the Belastingdienst's XSD schema
   - Attaches the file (or shows a validation error pointing at the issue)

A typical year for an SMB produces a 1–10 MB XAF. Large companies with
millions of transactions can produce 100 MB+ files — the generator streams
the output to avoid memory issues.

## Schema validation

The file is validated against the official Belastingdienst XSD before being
attached — you'll know immediately if anything's malformed (e.g., an
account missing a description, a customer without a VAT number where one is
required, a transaction with a date outside the declared period).

Validation errors are reported with the XPath of the offending node, so
you can fix the underlying data and regenerate. The most common causes:

- **A Customer or Supplier missing tax_id** — XAF requires it for parties
  doing business above thresholds. Edit the party, fill in the VAT number,
  regenerate.
- **An Account without an RGS code** — fix by running *Setup Dutch
  Localization* again (it tops up missing RGS links).
- **GL entries with no posting date** — shouldn't happen in normal ERPNext
  flow; check for manually inserted journal entries.

## What inspectors look for

Common questions during a tax audit, and where in the XAF the answer
lives:

- *Total sales in the period, broken down by VAT rate* — the General
  Ledger section, filtered by your sales accounts and the VATCode field.
- *Total purchases from EU suppliers vs domestic* — the Suppliers section
  cross-referenced with transaction VATCodes (e.g. EU-B2B reverse charge).
- *Cash transactions over €25,000* — flagged in the transaction
  descriptions if you've recorded them properly.

If the inspector has follow-up questions, you can usually answer them from
the same data inside ERPNext (using *NL VAT Return Details* or *General
Ledger* reports).

## File retention

You're required to retain accounting records — including XAF files — for
**seven years**. We recommend generating an XAF at the end of each
calendar year and keeping the file in your document archive (Drive,
Nextcloud, SharePoint — whichever you use). The Frappe Files area is also
fine but tends to grow unbounded.
