I am getting a validation error from the Xero API:
Invoice not of valid status for modification
The message is too generic, and we have no idea why we are getting it or how to fix it.
I've tried different status values:
- DRAFT
- AUTHORISED
But I get the same response:
{
"ErrorNumber": 10,
"Type": "ValidationException",
"Message": "A validation exception occurred",
"Elements": [
{
"Type": "ACCPAY",
"InvoiceID": "1cb8f5c6-xxxx-xxxx-xxxx-9ca48a1cac06",
"InvoiceNumber": "CS-001854",
"Payments": [],
"CreditNotes": [],
"Prepayments": [],
"Overpayments": [],
"AmountDue": 1350.00,
"HasErrors": true,
"IsDiscounted": false,
"Attachments": [],
"Contact": {
"ContactID": "3dd542c0-xxxx-xxxx-xxxx-176cc1c484d8",
"Addresses": [],
"Phones": [],
"ContactGroups": [],
"SalesTrackingCategories": [],
"PurchasesTrackingCategories": [],
"ContactPersons": [],
"Attachments": [],
"HasValidationErrors": false,
"ValidationErrors": [],
"Warnings": []
},
"DateString": "2018-08-31T00:00:00",
"Date": "\/Date(1535673600000+0000)\/",
"DueDateString": "2018-09-14T00:00:00",
"DueDate": "\/Date(1536883200000+0000)\/",
"Status": "DRAFT",
"LineAmountTypes": "Exclusive",
"LineItems": [
{
"Description": "Services",
"UnitAmount": 450.00,
"TaxType": "NONE",
"TaxAmount": 0.00,
"LineAmount": 450.00,
"AccountCode": "6021",
"Tracking": [],
"Quantity": 1.0000,
"ValidationErrors": [],
"Warnings": []
},
{
"Description": "Services",
"UnitAmount": 450.00,
"TaxType": "NONE",
"TaxAmount": 0.00,
"LineAmount": 450.00,
"AccountCode": "6021",
"Tracking": [],
"Quantity": 1.0000,
"ValidationErrors": [],
"Warnings": []
},
{
"Description": "Services",
"UnitAmount": 450.00,
"TaxType": "NONE",
"TaxAmount": 0.00,
"LineAmount": 450.00,
"AccountCode": "6021",
"Tracking": [],
"Quantity": 1.0000,
"ValidationErrors": [],
"Warnings": []
}
],
"SubTotal": 1350.00,
"TotalTax": 0.00,
"Total": 1350.00,
"CurrencyCode": "GBP",
"ValidationErrors": [
{
"Message": "Invoice not of valid status for modification"
}
],
"Warnings": []
}
]
}
Reference: