Test a value against categorisation rules

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

Tests a transaction input against all active rules and returns the match result. This is read-only: no rules or transactions are changed. Use it to preview which account a transaction would be categorised to.

On a match the response carries the winning rule, the suggested account, and an evidence object describing why that rule won: the matched field, operator, and value, the normalised input, how many rules were evaluated and matched, the source tier of the winning rule (provenance, one of LOCAL, VERIFIED, GLOBAL, or SYSTEM), and an opaque scoreVector string used for tie-break diagnostics whose format is not part of the stable contract. On no match, matched is false and unknownReason explains why.

Body parameters

amountintegeroptional
Transaction amount to test, in pence (for greater_than/less_than operators).
contactNamestringoptional
Contact name to test.
descriptionstringoptional
Transaction description to test against rules. Will be normalised before matching.
metadataobjectoptional
Key-value metadata to test against metadata.* field rules.
referencestringoptional
Reference to test.

Response

200Best matching rule with score vector and evidence, or no match with reason.
Show response fields
evidenceobject
Show child attributes
matchCountinteger
matchedFieldstring
matchedValuestring
normalisedInputstring
operatorstring
provenancestring
ruleCountinteger
scoreVectorstring
matchedboolean
ruleobject
Show child attributes
idinteger
namestring
suggestionobject
Show child attributes
accountCodestring
accountIdstring
accountNamestring

Error codes

400Invalid test input.