Duplicate a sales invoice into a new draft
POST/api/v1/invoices/:id/duplicate
Creates a new draft sales invoice from an existing one, whatever the source's lifecycle state. The source is left untouched.
The copy keeps the customer, the type code, the currency, the lines and the discounts. Seller, buyer and payment means are rebuilt from the company's and the customer's current data rather than copied. The copy gets a temporary draft number, today's issue date and no invoicing period. Its due date carries the source's payment term over: as many days after today as the source's due date was after its own issue date, and never earlier than today. A source stating no due date, or issued as already paid (its due date is then the payment date, not a term), gives the copy a due date 30 days after today. A source whose term would put the copy's due date past 9999-12-31 is refused.
Only sales invoices issued by the workspace can be duplicated: a purchase invoice or a self-billed invoice is refused. The source's buyer must be linked to a customer.
Authorization is based on the OAuth application's write access to the invoice's workspace.
Request
Responses
- 201
- 401
- 403
- 404
- 422
The new draft invoice, with its own id and lifecycle_state: draft.
The request did not include a valid OAuth 2.0 access token
The access token lacks the write scope, or the invoice cannot be duplicated because it is a purchase invoice or a self-billed invoice
No invoice exists with the given ID, or it belongs to another workspace
The invoice could not be duplicated, for example because its buyer is not linked to a customer; message reports the reason