duplicateInvoice
Requires at least one of the permissions payments:invoice:create or purchase:purchase_invoice:create.
Creates a new invoice as a copy of an existing one, with the same lines and details, a new invoice number and the status DRAFT. The original is not changed. A user restricted to their own customers cannot copy an invoice outside that book.
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 DuplicateInvoice($id: ID!) {
duplicateInvoice(id: $id) {
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 DuplicateInvoice($id: ID!) {\n duplicateInvoice(id: $id) {\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"
}
}
EOF
Variables:
{
"id": "id"
}
Response:
{
"data": {
"duplicateInvoice": {
"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
}
]
}
}
}
duplicateInvoice(
id: ID!
): Invoice!
Arguments
duplicateInvoice.id ● ID! non-null scalar
The ID of the invoice to copy.
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.