## TL;DR

Xero validates every bill line against real account codes and tax types; wrong codes fail the whole create. Look up valid account codes and tax types for the organization first, map your chart of accounts to Xero codes, and validate lines before sending. The API returns per-line errors, so fix all lines, not just the first.

## Error

```text
ValidationException: The Account code '6100' is not valid for this organisation. TAXTYPE 'GST' is not valid.
```

## Steps

1. Fetch the organization's valid account codes via the Accounts endpoint.
   Expected: The allowed code list.
2. Fetch valid tax types via the TaxRates endpoint.
   Expected: The allowed tax types.
3. Map your internal codes to Xero codes.
   Expected: A mapping table.
4. Validate all lines before the create call.
   Expected: No surprises.
5. Create the bill.
   Expected: A 200 with the new invoice ID.

## When to use

- Xero API bill creates fail validation
- Multi-entity Xero setups
- Chart-of-accounts mapping projects

## When not to use

- NetSuite or QuickBooks errors
- Xero auth errors
- UI bill entry

## Compatibility

Xero Accounting API.

## Variant phrasings

### Xero bill ACCOUNT invalid

### TAXTYPE validation Xero bill

### Xero invoice validation exception

## Root cause

Xero validates codes against the organization's live chart of accounts and tax configuration. Integrations carrying another system's codes fail until mapped.

## Edge cases

- Tracking categories are also validated; include them in mapping
- Tax types differ by country edition of Xero
- Archived accounts fail validation like invalid ones

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_ZDv1W5PD-_HPkBSWmLqnwA
