Create rule from import categorisation

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

Creates a categorisation rule from an import preview categorisation. The backend normalises the description, extracts a keyword, and creates (or upserts) a rule with operator contains.

Optionally pass batchDescriptions with all rows in the current import batch. The endpoint returns similarRowIds — the IDs of rows whose extracted keyword matches, enabling bulk categorisation in the UI.

Emits a categorisation signal for the global aggregation pipeline.

Body parameters

description string required
Raw transaction description from the import row. A keyword will be extracted and normalised for the rule.
targetAccountId string required
Target account ID (e.g. acc_4000) for this categorisation.
batchDescriptions array<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
description string required
Raw description for similarity matching.
rowId integer required
Row index in the import batch.

Response

200 Created/upserted rule with extracted keyword, resolved account, and list of similar row IDs in the batch.
Show response fields
account object
Show child attributes
code string
id string
name string
keyword string
normalisedValue string
rule object
Show child attributes
action string
id integer
name string
similarRowIds array<integer>

Error codes

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