---
title: "Store a new rule"
method: POST
path: "/v1/rules"
tags: ["rules"]
---

# Store a new rule

`POST /v1/rules`

Creates a new rule. The data required can be submitted as a JSON body or as a list of parameters.

## Headers

- `X-Trace-Id` string, uuid

## Request body

- RuleStore
  - `title` string, string, required
  - `description` string, string
  - `rule_group_id` string, string, required — ID of the rule group under which the rule must be stored. Either this field or rule_group_title is mandatory.
  - `rule_group_title` string, string — Title of the rule group under which the rule must be stored. Either this field or rule_group_id is mandatory.
  - `order` integer
  - `trigger` 'store-journal' | 'update-journal' | 'manual-activation', string, required — Which action is necessary for the rule to fire? Use either store-journal, update-journal or manual-activation.
  - `active` boolean — Whether or not the rule is even active. Default is true.
  - `strict` boolean — If the rule is set to be strict, ALL triggers must hit in order for the rule to fire. Otherwise, just one is enough. Default value is true.
  - `stop_processing` boolean — If this value is true and the rule is triggered, other rules after this one in the group will be skipped. Default value is false.
  - `triggers` RuleTriggerStore[], required
    - `type` 'from_account_starts' | 'from_account_ends' | 'from_account_is' | 'from_account_contains' | 'to_account_starts' | 'to_account_ends' | 'to_account_is' | 'to_account_contains' | 'amount_less' | 'amount_exactly' | 'amount_more' | 'description_starts' | 'description_ends' | 'description_contains' | 'description_is' | 'transaction_type' | 'category_is' | 'budget_is' | 'tag_is' | 'currency_is' | 'has_attachments' | 'has_no_category' | 'has_any_category' | 'has_no_budget' | 'has_any_budget' | 'has_no_tag' | 'has_any_tag' | 'notes_contains' | 'notes_starts' | 'notes_end' | 'notes_are' | 'no_notes' | 'any_notes' | 'source_account_is' | 'destination_account_is' | 'source_account_starts', string, required — The type of thing this trigger responds to. A limited set is possible
    - `value` string, string, required — The accompanying value the trigger responds to. This value is often mandatory, but this depends on the trigger.
    - `order` integer — Order of the trigger
    - `active` boolean — If the trigger is active. Defaults to true.
    - `prohibited` boolean — If 'prohibited' is true, this rule trigger will be negated. 'Description is' will become 'Description is NOT' etc.
    - `stop_processing` boolean — When true, other triggers will not be checked if this trigger was triggered. Defaults to false.
  - `actions` RuleActionStore[], required
    - `type` 'user_action' | 'set_category' | 'clear_category' | 'set_budget' | 'clear_budget' | 'add_tag' | 'remove_tag' | 'remove_all_tags' | 'set_description' | 'append_description' | 'prepend_description' | 'set_source_account' | 'set_destination_account' | 'set_notes' | 'append_notes' | 'prepend_notes' | 'clear_notes' | 'link_to_bill' | 'convert_withdrawal' | 'convert_deposit' | 'convert_transfer' | 'delete_transaction', string, required — The type of thing this action will do. A limited set is possible.
    - `value` string, string, nullable, required — The accompanying value the action will set, change or update. Can be empty, but for some types this value is mandatory.
    - `order` integer — Order of the action
    - `active` boolean — If the action is active. Defaults to true.
    - `stop_processing` boolean — When true, other actions will not be fired after this action has fired. Defaults to false.

## Response `200`

New rule stored, result in response.

## Other responses

- `400` — Bad request
- `401` — Unauthenticated
- `404` — Page not found
- `422` — Validation error. The body will have the exact details.
- `500` — Internal exception

---

[API](https://skmtc.dev/firefly-iii/apis/firefly-iii-api-develop.md) · [All operations](https://skmtc.dev/firefly-iii/apis/firefly-iii-api-develop/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/firefly-iii/firefly-iii-api-develop/revisions/8a1f6472e04b/schema)
