# invoices.preview

Render a PDF preview of a saved invoice or an unsaved draft without changing anything. Returns base64 PDF bytes, the number it would receive, and computed totals.

`GET | POST /api/v1/accounting/invoices.preview`

Permissions: `accounting:read` · Roles: admin, finance

MCP tool: `accounting_invoices_preview`

## Fields

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `id` | string (ID) |  | The record's ID. |
| `draft` | object |  | No other fields. |
| `draft.partyId` | string (ID) | Yes | The ID of a customer or vendor account, from parties.list. |
| `draft.title` | string |  | A short title. at most 200 characters. |
| `draft.issueDate` | string or null |  | The date the document was issued, as YYYY-MM-DD. |
| `draft.dueDate` | string or null |  | The date payment is due, as YYYY-MM-DD. |
| `draft.currency` | string |  | Three-letter currency code, such as CAD or USD. |
| `draft.lines` | array of objects |  | at most 100 items. |
| `draft.lines[].id` | string |  | The record's ID. at most 64 characters. |
| `draft.lines[].description` | string | Yes | A short description. 1–500 characters. |
| `draft.lines[].quantity` | string |  |  |
| `draft.lines[].unitAmountMinor` | string |  | An amount in cents (the currency's smallest unit), written as a whole-number string such as "1250" for $12.50. Whole number written as a string, may be negative. |
| `draft.lines[].isHeader` | boolean |  |  |
| `draft.lines[].taxCode` | enum |  | One of: `standard`, `exempt`, `zero_rated`. |
| `draft.taxTreatment` | enum or null |  | One of: `auto`, `hst`, `gst`, `gst_qst`, `zero_rated`, `exempt`, `none`, `custom`. |
| `draft.taxRateCode` | enum or string or null |  |  |
| `draft.paymentMethodIds` | array of strings (ID) |  | A list of record IDs. at most 10 items. |
| `draft.payUrl` | string (uri) or null |  |  |
| `draft.notes` | string |  | Notes kept with the record. at most 4000 characters. |
| `draft.memo` | string |  | at most 4000 characters. |
| `draft.terms` | object |  | No other fields. |
| `draft.terms.code` | enum | Yes | One of: `due_on_receipt`, `net_7`, `net_15`, `net_30`, `net_45`, `net_60`, `custom`, `split_50_50`, `monthly`. |
| `draft.terms.days` | integer or null |  |  |
| `draft.billToContactId` | string or null |  |  |
| `draft.projectId` | string (ID) or null |  |  |

## Example request

```bash
curl -G https://app.getoatmilk.com/api/v1/accounting/invoices.preview \
  -H "Authorization: Bearer $OATMILK_API_KEY" \
  --data-urlencode 'id=9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d'
```

Reference page: https://app.getoatmilk.com/docs/api/invoices.preview
