Skip to content

Developer API

Write recipes

Five complete Developer API scripts that change data: recategorize a merchant, split a transaction, split the rent, tag a trip, add rows from a CSV.

This page has five complete scripts that change data through the Developer API, each as a shell script (curl and jq) and as a Python script that uses only the standard library, with the output of a real run. Like the read recipes, they take the app’s address from TAIGA_API and a token from TAIGA_TOKEN, and add /api/v1 to every path, so with TAIGA_API=https://app.taiga.finance the requests go to https://app.taiga.finance/api/v1. Each needs a token that can change data: you choose whether a token can change data when you create it in Settings, and a read-only token’s write is 403 read_only_token. The runs used a demo household’s seeded data.

How do I recategorize one merchant’s recent transactions?

Section titled “How do I recategorize one merchant’s recent transactions?”

This script reads a window of recent days, keeps one merchant’s transactions that are not yet in the target category, and sends them all in one batch, each update carrying what the script read as a precondition. It needs a token that can change data, and bash with curl, jq and GNU date, or Python 3.

#!/usr/bin/env bash
# Recategorize one merchant's recent transactions: read, filter, then ONE batch
# whose every update carries what was read as a precondition (all or nothing).
# Needs curl, jq and GNU date; a token that can change data.
# Usage: ./c-recategorize-merchant.sh "Steam Games" "Shopping::Entertainment & Recreation" 120
set -euo pipefail
: "${TAIGA_API:?set TAIGA_API}" "${TAIGA_TOKEN:?set TAIGA_TOKEN}"
merchant=$1; category=$2; days=${3:-90}
from=$(date -d "-$days days" +%F); to=$(date +%F)
auth=(-H "Authorization: Bearer $TAIGA_TOKEN")
# Read the window (follow next_cursor) and keep this merchant's unsplit rows not yet in the category.
rows='[]'; cursor=""
while :; do
page=$(curl -sS --fail-with-body "${auth[@]}" \
"$TAIGA_API/api/v1/transactions?from=$from&to=$to&limit=1000${cursor:+&cursor=$cursor}")
rows=$(jq -c --argjson acc "$rows" '$acc + .data' <<<"$page")
cursor=$(jq -r '.next_cursor // empty' <<<"$page")
[ -n "$cursor" ] || break
done
body=$(jq -c --arg m "$merchant" --arg c "$category" '
{ updates: [ .[] | select(.merchant == $m and .split_of == null
and (.parent_category + "::" + .category) != $c)
| { id, category: $c,
expected: { parent_category, category, merchant } } ] }' <<<"$rows")
n=$(jq '.updates | length' <<<"$body")
echo "$n transaction(s) of $merchant to change"
[ "$n" -gt 0 ] || exit 0
curl -sS -w '\nHTTP %{http_code}\n' -X POST "$TAIGA_API/api/v1/transactions/batch" "${auth[@]}" \
-H "Content-Type: application/json" -d "$body"

The shell run moved eight Steam Games transactions and then ran again with nothing left to change. The Python run did the same for four Netflix transactions.

$ ./c-recategorize-merchant.sh "Steam Games" "Shopping::Entertainment & Recreation" 120
8 transaction(s) of Steam Games to change
{"data":[{"id":"1612479","changed":true},{"id":"1612480","changed":true},{"id":"1612521","changed":true},{"id":"1612541","changed":true},{"id":"1612582","changed":true},{"id":"1612615","changed":true},{"id":"1612760","changed":true},{"id":"1612761","changed":true}],"changes":8}
HTTP 200
$ ./c-recategorize-merchant.sh "Steam Games" "Shopping::Entertainment & Recreation" 120 # run again: nothing left to change
0 transaction(s) of Steam Games to change

Read, filter, then write. /transactions filters only by date range and account, so the script reads the whole window and picks the merchant out itself. It skips split legs (rows with a split_of), because a write names the parent transaction and a leg id is 400 split_leg_id. The window counts back from the machine’s local date.

The precondition. Each update’s expected holds the parent_category, category and merchant the script read, in the read’s shape: category is the sub-category alone, while the category the update sets is Parent::Sub. If any one row has changed since the read, the whole batch is refused with 409 precondition_failed and the ids it is about, and nothing is written. A row that already holds the new category answers 200 and counts nothing, so a repeated run is safe. A batch takes up to 500 updates; this script sends one batch, and the trip recipe below shows how to send more. Write reference covers the batch and preconditions.

This script splits one transaction in two: a first leg of a given size in one category and the rest in a second. It needs the transaction’s id and date from /transactions, a token that can change data, and bash with curl and jq, or Python 3.

#!/usr/bin/env bash
# Split one transaction in two: a first leg of a given size, the rest in a second
# category. There is no single-transaction GET, so the script reads the day the
# transaction is on, and sends `expected_splits: []` ("I read it unsplit").
# Needs curl and jq; a token that can change data.
# Usage: ./d-split-transaction.sh 1611804 2025-12-08 20.00 "Shopping::Clothing" "Shopping::Shopping"
set -euo pipefail
: "${TAIGA_API:?set TAIGA_API}" "${TAIGA_TOKEN:?set TAIGA_TOKEN}"
id=$1; day=$2; first=$3; cat1=$4; cat2=$5
auth=(-H "Authorization: Bearer $TAIGA_TOKEN")
txn=$(curl -sS --fail-with-body "${auth[@]}" "$TAIGA_API/api/v1/transactions?from=$day&to=$day&limit=1000" |
jq -c --arg id "$id" '[.data[] | select(.id == $id)][0] // empty')
[ -n "$txn" ] || { echo "transaction $id not found unsplit on $day" >&2; exit 1; }
# Legs carry the parent's sign and must sum to its amount (to the cent).
body=$(jq -c --argjson first "$first" --arg c1 "$cat1" --arg c2 "$cat2" '
(if .amount < 0 then -1 else 1 end) as $sign
| ($first * $sign * 100 | round / 100) as $a
| { splits: [ {amount: $a, category: $c1},
{amount: ((.amount - $a) * 100 | round / 100), category: $c2} ],
expected_splits: [] }' <<<"$txn")
curl -sS -w '\nHTTP %{http_code}\n' -X PUT "$TAIGA_API/api/v1/transactions/$id/splits" "${auth[@]}" \
-H "Content-Type: application/json" -d "$body"

The shell run split a −61.02 Amazon purchase into −20.00 and −41.02, then ran again and stopped. The Python run split a −33.67 Amazon purchase into −10.00 and −23.67. The answer holds both legs; the first is shown here. The second leg differs from it only in id (-s2), split_slot (2), amount and amount_home, and category (Shopping).

$ ./d-split-transaction.sh 1611804 2025-12-08 20.00 "Shopping::Clothing" "Shopping::Shopping"
{
"data": [
{
"id": "1611804-s1",
"split_of": "1611804",
"split_slot": 1,
"split_note": null,
"date": "2025-12-08",
"posted_date": "2025-12-08",
"authorized_date": null,
"description": "AMAZON",
"merchant": "Amazon",
"amount": -20.0,
"currency": "USD",
"amount_home": -20.0,
"fx_rate": null,
"fx_rate_date": null,
"status": "posted",
"type": "debit",
"parent_category": "Shopping",
"category": "Clothing",
"counterparty": null,
"account_id": "8442",
"account_name": "Chase Joint Checking",
"institution": "Chase",
"hidden_from_budgets": false,
"tags": [],
"paid_from_fund": null
}
],
"next_cursor": null,
"home_currency": "USD",
"as_of": "2026-11-11",
"zone": "UTC"
}
HTTP 200
$ ./d-split-transaction.sh 1611804 2025-12-08 20.00 "Shopping::Clothing" "Shopping::Shopping" # again: it now reads as legs
transaction 1611804 not found unsplit on 2025-12-08

Finding the transaction. There is no endpoint for one transaction, so the script reads the transaction’s day and picks it out by id. Once split, the transaction reads as its legs, <id>-s1 and <id>-s2, each with split_of set to the parent’s id, so a second run no longer finds a row with that id and stops.

The legs. Each leg carries the parent’s sign, and the legs must sum to the parent’s amount to the cent, or the write is 422 split_sum_mismatch. The Python script does the arithmetic in Decimal and the shell script rounds to cents in jq, so the second leg is exactly the rest. expected_splits: [] states that the script read the transaction with no splits: if it has been split since, the write is 409 precondition_failed with the current legs. DELETE /transactions/{transaction_id}/splits collapses a split back to one row. Splits are written one transaction at a time; the batch does not take them. Write reference covers the splits endpoints.

This script creates a rule that splits every arriving payment matching a pattern into a fixed rent leg and a remainder utilities leg. Run again with a new amount, it replaces the rule it wrote. It needs a token that can change data, and bash with curl and jq, or Python 3.

#!/usr/bin/env bash
# The recurring rent split: a rule that splits every arriving payment matching a
# pattern into a fixed rent leg and a remainder utilities leg. It acts on
# transactions as they arrive, not on history. Running it again updates the
# rule this token already wrote (409 rule_pattern_exists names it; PUT replaces it).
# Needs curl and jq; a token that can change data.
# Usage: ./e-rent-split-rule.sh "MAPLE RIDGE APTS" 1850.00
set -euo pipefail
: "${TAIGA_API:?set TAIGA_API}" "${TAIGA_TOKEN:?set TAIGA_TOKEN}"
pattern=$1; rent=$2
auth=(-H "Authorization: Bearer $TAIGA_TOKEN" -H "Content-Type: application/json")
rule=$(jq -nc --arg p "$pattern" --argjson rent "$rent" '
{pattern: $p, match_type: "contains",
split_recipe: {legs: [
{category: "Housing::Rent", kind: "fixed", value: $rent},
{category: "Utilities::Utilities", kind: "remainder"}]}}')
out=$(mktemp)
code=$(curl -sS -o "$out" -w '%{http_code}' -X POST "$TAIGA_API/api/v1/rules" "${auth[@]}" -d "$rule")
if [ "$code" = 409 ] && [ "$(jq -r .detail "$out")" = rule_pattern_exists ]; then
id=$(jq -r .rule_id "$out")
echo "a rule for this pattern exists ($id); replacing it"
code=$(curl -sS -o "$out" -w '%{http_code}' -X PUT "$TAIGA_API/api/v1/rules/$id" "${auth[@]}" -d "$rule")
fi
echo "HTTP $code"; jq '.data // .' "$out"

The shell run created the rule with a rent of 1,850.00 (201). The Python run, right after it with 1,900.00, found that rule and replaced it (200).

$ ./e-rent-split-rule.sh "MAPLE RIDGE APTS" 1850.00
HTTP 201
[
{
"id": "5610",
"pattern": "MAPLE RIDGE APTS",
"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
}
]

Arriving transactions only. A rule acts on transactions as they arrive and never on history, so this month’s rent payment, if already in, stays as it is; split it with the previous recipe. A fixed leg’s value is positive and the legs take the transaction’s sign. The remainder leg gets what the fixed legs leave, and a recipe has at most one. When the fixed legs add up to more than the payment, the rule skips the split.

Create or replace. A second rule for a pattern you already hold is 409 rule_pattern_exists with its rule_id, and the script replaces that rule with PUT. A PUT is the whole rule: a field left out is cleared. Only the token that last wrote a rule may change it, so if the existing rule was made in the app, by your partner or by another token, the PUT is 403 not_this_tokens_rule and the script prints that answer. Rules covers conditions, recipes and precedence.

This script creates a tag, or reuses the one with that name, and adds it to every transaction in a date range while keeping the tags each one already has. It needs a token that can change data, and bash with curl, jq and awk, or Python 3.

#!/usr/bin/env bash
# Tag a trip: create the tag (or reuse it), then add it to every transaction in a
# date range, keeping the tags each already has. Batches of up to 500, each update
# carrying the tags it read as a precondition; backs off on 429 (Retry-After).
# Needs curl and jq; a token that can change data.
# Usage: ./f-tag-trip.sh "Santa Fe trip" 2026-08-14 2026-08-17
set -euo pipefail
: "${TAIGA_API:?set TAIGA_API}" "${TAIGA_TOKEN:?set TAIGA_TOKEN}"
tag=$1; from=$2; to=$3
call() { # call METHOD URL [BODY]; prints the body, sets $status; retries a 429 after Retry-After
local hdr; hdr=$(mktemp)
while :; do
body=$(curl -sS -D "$hdr" -X "$1" "$2" -H "Authorization: Bearer $TAIGA_TOKEN" \
-H "Content-Type: application/json" ${3:+-d "$3"})
status=$(awk 'NR==1{print $2}' "$hdr")
[ "$status" = 429 ] || break
sleep "$(awk 'tolower($1)=="retry-after:"{print $2+0}' "$hdr")"
done
rm -f "$hdr"
}
call POST "$TAIGA_API/api/v1/tags" "$(jq -nc --arg n "$tag" '{name: $n}')"
echo "tag: HTTP $status $(jq -c '.data[0]' <<<"$body")" # 201 created, 200 reused
name=$(jq -r '.data[0].name' <<<"$body")
rows='[]'; cursor=""
while :; do
call GET "$TAIGA_API/api/v1/transactions?from=$from&to=$to&limit=1000${cursor:+&cursor=$cursor}"
[ "$status" = 200 ] || { echo "HTTP $status: $body" >&2; exit 1; }
rows=$(jq -c --argjson acc "$rows" '$acc + .data' <<<"$body")
cursor=$(jq -r '.next_cursor // empty' <<<"$body")
[ -n "$cursor" ] || break
done
# A split transaction reads as its legs, each carrying the parent's tags: one update per parent.
updates=$(jq -c --arg t "$name" '
[ group_by(.split_of // .id)[] | .[0]
| select(.tags | index($t) | not)
| {id: (.split_of // .id), tags: (.tags + [$t]), expected_tags: .tags} ]' <<<"$rows")
echo "$(jq length <<<"$updates") transaction(s) to tag"
for ((i = 0; i < $(jq length <<<"$updates"); i += 500)); do
call POST "$TAIGA_API/api/v1/transactions/batch" "$(jq -c --argjson i $i '{updates: .[$i:$i+500]}' <<<"$updates")"
echo "batch: HTTP $status $body"
done

The shell run tagged 23 transactions of a four-day trip, then ran again with the tag name typed in another case: the tag was reused and nothing was left to tag. The Python run tagged a three-day weekend.

$ ./f-tag-trip.sh "Santa Fe trip" 2026-08-14 2026-08-17
tag: HTTP 201 {"id":"6","name":"Santa Fe trip"}
23 transaction(s) to tag
batch: HTTP 200 {"data":[{"id":"1612550","changed":true},{"id":"1612551","changed":true},{"id":"1612552","changed":true},{"id":"1612553","changed":true},{"id":"1612554","changed":true},{"id":"1612555","changed":true},{"id":"1612556","changed":true},{"id":"1612557","changed":true},{"id":"1612558","changed":true},{"id":"1612559","changed":true},{"id":"1612560","changed":true},{"id":"1612561","changed":true},{"id":"1612562","changed":true},{"id":"1612563","changed":true},{"id":"1612564","changed":true},{"id":"1612565","changed":true},{"id":"1612566","changed":true},{"id":"1612567","changed":true},{"id":"1612568","changed":true},{"id":"1613089","changed":true},{"id":"1613090","changed":true},{"id":"1613117","changed":true},{"id":"1613142","changed":true}],"changes":23}
$ ./f-tag-trip.sh "santa fe TRIP" 2026-08-14 2026-08-17 # again: the tag is reused, nothing left to tag
tag: HTTP 200 {"id":"6","name":"Santa Fe trip"}
0 transaction(s) to tag

The tag and the tag list. POST /tags answers 201 for a new tag and 200 for an existing one, matching names the way the app matches a typed name, with case and spacing folded. A write sets a transaction’s whole tag list by name and never creates a tag, so the script sends the tags it read plus the new one, with expected_tags holding what it read. A split transaction reads as legs that each carry the parent’s tags, so the script sends one update per parent. Batches go in groups of 500, the most one batch takes.

Backing off on a 429. Both scripts sleep for Retry-After seconds on any 429 and send the same request again. For the per-minute and in-flight limits that is under a minute. The daily cap of 5,000 changes per person is also a 429, write_limit, and its Retry-After runs to the next UTC midnight, so a script that reaches the cap waits until then. Limits and errors lists what counts as a change.

How do I add transactions from a CSV file?

Section titled “How do I add transactions from a CSV file?”

This script adds each row of a CSV file to one account, one POST /transactions per row. Each row’s client_id comes from the row itself, so running the script again over the same file adds nothing. It needs the account’s id from /accounts, a token that can change data, and bash with curl, jq and sha256sum, or Python 3. The file has a header and four columns, and the category may be empty:

date,amount,merchant,category
2026-11-02,-6.50,Farmers Market,Food::Groceries
2026-11-02,-6.50,Farmers Market,Food::Groceries
2026-11-05,-20.00,Car wash,Transportation::Car Maintenance
2026-11-06,-61.88,Jiffy Lube,
2026-11-08,40.00,Garage sale,
#!/usr/bin/env bash
# Add each row of a CSV file to one account: date,amount,merchant,category (category may be empty).
# Usage: ./g-import-csv.sh ACCOUNT_ID FILE.csv
# Needs curl, jq and sha256sum; a token that can change data. Fields hold no commas or quotes.
set -euo pipefail
account=$1 file=$2
auth=(-H "Authorization: Bearer $TAIGA_TOKEN" -H "Content-Type: application/json")
out=$(mktemp) hdr=$(mktemp)
trap 'rm -f "$out" "$hdr"' EXIT
declare -A seen
while IFS=, read -r date amount merchant category; do
# The client_id comes from the row itself, plus how many identical rows came before it,
# so two equal rows stay two transactions and a second run adds nothing.
key="$account|$date|$amount|$merchant|$category"
n=${seen[$key]:-0}; seen[$key]=$((n + 1))
client_id="csv-$(printf '%s|%s' "$key" "$n" | sha256sum | cut -c1-40)"
body=$(jq -n --arg a "$account" --arg d "$date" --argjson amt "$amount" --arg m "$merchant" \
--arg c "$category" --arg id "$client_id" \
'{account_id: $a, date: $d, amount: $amt, merchant: $m, client_id: $id}
+ (if $c == "" then {} else {category: $c} end)')
while :; do
code=$(curl -sS -o "$out" -D "$hdr" -w '%{http_code}' -X POST "$TAIGA_API/api/v1/transactions" \
"${auth[@]}" -d "$body")
[ "$code" = 429 ] || [ "$code" = 503 ] || break
if [ "$(jq -r '.detail' "$out")" = write_limit ]; then
echo "stopped at $date $merchant: no changes left today" >&2; cat "$out" >&2; exit 1
fi
sleep "$(awk 'tolower($1) == "retry-after:" {print $2 + 0}' "$hdr")"
done
case $code in
201) what=added ;;
200) what=exists ;;
*) echo "refused $date $merchant: HTTP $code $(cat "$out")" >&2; exit 1 ;;
esac
jq -r --arg w "$what" '"\($w)\t\(.data[0].id)\t\(.data[0].date)\t\(.data[0].amount)\t\(.data[0].merchant)\t\(.data[0].parent_category)::\(.data[0].category)"
+ (if (.possible_duplicates | length) > 0 then "\tlooks like \(.possible_duplicates | join(", "))" else "" end)' "$out"
done < <(tail -n +2 "$file")

The shell run added the five rows (201 each), then a second run over the same file found all five (200 each). The Python run used the same file with one row added at the end, and added only that row.

$ ./g-import-csv.sh 8565 cash-november.csv
added 1658942 2026-11-02 -6.5 Farmers Market Food::Groceries
added 1658943 2026-11-02 -6.5 Farmers Market Food::Groceries looks like 1658942
added 1658944 2026-11-05 -20.0 Car wash Transportation::Car Maintenance
added 1658945 2026-11-06 -61.88 Jiffy Lube Transportation::Car Maintenance looks like 1637577
added 1658946 2026-11-08 40.0 Garage sale Miscellaneous::Uncategorized
$ ./g-import-csv.sh 8565 cash-november.csv # again: every row is already there
exists 1658942 2026-11-02 -6.5 Farmers Market Food::Groceries looks like 1658943
exists 1658943 2026-11-02 -6.5 Farmers Market Food::Groceries looks like 1658942
exists 1658944 2026-11-05 -20.0 Car wash Transportation::Car Maintenance
exists 1658945 2026-11-06 -61.88 Jiffy Lube Transportation::Car Maintenance looks like 1637577
exists 1658946 2026-11-08 40.0 Garage sale Miscellaneous::Uncategorized

One client_id per row. The client_id is a hash of the account and the row’s fields, plus how many identical rows came before it in the file. The two equal market rows stay two transactions, and a create whose client_id was used before answers 200 with the transaction the first run added, so a second run adds nothing. An edited row hashes to a new client_id, so it is added as a new transaction. The shell script reads plain comma-separated fields; a field with a comma in it needs the Python script, which reads quoted CSV.

Possible duplicates. The script prints possible_duplicates after a row. The Jiffy Lube row looks like 1637577, the bank’s charge of the same day and amount, and each market row looks like the other. Nothing is refused: DELETE /transactions/{transaction_id} removes a transaction the script added. A row with no category is placed by your rules and the app’s categorizer, which put Jiffy Lube in Transportation / Car Maintenance and left the garage sale Uncategorized.

Backing off on a 429. Both scripts sleep for Retry-After seconds on a 429 or a 503 and send the same request again, and the client_id keeps a retry from adding a second copy. Each row added counts one change against the daily cap of 5,000, and on write_limit the scripts stop, because its Retry-After runs to the next UTC midnight. Run again the next day, a script skips the rows already added. With one change left for the day, the Python script over the same file with two more rows added one and stopped:

$ python3 g-import-csv.py 8565 cash-november-3.csv # two new rows, one change left today
exists 1658942 2026-11-02 -6.5 Farmers Market Food::Groceries looks like 1658943
exists 1658943 2026-11-02 -6.5 Farmers Market Food::Groceries looks like 1658942
exists 1658944 2026-11-05 -20.0 Car wash Transportation::Car Maintenance
exists 1658945 2026-11-06 -61.88 Jiffy Lube Transportation::Car Maintenance looks like 1637577
exists 1658946 2026-11-08 40.0 Garage sale Miscellaneous::Uncategorized
exists 1658947 2026-11-10 -12.0 Food truck Food::Dining Out
added 1658948 2026-11-11 -4.0 Parking meter Transportation::Transportation
stopped at 2026-11-11 Food truck: no changes left today {'detail': 'write_limit', 'remaining': 0}
(exit 1)

The table maps the write concepts of the Lunch Money API and the YNAB API to the Taiga Finance API. The read concepts are on Recipes.

Lunch Money YNAB Taiga Finance /api/v1
Categories, category groups Category groups, categories A write sets a Parent::Sub pair from GET /categories; categories cannot be created or edited through the API
Payee Payee merchant, set by PATCH /transactions/{transaction_id}; no payee list endpoint
Tags Flags GET /tags and POST /tags; PUT /transactions/{transaction_id}/tags sets the whole list, by name
Notes Memo One note per token per transaction, PUT, GET and DELETE /transactions/{transaction_id}/note, kept as a comment in the transaction’s thread
Split transactions subtransactions PUT /transactions/{transaction_id}/splits and DELETE /transactions/{transaction_id}/splits
Rules — GET, POST, PUT and DELETE /rules: category, merchant and split recipe, on arriving transactions only
Bulk update PATCH /budgets/{id}/transactions POST /transactions/batch: up to 500 transactions, all or nothing, category, merchant and tags
Create and delete transactions Create transactions POST /transactions adds one transaction per request, with an optional client_id that makes a retry safe; DELETE /transactions/{transaction_id} deletes one the API added, while the bank hasn’t matched it and nobody has changed it in the app

To revert what a script changed, Undo a token’s changes covers ending the token and reverting its changes from Settings.