Preview invoice calculations

POSThttps://app.speybooks.com/api/v1/invoices/preview

Calculates line totals, VAT, and invoice total without creating an invoice. Use this for real-time UI previews while the user is editing line items.

Request lines use the create format: quantity and unitPrice as exact decimal strings, with unitPrice in pounds and both accepting fractional values. The response returns per-line net, vat, and total plus aggregate subtotal, vatTotal, and total, all as integers in pence. The calculation path is identical to create, so what you preview is what you get on submit. Deterministic and stateless; nothing is persisted.

This endpoint is stateless and idempotent. No authentication scope is required beyond a valid API key.

Body parameters

linesarray<object>required
min items: 1 · max items: 100
Show child parameters
quantitystringrequired
pattern: ^(?!0+(\.0+)?$)\d+(\.\d+)?$
unitPricestringrequired
pattern: ^\d+(\.\d+)?$
vatRateintegerrequired
min: 0 · max: 100

Response

200Default Response
Show response fields
linesarray<object>
Show child attributes
netinteger
totalinteger
vatinteger
subtotalinteger
totalinteger
vatTotalinteger