---
title: "Update a draft invoice (header and optional full line replace)"
method: PATCH
path: "/invoices/{id}"
tags: ["Invoicing"]
---

# Update a draft invoice (header and optional full line replace)

`PATCH /invoices/{id}`

## Request

- Base URL: `https://ledgerhq.pro/api/v1`
- URL: `https://ledgerhq.pro/api/v1/invoices/{id}`
- Auth: one of:
  - HTTP bearer and API key in header `x-organization-id`
  - HTTP bearer and API key in header `x-organization-id`

Only status=draft can be edited. When `lines` is present the entire line set is replaced atomically and subtotal/tax/total/amountDue are recomputed. Quantities are decimal units; unitPrice is major currency units; stored amounts are integer cents.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `ensureCatalogItems` boolean: Create/reuse active catalog items with revenue accounts atomically with the draft
  - `contactId` string, uuid
  - `issueDate` string, date
  - `dueDate` string, date
  - `reference` string, nullable
  - `notes` string, nullable
  - `currencyCode` string
  - `expectedUpdatedAt` string, date-time: Last observed updatedAt; stale edits return 409
  - `invoiceNumber` string
  - `lines` object[]: When present, fully replaces draft lines
    - `itemId` string, uuid, nullable: Reusable catalog item UUID
    - `description` string, required
    - `quantity` number
    - `unitPrice` number
    - `accountId` string, uuid, nullable
    - `taxRateId` string, uuid, nullable
    - `discountPercent` integer: Basis points (500 = 5%)

## Response `200`

Updated invoice

## Other responses

- `409`: Invoice is not a draft or was changed since expectedUpdatedAt
- `default`: Error response

---

[API](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api.md) · [All operations](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/revisions/9a8269f0a586?raw)
