updateInvoice
Requires at least one of the permissions payments:invoice:update or purchase:purchase_invoice:update.
Changes an invoice. A fully paid invoice cannot be updated, and an invoice is cancelled with cancelInvoice, not through this mutation. A sales invoice keeps the currency it was raised in, and a purchase invoice cannot change currency once payments are allocated to it. The exchange rate must be greater than 0. Changing the payment term recalculates the due date unless you send one. The server recalculates the totals. A sales invoice needs the invoices update permission and a purchase invoice the purchase invoices update permission; moving an invoice to APPROVED also needs the sales invoice approve or purchase invoice approve permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation UpdateInvoice($id: ID!, $input: UpdateInvoiceInput!) {
updateInvoice(id: $id, input: $input) {
id
invoiceNumber
supplierCode
supplierDisplayName
supplierName
status
allocations {
id
invoiceNumber
paymentNumber
createdAt
amount
appliedFromAdvance
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation UpdateInvoice($id: ID!, $input: UpdateInvoiceInput!) {\n updateInvoice(id: $id, input: $input) {\n id\n invoiceNumber\n supplierCode\n supplierDisplayName\n supplierName\n status\n allocations {\n id\n invoiceNumber\n paymentNumber\n createdAt\n amount\n appliedFromAdvance\n }\n }\n}",
"variables": {
"id": "id",
"input": {}
}
}
EOF
Variables:
{
"id": "id",
"input": {}
}
Response:
{
"data": {
"updateInvoice": {
"id": "id",
"invoiceNumber": "string",
"supplierCode": "string",
"supplierDisplayName": "string",
"supplierName": "string",
"status": "APPROVED",
"allocations": [
{
"id": "id",
"invoiceNumber": "string",
"paymentNumber": "string",
"createdAt": "2025-01-15T00:00:00Z",
"amount": 0,
"appliedFromAdvance": true
}
]
}
}
}
updateInvoice(
id: ID!
input: UpdateInvoiceInput!
): Invoice!
Arguments
updateInvoice.id ● ID! non-null scalar
The ID of the invoice.
updateInvoice.input ● UpdateInvoiceInput! non-null input
The invoice changes.
Type
Invoice object
A sales invoice issued to a customer or a purchase invoice received from a supplier, with its lines, totals, status and settlement.