Create a transaction
https://app.speybooks.com/api/v1/transactions/Creates a new manual double-entry transaction. The transaction must have at least two lines and the sum of all line amounts must equal zero (debits = credits). This constraint is validated before any database writes occur.
Line Fields
Each line requires:
accountId— prefixed account ID (e.g.acc_4000)amount— integer in minor units (pence). Positive = debit, negative = credit
Optional per-line fields:
vatRate— integer 0–100 (e.g. 20 for 20% VAT)vatTreatment—inclusive,exclusive, ornonecontactId— prefixed contact ID for contact-level reportingdescription— line-level description, max 500 characters
VAT Calculation
When vatRate and vatTreatment are provided (and treatment is not none), the API computes the vatAmount for tax reporting:
exclusive— VAT is on top:vatAmount = |amount| × rateinclusive— VAT is within:vatAmount = |amount| − (|amount| / (1 + rate))
This is a per-line tax annotation stored for HMRC reporting. It does not inject balancing lines, modify the journal total, or alter any other line. The API consumer must still send all lines required to balance the journal — including the explicit VAT account line.
Status
Defaults to posted. Pass status: "draft" to create an editable draft excluded from balances and reports.
Validation
All referenced account IDs must exist and be active within the organisation. The balance constraint (∑amounts = 0) is absolute — the API returns 400 if violated.
Error responses:
400— lines do not balance (∑amounts ≠ 0)400— fewer than 2 lines400— invalid or inactive account ID400— invalid contact ID400— metadata validation failure (reserved keys, exceeded limits)
Body parameters
date string requireddescription string requiredlines array<object> requiredShow child parameters
accountId string requiredamount integer requiredcontactId string optionaldescription string optionalvatRate integer optionalvatTreatment string optionalnoneinclusiveexclusivemetadata object optionalreference string optionalstatus string optionaldraftpostedResponse
Show response fields
id string