# BR-04 Invoice type code is required

An invoice shall have an Invoice type code (BT-3) identifying the functional type of the document, such as a commercial invoice or a credit note.

## Problem Description

An invoice shall have an Invoice type code (BT-3) identifying the functional type of the document, such as a commercial invoice or a credit note.

> **ERROR**: XRechnung 3.0

## Context and Significance

This is a core EN16931 rule; the type code drives downstream processing and VAT handling, so every invoice must declare it.

## Solution

Add cbc:InvoiceTypeCode with an allowed UNTDID 1001 value, for example 380 for a commercial invoice or 381 for a credit note.

- validate
- convert

## Valid Examples

- BT-3 = 380 — commercial invoice
- BT-3 = 381 — credit note

## Invalid Examples

- cbc:InvoiceTypeCode element is missing from the invoice header

## Code Examples

### Valid XML
```
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
```

### Invalid XML
```
<cbc:IssueDate>2024-05-01</cbc:IssueDate>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
```

## Affected Fields

- [BT-3 Invoice type code](/resources/xrechnung/bt-3-invoice-type-code)

## Related Rules

- [BR-02](/resources/kosit-validator-errors/br-02-invoice-number-required)
- [BR-03](/resources/kosit-validator-errors/br-03-invoice-issue-date-required)

## Validation Tools

- [Official KoSIT Validator](https://erechnungsvalidator.service-bw.de/): Validate your XRechnung files against all BR-DE rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Automatic validation error fixes when converting.

## Related Resources

- [Official Specification](https://xeinkauf.de/xrechnung/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [Complete Error List](/resources/kosit-validator-errors): Overview of all German XRechnung validation rules.
