---
title: "Create a versioned bank rule and queue the feed pipeline"
method: POST
path: "/bank-rules"
tags: ["Banking"]
---

# Create a versioned bank rule and queue the feed pipeline

`POST /bank-rules`

## Request

- Base URL: `https://ledgerhq.pro/api/v1`
- URL: `https://ledgerhq.pro/api/v1/bank-rules`
- Auth: one of:
  - HTTP bearer and API key in header `x-organization-id`
  - HTTP bearer and API key in header `x-organization-id`

Direction and absolute amount bounds are evaluated before the selected text field. The rule mutation and durable pipeline enqueue commit together.

## Request body

- object
  - `name` string, required
  - `priority` integer
  - `matchField` 'description' | 'reference' | 'merchant'
  - `matchType` 'contains' | 'equals' | 'starts_with' | 'ends_with', required
  - `matchValue` string, required
  - `accountId` string, uuid, nullable
  - `classId` string, uuid, nullable: Class stamped on rows this rule codes
  - `allocationTemplateId` string, uuid, nullable: Class allocation stamped on rows this rule codes, in place of classId
  - `contactId` string, uuid, nullable
  - `taxRateId` string, uuid, nullable
  - `direction` 'any' | 'money_in' | 'money_out'
  - `amountMin` integer, nullable: Minimum absolute amount in cents
  - `amountMax` integer, nullable: Maximum absolute amount in cents

## Response `201`

Created versioned rule

## Other responses

- `default`: Error response

---

[API](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api.md) · [All operations](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ledgerhq-pro/apis/ledgerhq-bookkeeping-api/revisions/9a8269f0a586?raw)
