Skip to content

Developer API

Rules

Create, replace and delete categorization rules through the Developer API, and which rules a token may change.

A token that can change data can create rules, replace them and delete them: POST /rules, PUT /rules/{rule_id} and DELETE /rules/{rule_id}. A rule acts on transactions as they arrive and never on history. A token changes only the rules it wrote. GET /rules, which lists the household’s rules for any token, is in the lists reference. The examples use $TAIGA_API for the app’s origin, so in production the base is https://app.taiga.finance/api/v1.

A rule matches on its conditions and applies its actions.

Part Field What it takes
Condition pattern Required, up to 255 characters, matched against the description
Condition match_type contains (the default) or exact
Condition account_id One account id from GET /accounts; an account the token’s owner can’t see is 400 bad_account_id
Condition amount_min, amount_max A size range compared against the absolute amount, so an outflow’s size is what counts. The bounds are in the account’s currency on a rule with account_id, else in your home currency, and a rule’s currency names which. A minimum above the maximum is 400 bad_amount_range
Action category A Parent::Sub pair from GET /categories, checked as a transaction write checks it
Action merchant The merchant name to set
Action split_recipe Legs that split the arriving transaction (below)

A rule needs at least one action, or it is 400 no_action. A blank pattern is 400 pattern_required. A rule’s category and its recipe legs are Parent::Sub both in the request and in the answer.

A recipe has up to 50 legs, and each leg has a category and a kind:

kind value Leg amount
fixed A positive amount That amount
percent A share from 0 to 1 That share of what the fixed legs leave
remainder None The rest; at most one per recipe

The legs take the transaction’s sign, so an outflow’s legs come out negative. When the fixed legs add up to more than the transaction’s amount, the split is skipped. Two remainder legs are 400 bad_split_recipe.

A rule acts on transactions as they arrive. It never changes transactions already in the ledger, and a new rule sorts last in precedence. To apply the same change to history, read GET /transactions, match the rows in the script and send one POST /transactions/batch. The write recipes do this for one merchant.

Only the rules the token wrote. Every other rule is 403 not_this_tokens_rule: one made in the app, a partner’s, one written by another token (the same person’s included), and one the token wrote but someone has since edited in the app. In GET /rules, yours is true on a rule you made and writable is true on one this token may change:

{
"id": "5541",
"pattern": "WHOLE FOODS",
"match_type": "contains",
"category": "Food::Groceries",
"merchant": "Whole Foods Market",
"split_recipe": null,
"account_id": null,
"account_name": null,
"account_scoped": false,
"account_hidden": false,
"amount_min": null,
"amount_max": null,
"currency": "USD",
"app_only_actions": [],
"category_valid": true,
"yours": true,
"writable": false
}

That rule was made in the app, so this token can’t change it:

Terminal window
curl -X DELETE "$TAIGA_API/api/v1/rules/5541" \
-H "Authorization: Bearer $TAIGA_TOKEN"
HTTP/1.1 403 Forbidden
content-type: application/json
{
"detail": "not_this_tokens_rule"
}

A person holds at most 500 rules, made in the app or through any token. Past that, POST /rules is 409 rule_limit. A second rule for a pattern you already hold is 409 rule_pattern_exists, and rule_id names the existing rule.

These are left out on purpose:

  • Editing or deleting a rule made in the app.
  • Applying a rule to history. Read GET /transactions, match in the script, and send a batch instead.
  • A rule that sets a tag, an attribution or a savings fund. A rule that carries one of these app-only actions lists them in app_only_actions, and a PUT keeps them as they are.

Creates a rule and answers 201 with it. This one matches a description containing HOME DEPOT on one account, at a size from 20 to 500, and sets a category and a merchant:

Terminal window
curl -X POST "$TAIGA_API/api/v1/rules" \
-H "Authorization: Bearer $TAIGA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pattern": "HOME DEPOT", "match_type": "contains",
"account_id": "8565", "amount_min": 20, "amount_max": 500,
"category": "Housing::Home Improvement", "merchant": "The Home Depot"}'
HTTP/1.1 201 Created
content-type: application/json
{
"data": [
{
"id": "5611",
"pattern": "HOME DEPOT",
"match_type": "contains",
"category": "Housing::Home Improvement",
"merchant": "The Home Depot",
"split_recipe": null,
"account_id": "8565",
"account_name": "Chase Joint Checking",
"account_scoped": true,
"account_hidden": false,
"amount_min": 20.0,
"amount_max": 500.0,
"currency": "USD",
"app_only_actions": [],
"category_valid": true,
"yours": true,
"writable": true
}
],
"next_cursor": null,
"home_currency": "USD",
"as_of": "2026-11-12",
"zone": "UTC"
}

A recurring rent payment split into a fixed rent leg and a remainder utilities leg:

Terminal window
curl -X POST "$TAIGA_API/api/v1/rules" \
-H "Authorization: Bearer $TAIGA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pattern": "OAKWOOD PROPERTY MGMT",
"split_recipe": {"legs": [
{"category": "Housing::Rent", "kind": "fixed", "value": 1850.00},
{"category": "Utilities::Utilities", "kind": "remainder"}
]}}'
HTTP/1.1 201 Created
content-type: application/json
{
"data": [
{
"id": "5609",
"pattern": "OAKWOOD PROPERTY MGMT",
"match_type": "contains",
"category": null,
"merchant": null,
"split_recipe": {
"legs": [
{
"category": "Housing::Rent",
"kind": "fixed",
"value": 1850.0
},
{
"category": "Utilities::Utilities",
"kind": "remainder",
"value": null
}
]
},
"account_id": null,
"account_name": null,
"account_scoped": false,
"account_hidden": false,
"amount_min": null,
"amount_max": null,
"currency": "USD",
"app_only_actions": [],
"category_valid": true,
"yours": true,
"writable": true
}
],
"next_cursor": null,
"home_currency": "USD",
"as_of": "2026-11-12",
"zone": "UTC"
}

A second POST for the HOME DEPOT pattern names the rule that already holds it:

HTTP/1.1 409 Conflict
content-type: application/json
{
"detail": "rule_pattern_exists",
"rule_id": "5611"
}
Field Type Required Default and limits Description
account_id string or null No at most 32 characters One account’s id from /accounts: the rule acts only on that account’s transactions. Null or omitted: every account.
amount_max number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 The largest amount the rule acts on, compared with the transaction’s amount without its sign (in the account’s currency on a rule with account_id, else in the home currency); null or omitted for no bound.
amount_min number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 The smallest amount the rule acts on, compared with the transaction’s amount without its sign (in the account’s currency on a rule with account_id, else in the home currency); null or omitted for no bound.
category string or null No at most 255 characters Parent::Sub, one of /categories.
match_type string No default "contains"; one of contains, exact contains (the default): pattern appears in the text, starting where a word starts; exact: the counterparty, the description, or the two together equal pattern, ignoring case.
merchant string or null No at most 255 characters The merchant name the rule sets; null or omitted for none.
pattern string Yes at most 255 characters The text the rule matches in a transaction’s counterparty and description; stored with its outer spacing trimmed.
split_recipe object or null No The split the rule applies; null or omitted for none.
split_recipe.legs object[] Yes at least 1 item; at most 50 items The legs, in slot order: the percents sum to at most 1, and at most one leg is remainder.
split_recipe.legs[].category string Yes at most 255 characters Parent::Sub, one of /categories.
split_recipe.legs[].kind string Yes one of fixed, percent, remainder fixed: a set amount; percent: a share of what the fixed legs leave; remainder: the rest.
split_recipe.legs[].value number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 A fixed leg’s amount (above 0) or a percent leg’s share (above 0, at most 1); not used on a remainder leg.
Field Type Description
account_hidden boolean Whether the rule’s account is one you cannot see, so account_id is null.
account_id string or null The id of the one account the rule acts on; null when it acts on every account, or when its account is hidden from you or gone (see account_scoped).
account_name string or null That account’s name; null when you cannot see it.
account_scoped boolean Whether the rule acts on one account only.
amount_max number or null The largest amount the rule acts on, compared without sign; null for no bound.
amount_min number or null The smallest amount the rule acts on, compared without sign; null for no bound.
app_only_actions string[] What else the rule does that only the app sets: tag, paid_from_fund, attribution; empty when nothing.
category string or null The category the rule sets, Parent::Sub; null when none.
category_valid boolean False when the rule’s category is no longer one of your household’s; such a rule acts on nothing.
currency string or null The currency any amount_min or amount_max is in: the account’s on a rule that acts on one account, else your home currency; null when the rule’s account is gone (it acts on nothing) or hidden from you.
id string The rule’s id.
match_type string contains or exact.
merchant string or null The merchant name the rule sets; null when none.
pattern string The text the rule matches.
split_recipe object or null The split the rule applies; null when none.
split_recipe.legs object[] The legs, in slot order.
split_recipe.legs[].category string The leg’s category, Parent::Sub.
split_recipe.legs[].kind string fixed, percent or remainder.
split_recipe.legs[].value number or null A fixed leg’s amount or a percent leg’s share (0 to 1); null on a remainder leg.
writable boolean Whether this token wrote the rule last, so it may change or delete it.
yours boolean Whether you wrote the rule.
Status Code Description
400 pattern_required pattern is blank once its outer spacing is trimmed.
400 bad_category A category is not written Parent::Sub.
400 unknown_category A category is not one of your household’s (/categories lists them)
400 bad_split_recipe split_recipe breaks a recipe rule (a fixed leg’s value must be above 0, a percent leg’s above 0 and at most 1, the percents must sum to at most 1, at most one leg may be remainder), or a leg’s category is not one of your household’s.
400 bad_amount_range amount_min is greater than amount_max.
400 bad_account_id account_id is not an account id, or names an account whose transactions you cannot see.
400 no_action The rule sets no action (none of category, merchant, split_recipe).
401 invalid_token No bearer, or not a live personal token.
402 billing_read_only The household’s billing is inactive, so the account is read-only; the body is the app’s own (its detail.reason is the billing state).
403 read_only_token The token was not made able to change data.
403 demo_account The token’s owner is a demo account, which never writes.
403 notice_required Review a notice in the app first.
405 read_only The path only reads.
405 method_not_allowed The path does not serve this method; Allow names those it does.
409 rule_pattern_exists You already have a rule for this pattern; rule_id is it.
409 rule_limit You hold PERSONAL_API_MAX_RULES rules (500); delete one first.
422 — The body or a parameter failed schema validation; the answer is FastAPI’s validation list (detail, one entry per failure). unstorable_text: a text value holds a character no field can store (NUL, or a lone surrogate); nothing was written or counted.
429 write_limit What the request would actually change does not fit what is left of the day’s changes (remaining is what is left, Retry-After runs to the next UTC midnight — fields sent with the values the row already holds count nothing, and a request that changes nothing is never refused)
429 rate_limited Too many requests, or too many failed tokens from your network.
429 too_many_in_flight Too many requests at once.
503 busy The write met a concurrent change to the same rows and was rolled back whole; nothing was written or counted. Retry after Retry-After (1 second) — every write is all or nothing and sets values, so a retry is safe.

Replaces a rule this token wrote. A PUT is the whole rule: a field left out is cleared. The rule keeps its id and its place in precedence. This request leaves out the account and the amount range, so both are cleared:

Terminal window
curl -X PUT "$TAIGA_API/api/v1/rules/5611" \
-H "Authorization: Bearer $TAIGA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"pattern": "HOME DEPOT", "category": "Housing::Home Improvement", "merchant": "The Home Depot"}'
HTTP/1.1 200 OK
content-type: application/json
{
"data": [
{
"id": "5611",
"pattern": "HOME DEPOT",
"match_type": "contains",
"category": "Housing::Home Improvement",
"merchant": "The Home Depot",
"split_recipe": null,
"account_id": null,
"account_name": null,
"account_scoped": false,
"account_hidden": false,
"amount_min": null,
"amount_max": null,
"currency": "USD",
"app_only_actions": [],
"category_valid": true,
"yours": true,
"writable": true
}
],
"next_cursor": null,
"home_currency": "USD",
"as_of": "2026-11-12",
"zone": "UTC"
}

Sending the same body again is a no-op: it answers 200 with the same rule and counts nothing.

Parameter Type Required Default and limits Description
rule_id string Yes A rule’s id from /rules.
Field Type Required Default and limits Description
account_id string or null No at most 32 characters One account’s id from /accounts: the rule acts only on that account’s transactions. Null or omitted: every account.
amount_max number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 The largest amount the rule acts on, compared with the transaction’s amount without its sign (in the account’s currency on a rule with account_id, else in the home currency); null or omitted for no bound.
amount_min number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 The smallest amount the rule acts on, compared with the transaction’s amount without its sign (in the account’s currency on a rule with account_id, else in the home currency); null or omitted for no bound.
category string or null No at most 255 characters Parent::Sub, one of /categories.
match_type string No default "contains"; one of contains, exact contains (the default): pattern appears in the text, starting where a word starts; exact: the counterparty, the description, or the two together equal pattern, ignoring case.
merchant string or null No at most 255 characters The merchant name the rule sets; null or omitted for none.
pattern string Yes at most 255 characters The text the rule matches in a transaction’s counterparty and description; stored with its outer spacing trimmed.
split_recipe object or null No The split the rule applies; null or omitted for none.
split_recipe.legs object[] Yes at least 1 item; at most 50 items The legs, in slot order: the percents sum to at most 1, and at most one leg is remainder.
split_recipe.legs[].category string Yes at most 255 characters Parent::Sub, one of /categories.
split_recipe.legs[].kind string Yes one of fixed, percent, remainder fixed: a set amount; percent: a share of what the fixed legs leave; remainder: the rest.
split_recipe.legs[].value number or null No at least -1,000,000,000,000,000; at most 1,000,000,000,000,000 A fixed leg’s amount (above 0) or a percent leg’s share (above 0, at most 1); not used on a remainder leg.
Field Type Description
account_hidden boolean Whether the rule’s account is one you cannot see, so account_id is null.
account_id string or null The id of the one account the rule acts on; null when it acts on every account, or when its account is hidden from you or gone (see account_scoped).
account_name string or null That account’s name; null when you cannot see it.
account_scoped boolean Whether the rule acts on one account only.
amount_max number or null The largest amount the rule acts on, compared without sign; null for no bound.
amount_min number or null The smallest amount the rule acts on, compared without sign; null for no bound.
app_only_actions string[] What else the rule does that only the app sets: tag, paid_from_fund, attribution; empty when nothing.
category string or null The category the rule sets, Parent::Sub; null when none.
category_valid boolean False when the rule’s category is no longer one of your household’s; such a rule acts on nothing.
currency string or null The currency any amount_min or amount_max is in: the account’s on a rule that acts on one account, else your home currency; null when the rule’s account is gone (it acts on nothing) or hidden from you.
id string The rule’s id.
match_type string contains or exact.
merchant string or null The merchant name the rule sets; null when none.
pattern string The text the rule matches.
split_recipe object or null The split the rule applies; null when none.
split_recipe.legs object[] The legs, in slot order.
split_recipe.legs[].category string The leg’s category, Parent::Sub.
split_recipe.legs[].kind string fixed, percent or remainder.
split_recipe.legs[].value number or null A fixed leg’s amount or a percent leg’s share (0 to 1); null on a remainder leg.
writable boolean Whether this token wrote the rule last, so it may change or delete it.
yours boolean Whether you wrote the rule.
Status Code Description
400 pattern_required pattern is blank once its outer spacing is trimmed.
400 bad_category A category is not written Parent::Sub.
400 unknown_category A category is not one of your household’s (/categories lists them)
400 bad_split_recipe split_recipe breaks a recipe rule (a fixed leg’s value must be above 0, a percent leg’s above 0 and at most 1, the percents must sum to at most 1, at most one leg may be remainder), or a leg’s category is not one of your household’s.
400 bad_amount_range amount_min is greater than amount_max.
400 bad_account_id account_id is not an account id, or names an account whose transactions you cannot see (other than the one the rule already holds)
400 no_action The rule sets no action (none of category, merchant, split_recipe) and holds none set in the app.
400 bad_fund The savings fund the rule pays from, an action set in the app, is no longer one you can edit, or is archived.
400 bad_tag The tag the rule sets, an action set in the app, is no longer one of your household’s.
400 bad_attribution The person the rule attributes to, an action set in the app, is no longer a member of your household.
401 invalid_token No bearer, or not a live personal token.
402 billing_read_only The household’s billing is inactive, so the account is read-only; the body is the app’s own (its detail.reason is the billing state).
403 not_this_tokens_rule Only the token that last wrote a rule may change it, and this rule is a partner’s, was made or last edited in the app, or is another token’s.
403 read_only_token The token was not made able to change data.
403 demo_account The token’s owner is a demo account, which never writes.
403 notice_required Review a notice in the app first.
404 rule_not_found No rule of your household.
405 read_only The path only reads.
405 method_not_allowed The path does not serve this method; Allow names those it does.
409 rule_pattern_exists You already have a rule for this pattern; rule_id is it.
422 — The body or a parameter failed schema validation; the answer is FastAPI’s validation list (detail, one entry per failure). unstorable_text: a text value holds a character no field can store (NUL, or a lone surrogate); nothing was written or counted.
429 write_limit What the request would actually change does not fit what is left of the day’s changes (remaining is what is left, Retry-After runs to the next UTC midnight — fields sent with the values the row already holds count nothing, and a request that changes nothing is never refused)
429 rate_limited Too many requests, or too many failed tokens from your network.
429 too_many_in_flight Too many requests at once.
503 busy The write met a concurrent change to the same rows and was rolled back whole; nothing was written or counted. Retry after Retry-After (1 second) — every write is all or nothing and sets values, so a retry is safe.

Deletes a rule this token wrote and answers 204 with no body. Transactions the rule already acted on keep what it did. A rule id outside the household is 404 rule_not_found.

Terminal window
curl -X DELETE "$TAIGA_API/api/v1/rules/5611" \
-H "Authorization: Bearer $TAIGA_TOKEN"
HTTP/1.1 204 No Content
Parameter Type Required Default and limits Description
rule_id string Yes A rule’s id from /rules.
Status Code Description
401 invalid_token No bearer, or not a live personal token.
402 billing_read_only The household’s billing is inactive, so the account is read-only; the body is the app’s own (its detail.reason is the billing state).
403 not_this_tokens_rule Only the token that last wrote a rule may change it, and this rule is a partner’s, was made or last edited in the app, or is another token’s.
403 read_only_token The token was not made able to change data.
403 demo_account The token’s owner is a demo account, which never writes.
403 notice_required Review a notice in the app first.
404 rule_not_found No rule of your household.
405 read_only The path only reads.
405 method_not_allowed The path does not serve this method; Allow names those it does.
422 — The body or a parameter failed schema validation; the answer is FastAPI’s validation list (detail, one entry per failure). unstorable_text: a text value holds a character no field can store (NUL, or a lone surrogate); nothing was written or counted.
429 write_limit What the request would actually change does not fit what is left of the day’s changes (remaining is what is left, Retry-After runs to the next UTC midnight — fields sent with the values the row already holds count nothing, and a request that changes nothing is never refused)
429 rate_limited Too many requests, or too many failed tokens from your network.
429 too_many_in_flight Too many requests at once.
503 busy The write met a concurrent change to the same rows and was rolled back whole; nothing was written or counted. Retry after Retry-After (1 second) — every write is all or nothing and sets values, so a retry is safe.