# Invoices and credit notes

## Issuing an invoice

`POST /v1/invoices` posts tax invoices: one balanced journal each, the customer's receivable raised, output VAT recorded.

```json
[{
  "external_ref": "ORD-5001",
  "customer_external_ref": "CUST-1001",
  "doc_date": "2026-12-01",
  "reference": "ORD-5001",
  "notes": "Delivered to the Sandton branch",
  "lines": [
    {"description": "Consulting, November", "quantity": 10, "unit_price": 100.00,
     "amount_excl_tax": 1000.00, "tax_amount": 150.00, "item_code": "CONSULT"}
  ]
}]
```

- **You never send the invoice number.** ReconSmiths takes the next number in the tax invoice sequence inside the posting, so a refused invoice returns its number and the sequence has no gaps. Your order number goes in `reference`: it prints on the invoice and is what the customer pays against.
- **Due date** comes from the customer's terms unless you send `due_date`.
- **Lines** carry the amount excluding VAT and the VAT, as you printed them. `tax_code` is optional (standard rate by default); send it for zero-rated or exempt lines. `item_code` names a product from [Items](../reference/items.html). `account_code` picks a revenue account other than the default.
- **Billing address**: send `billing_address` to freeze the address this order was billed to; otherwise the invoice prints the customer's current address.

The answer lists each invoice with our `document_id` and `created` (false when you had already sent it).

## Changing an invoice

An issued tax invoice cannot change its amounts, date, customer or currency: that is the law and the ledger. What you can do:

| You want to | Do this |
|---|---|
| Correct the notes line (for example, which site it was for) | `PUT /v1/invoices/{externalRef}/notes` with `{"notes": "..."}`. Number and amounts stay; the change is audited; the next PDF prints it. |
| Cancel it entirely | `POST /v1/invoices/{externalRef}/void` with a `reason`. A mirror journal reverses it; the number stays used and shows as void. Refused while a payment or credit note is allocated to it. |
| Reduce it, or reverse part of it | A credit note (below). |
| Replace it | Void it and issue a new one under a new `external_ref`. |

## Credit notes

`POST /v1/credit-notes`, always with a `reason`. Three shapes:

1. **The whole invoice:** `invoice_external_ref`, no lines. The ordinary cancelled-order case.
2. **Part of an invoice:** `invoice_external_ref` plus the lines being credited.
3. **On the account, tied to no invoice:** `customer_external_ref` plus lines. Goodwill, a price correction, a deposit refund. It sits on the account as credit and can be applied to a later invoice with an allocation.

Set `mark_for_refund: true` if the customer wants the money back rather than credit; see [Payments and allocations](06-payments-and-allocations.md). A credit note raised in error is voided with `POST /v1/credit-notes/{externalRef}/void`.

## Is it paid?

`GET /v1/documents?externalRefs=ORD-5001,ORD-5002` answers for many invoices in one call: outstanding, paid, credited, and what settled it. It is worked out from the allocations every time, so do not store it as a yes/no; ask again, or listen for the `invoice.paid` webhook. References that match nothing come back under `not_found`.

## The document itself

`GET /v1/documents/{externalRef}/pdf` is the tax invoice exactly as issued, on the company's letterhead. `GET /v1/documents/{externalRef}/content` is the same as JSON or XML. Fetch the PDF once when the invoice is posted and keep it; fetch again after a credit note or a notes change.
