---
title: "Change a draft invoice"
method: PATCH
path: "/invoices/{id}"
tags: ["Invoices"]
---

# Change a draft invoice

`PATCH /invoices/{id}`

## Request

- Base URL: `https://www.billingengine.com/api/v1`
- URL: `https://www.billingengine.com/api/v1/invoices/{id}`
- Auth: HTTP bearer

Only draft invoices can be changed. When items are sent they replace all existing items. PUT is accepted as well.

## Request body

- InvoiceInput
  - `customer_id` integer: Required when creating an invoice.
  - `items` ItemInput[]: Required when creating an invoice. When changing a draft, the items replace all existing items.
    - `title` string, required
    - `description` string
    - `quantity` number
    - `unit_code` string
    - `tax_rate` number
    - `price` number, required: Net or gross, depending on the setting "Prices" of the account.
  - `date` string, date
  - `due_days` integer
  - `opening_text` string
  - `closing_text` string
  - `service_period_start_date` string, date
  - `service_period_end_date` string, date
  - `prices_include_tax` boolean: true for gross prices, false for net prices. If it differs from the account setting, the request is refused with 422.

## Response `200`

The changed invoice.

- InvoiceDetail
  - `id` integer
  - `number` string
  - `date` string, date
  - `due_date` string, date, nullable
  - `customer` CustomerReference
    - `id` integer
    - `name` string
  - `delivery_status` 'draft' | 'sent' | 'downloaded'
  - `payment_status` 'open' | 'paid' | 'defaulted' | 'cancelled' | 'cancellation'
  - `overdue` boolean
  - `cancelled` boolean
  - `cancellation` boolean: True for a cancellation invoice (credit note) of another invoice.
  - `currency` string
  - `prices_include_tax` boolean
  - `net_amount` number
  - `tax_amount` number
  - `gross_amount` number
  - `open_amount` number
  - `original_invoice_number` string, nullable
  - `language` string
  - `vat_treatment` 'standard' | 'exempt' | 'reverse_charge' | 'intra_community' | 'export_outside_eu' | 'zero_rated' | 'outside_scope'
  - `service_period_start_date` string, date, nullable
  - `service_period_end_date` string, date, nullable
  - `opening_text` string, nullable
  - `closing_text` string, nullable
  - `items` InvoiceItem[]
    - `number` integer
    - `title` string
    - `description` string, nullable
    - `quantity` number
    - `unit_code` string, nullable: Unit code (UN/ECE Recommendation 20), for example C62 for pieces.
    - `price` number
    - `tax_rate` number: Tax rate in percent.

## Other responses

- `400`: Malformed request: missing parameter, invalid JSON, invalid date or invalid filter.
- `401`: Missing or invalid API key.
- `403`: The API is not available in the Free plan, or the monthly invoice maximum of the plan has been reached.
- `404`: Record not found.
- `422`: The record is invalid. The messages explain why.

---

[API](https://skmtc.dev/billingengine/apis/billingengine-api.md) · [All operations](https://skmtc.dev/billingengine/apis/billingengine-api/llms.txt) · [OpenAPI document](https://skmtc.dev/billingengine/apis/billingengine-api/revisions/71d8ea5fb554?raw)
