Create categorisation rule
POST
https://app.speybooks.com/api/v1/categorisation-rules/Creates a new categorisation rule. If a rule with the same field, operator, and value already exists, its target account is updated rather than creating a duplicate (upsert semantics).
For description rules the value is normalised before storage
(uppercased, common bank prefixes stripped, trailing digits
removed), which improves matching against varying bank formats.
Each organisation is limited to 100 rules.
Body parameters
fieldstringrequiredTransaction field to match against (description, contact_name, amount, reference, or metadata.* fields).
descriptioncontact_nameamountreferencemetadata.categorymetadata.projectmetadata.departmentmetadata.tagnamestringrequiredRule display name (1-100 characters).
operatorstringrequiredMatch operator (contains, equals, starts_with, ends_with, greater_than, less_than, regex).
containsequalsstarts_withends_withgreater_thanless_thanregextargetAccountIdstringrequiredTarget account ID (e.g. acc_4000). The account transactions will be categorised to when this rule matches.
valuestringrequiredValue to match (1-500 characters). Description values are auto-normalised. Regex patterns are validated.
activebooleanoptionalWhether the rule is active. Default true.
descriptionstringoptionalOptional rule description (max 500 characters).
priorityintegeroptionalRule priority (0-999). Higher priority rules are evaluated first. Default 0.
Response
201Rule created (or upserted if same field+operator+value exists). Returns rule details with resolved account.
Show response fields
activebooleanfieldstringidintegernamestringoperatorstringpriorityintegertargetAccountCodestringtargetAccountIdstringtargetAccountNamestringvaluestringError codes
400Validation error: invalid regex, invalid account ID, or organisation rule limit reached (100).
404Target account not found.