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 to 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 a draft
that is 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. Posting to a control account from a source it does not
permit is rejected with a message naming the account and its
permitted sources.
Body parameters
datestringrequireddescriptionstringrequiredlinesarray<object>requiredShow child parameters
accountIdstringrequiredamountintegerrequiredcontactIdstringoptionaldescriptionstringoptionalvatRateintegeroptionalvatTreatmentstringoptionalnoneinclusiveexclusivemetadataobjectoptionalreferencestringoptionalstatusstringoptionaldraftpostedResponse
Show response fields
idstring