Create rule from import categorisation

POSThttps://app.speybooks.com/api/v1/categorisation-rules/categorise-row

Creates a categorisation rule from an import-preview decision. The description is normalised and a keyword extracted, and a rule with operator contains is created (or updated if one already exists) pointing at the chosen account.

Optionally pass batchDescriptions with the other rows in the current import batch. The response then includes similarRowIds, the IDs of rows whose extracted keyword matches, so the UI can offer to categorise them together.

Body parameters

descriptionstringrequired
Raw transaction description from the import row. A keyword will be extracted and normalised for the rule.
targetAccountIdstringrequired
Target account ID (e.g. acc_4000) for this categorisation.
batchDescriptionsarray<object>optional
Optional: other descriptions in the current import batch. Used to find similar rows that would match the same extracted keyword.
Show child parameters
descriptionstringrequired
Raw description for similarity matching.
rowIdintegerrequired
Row index in the import batch.

Response

200Created/upserted rule with extracted keyword, resolved account, and list of similar row IDs in the batch.
Show response fields
accountobject
Show child attributes
codestring
idstring
namestring
keywordstring
normalisedValuestring
ruleobject
Show child attributes
actionstring
idinteger
namestring
similarRowIdsarray<integer>

Error codes

400Invalid input: missing description or target account ID.
404Target account not found.