Skip to main content
A categorization rule is a saved condition (i.e. transaction context details like counterparty, amount, etc.) that automatically categorizes future matching transactions.

How it works

When you categorize a transaction, Layer may recommend creating a rule to automatically categorize future matching transactions. This reduces repetitive manual work, keeps categorization consistent over time, and helps users close their books faster. Categorization Rules Suggestion is currently an experimental feature that is not yet available to all customers. Please reach out to your Layer representative to enable this feature. If you are using Layer’s Bank Transactions embedded component, you will see a prompt in the UI to create a rule. Categorization Rule Suggestion If the user chooses to accept the rule, they will be presented with a preview of the transactions that will be affected by the rule. Categorization Rule Suggestion Preview

Custom Integration

The guide below is for API consumers building their own transaction categorization UI. If you are using Layer’s Bank Transactions embedded component, you will not need any additional integration to handle rule suggestions.

Where suggestions appear

Layer may return a rule suggestion when you categorize transactions through: Both return Bank_Transaction objects. On each transaction, check:
  • update_categorization_rules_suggestion (nullable)
If this field is null, there is no suggestion to show.

Consumer-facing payload

For end-user integration flows, treat this suggestion as:
  • Create_Categorization_Rule_For_Counterparty
Common fields you should use:
  • id: stable suggestion id
  • suggestion_prompt: non-null display text you can show in UI when a suggestion is returned
  • new_rule: prebuilt rule payload to submit
  • transactions_that_will_be_affected: preview of transactions impacted by the rule
  1. Categorize a transaction.
  2. If update_categorization_rules_suggestion is present, show a prompt in UI.
  3. On accept, call Create Categorization Rule with new_rule.
  4. On decline, call Reject Suggested Categorization Rule with the suggestion id. This marks the suggestion as dismissed and prevents it from being shown again.
  5. Continue normal categorization workflow regardless of suggestion state.

Example response fragment

{
  "type": "Bank_Transaction",
  "id": "5e1f58e6-0f9c-49ec-ae0f-3d7a67a8f70c",
  "categorization_status": "CATEGORIZED",
  "update_categorization_rules_suggestion": {
    "type": "Create_Categorization_Rule_For_Counterparty",
    "id": "b3488b6a-c7b4-4d2a-a8c7-7d15f9942ed4",
    "suggestion_prompt": "Would you like to create a rule to automatically categorize outbound transactions from Acme as Office Expenses?",
    "new_rule": {
      "apply_retroactively": true,
      "created_by_suggestion_id": "b3488b6a-c7b4-4d2a-a8c7-7d15f9942ed4",
      "counterparty_filter": "f1664961-43d8-42f1-9a6d-c6c32a9f0adf",
      "category": {
        "type": "StableName",
        "stable_name": "OFFICE_EXPENSES"
      },
      "bank_direction_filter": "MONEY_OUT"
    },
    "transactions_that_will_be_affected": []
  }
}

Notes

  • Categorization Rules Suggestions logic is determined by Layer and may evolve over time. For more details, please reach out to your Layer representative.