Hanzo
OpenapiBooks

Creates or updates one auto-categorization rule, keyed by its pattern — writing…

Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority.

POST /v1/books/rules

Addresshttps://api.hanzo.ai/v1/books/rules
MethodPOST
Operationpost_books_rules
AuthAuthorization: Bearer $HANZO_API_KEY

Creates or updates one auto-categorization rule, keyed by its pattern — writing a pattern that already exists REPLACES that row's category and priority. The category is normalized to a real COA expense account, and anything unrecognized becomes 5900 Uncategorized rather than a guessed real account. It answers the row exactly as stored, so the caller sees the normalization. A rule overrides a vendor's default category, so this is the standing instruction that decides how a future bill classifies.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
categorybodystringCategory is the COA expense account a matching bill books to.
patternbodystringPattern is the merchant substring the rule matches on, case-insensitively.
prioritybodyintegerPriority breaks ties: when several patterns match, the highest wins.

Response

StatusBodyMeaning
200Ruleok

200 body — 3 fields.

FieldInTypeAlwaysDescription
categorybodystringCategory is the COA expense account a matching bill books to.
patternbodystringPattern is the merchant substring the rule matches on, case-insensitively.
prioritybodyintegerPriority breaks ties: when several patterns match, the highest wins.

Failure carries the platform error shape — see Errors.

Examples

hanzo books rules create

Books API · All Hanzo APIs · Interactive reference

How is this guide?

On this page