Xero API validation errors on bills: ACCOUNT and TAXTYPE
Fixes Xero API bill validation errors for account codes and tax types. Use when bill creates fail validation on ACCOUNT or TAXTYPE. Not for NetSuite or QuickBooks.
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
ValidationException: The Account code '6100' is not valid for this organisation. TAXTYPE 'GST' is not valid.Steps
- Fetch the organization's valid account codes via the Accounts endpoint.
Expected: The allowed code list.
- Fetch valid tax types via the TaxRates endpoint.
Expected: The allowed tax types.
- Map your internal codes to Xero codes.
Expected: A mapping table.
- Validate all lines before the create call.
Expected: No surprises.
- 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/pstZDv1W5PD-HPkBSWmLqnwA
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.