Skip to content

Local REST API

Vaulted Money’s desktop app can expose its data over a local HTTP API, so scripts and tools on the same computer can manage ledgers, transactions and settings, and generate reports and backups.

  • Desktop (Electron) only. The web and mobile builds have no process that can listen on a socket.
  • Off by default. Turn it on from the AI & agents page (Allow agents to connect); the port and token are under Local API → Advanced on the same page.
  • The app must be running. Closing the window only hides it, so the API keeps working until you quit the app.
  • Local-first. The server binds to 127.0.0.1 and is never reachable from the network. The API itself sends nothing off the device, but an AI agent you connect to it sends what it reads to its AI provider (Anthropic, for Claude). A local model keeps everything on the device.
  1. Open Settings, scroll to the Local API card (below Cross-Device Continuity, above About), switch it on, and copy the token. The card appears in every build, but it only has controls in the desktop app.
  2. Call it:
Terminal window
export VM_TOKEN="<token from settings>"
export VM="http://127.0.0.1:47821/api/v1"
curl -H "Authorization: Bearer $VM_TOKEN" $VM/ledgers
curl -H "Authorization: Bearer $VM_TOKEN" $VM # list every endpoint

GET /api/v1 returns the full, current route table, and GET /api/v1/openapi.json an OpenAPI 3.1 description generated from the code (request bodies included), so they are always the authoritative reference.

Want an AI agent or model runner on this computer to use it (for example LM Studio with a local model, or Claude Code, which sends what it reads to Anthropic)? See the MCP server: twelve small tools instead of about 100, with previews before anything changes.

Prefer a GUI? A ready-made Postman collection covers every endpoint. Building your own app or scripts? See the API cookbook and the machine-readable spec at GET /api/v1/openapi.json.

Base URL http://127.0.0.1:<port>/api/v1 (default port 47821)
Auth Authorization: Bearer <token> on every request
Bodies JSON (Content-Type: application/json)
Lists { "data": [...] }, transactions add total, limit, offset
Errors { "error": { "code", "message", "details?" } } with 400/401/403/404/405/409/413/502/503/504
Deletes 204 No Content
Downloads Content-Disposition: attachment (see below)

Dates must be real calendar days, either YYYY-MM-DD or a full ISO 8601 timestamp: 2026-02-30, 03/04/2026 and bare numbers are rejected with 400, and so is a garbage from/to filter. Currency codes are three letters (EUR; lower case is upper-cased). Custom frequencies and budget intervals need a positive number (2w, not 0w), and a recurring transaction or budget cannot end before it starts.

Ledger data is addressed explicitly (/ledgers/{ledgerId}/...); the API never depends on which ledger is open in the UI. The open UI is refreshed after each change made through the API.

Transactions, recurring transactions and budgets refer to accounts, vendors, categories and sub-categories by name. Renames and deletes therefore update or remove those records too, but only in the ledger in the path: another ledger that uses the same name is never changed. A rename to a name already in use returns 409 and changes nothing. The app’s own edit and delete buttons do exactly the same.

GET /ledgers · POST /ledgers list · create {name, currency, short_name?, icon?}
GET/PATCH/DELETE /ledgers/{id} read · update · delete with all its data

Ledger names are unique, ignoring case and surrounding spaces: creating or renaming to a taken name returns 409. Ledgers that already shared a name can still be updated as long as the name is not changed.

Under /ledgers/{ledgerId}/accounts. Accounts include a balance (starting balance plus transactions dated today or earlier, in the account’s currency).

GET · POST list · create {name, currency, starting_balance?, type?, credit_limit?, remarks?}
GET/PATCH/DELETE /{accountId} A new name propagates to the account’s transactions, recurring transactions and budgets; a new currency to its transactions and recurring transactions. Deleting keeps past transactions but removes the account’s recurring transactions and budgets.

type is one of Checking, Savings, Credit Card, Investment, Other.

Under /ledgers/{ledgerId}/vendors.

GET · POST list (?include_accounts=true to include accounts) · create {name}
GET/PATCH/DELETE /{vendorId} Rename propagates to transactions, recurring transactions and budgets. Vendors and accounts share names, so renaming to an account’s name is a 409. Deleting keeps past transactions but removes the vendor’s recurring transactions and budgets.
POST /merge {target, sources: [...]}: moves the sources’ transactions to the target, then deletes the sources with their recurring transactions and budgets

Under /ledgers/{ledgerId}/categories.

GET · POST list with nested sub_categories · create {name, sub_categories?: [...]}
GET/PATCH/DELETE /{categoryId} Rename propagates to transactions, recurring transactions and budgets. Delete also removes the category’s sub-categories and the recurring transactions and budgets that use it; past transactions keep the name.
POST /merge {target, sources: [...]}: moves the sources’ transactions and sub-categories to the target (a sub-category the target already has is folded into it), then deletes the sources with their recurring transactions and budgets
GET · POST /{categoryId}/sub-categories list · create {name}
PATCH/DELETE /{categoryId}/sub-categories/{subId} Rename propagates like a category rename (409 if the category already has the name). Delete clears the tag on transactions and recurring transactions and removes budgets scoped to it.

Under /ledgers/{ledgerId}/transactions.

GET Filters: from, to (YYYY-MM-DD), account, vendor, category, sub_category, min_amount, max_amount, type=income|expense, search, exclude_transfers, limit (default 100, max 1000), offset
POST {date, amount, account, vendor, category, sub_category?, remarks?, currency?}. Negative amounts are expenses. currency defaults to the account’s. Unknown accounts, vendors and categories are created, as in the UI.
POST /bulk {transactions: [...]} (up to 1000)
POST /transfer {from_account, to_account, amount, date, to_amount?, remarks?}: two linked legs. to_amount is required when the currencies differ and rejected (400) when they match and the amounts differ.
DELETE /transfer/{transferId} delete both legs
GET/PATCH/DELETE /{transactionId} On a linked transfer the other leg follows only what you changed: date, category, remarks, and the amount when both legs share a currency. Its account moves only when the new payee is an account, and its own payee text is kept. Deleting one leg deletes both. Both match the app.

Under /ledgers/{ledgerId}/search. This is the code behind the search box in the app, so a script and the app read a phrase the same way.

GET /interpret?q=... Reads a phrase such as starbuks over 20 last month and changes nothing. Optional: today=YYYY-MM-DD (what “today” means, for repeatable results), typos=false (match names exactly).

The response has three parts:

  • filters: what was understood. date_range (from is null for “before 2019”), all_time, min_amount / max_amount (the size of an amount, sign ignored, as in the app), type (income or expense), accounts, categories, sub_categories, vendors (names), text (the words left over), limit / sort (for “top 5”), and corrections (names matched despite a typo or a plural, with what was typed). combine is always "all": every filter must match, and several values of one kind (two vendors) match either.
  • params: the query for GET /transactions that gives the same result, where that endpoint can express it. Amounts are converted to its signed min_amount / max_amount when the phrase says income or expense.
  • unmapped: filters GET /transactions cannot express, each with the reason: several values of one kind (it takes one), a size without income or expense, and “top N”.

It reads names from the ledger’s own accounts, vendors, categories and sub-categories, so “grocery” finds Groceries and “starbuks” finds Starbucks. It understands dates (“last month”, “2 weeks from today”, “between 2025 jul and sep”, “since 2020”), amounts (“over 50”, “between 10 and 20”, “€100”, “=801” for exactly that amount, ”>=100 <=200”; ≥ and ≤ work too, ”>” and ”<” include the number itself, and “801,50” is read as 801.50), income and expense words, account types (“savings”) and “top 5”.

Under /ledgers/{ledgerId}/scheduled-transactions.

GET · POST list · create {date, amount, account, vendor, category, frequency, sub_category?, end_date?, remarks?, currency?, ignored_dates?}
GET/PATCH/DELETE /{scheduledId} Deleting a schedule keeps the transactions it already created.
POST /{scheduledId}/skip {date}: skip one occurrence
  • date is the next occurrence. The app turns due schedules into real transactions itself, whenever it is running, exactly as for schedules created in the UI.
  • frequency: Daily, Weekly, Monthly, Yearly, One-time, or a duration like 2w (d, w, m, y; the number must be at least 1).
  • Accounts, vendors and categories that do not exist yet are created; currency defaults to the account’s.

Under /ledgers/{ledgerId}/budgets. Responses include the computed spent_amount.

POST body: {budget_scope?, category?, sub_category?, scope_name?, target_amount, currency?, frequency?, start_date?, end_date?, is_active?, is_goal?, target_date?, monthly_contribution?, goal_context?, account_scope_values?}

  • budget_scope: category (default), sub_category, account, vendor.
  • category scope needs an existing category (and optionally sub_category); the other scopes need scope_name.
  • frequency: Monthly (default), Quarterly, Yearly, One-time, or a duration such as 3m.

GET/PATCH/DELETE /{budgetId}.

GET /history?periods=6 shows which budgets you keep missing: for every active recurring budget (monthly, quarterly or yearly) it returns spent against the target for each of the last periods periods (1-24, default 6), oldest first, with over_by and missed, plus a summary (periods_counted, periods_missed, miss_rate_pct, average_spent, worst_overspend). Periods before the budget’s start date are left out, and the period still running is shown with in_progress: true but not counted. Savings goals and switched-off budgets are not listed; one-time and custom-range budgets are listed under skipped with the reason. Spending is calculated exactly as for spent_amount.

GET /currencies · POST /currencies list with rates · add {code, name, symbol, rate} (rate is relative to USD)
GET/PATCH/DELETE /currencies/{code} PATCH {name?, symbol?, rate?}. The base currency cannot be deleted.
PUT /currencies/base {code}
POST /currencies/refresh-rates Fetch the latest rates from Frankfurter. This is the only call that contacts the internet, and it does so exactly as the Currencies page does.
GET · POST /ai-providers {name, type, baseUrl, model?, description?, isDefault?, api_key?}
GET/PATCH/DELETE /ai-providers/{id}
PUT /ai-providers/{id}/default
PUT/DELETE /ai-providers/{id}/api-key {api_key}

API keys are write-only: responses report has_api_key but never the key. They stay on the device and are never included in backups.

GET /languages available languages and the current one
PUT /languages/current {code}
POST /languages/custom · DELETE /languages/custom/{code} {code, name, translations}
GET /backups/export Download an unencrypted backup. ?ledger_id= limits it to one ledger.
POST /backups/export {ledger_id?, password?}. With a password the download is an encrypted .lock file.
POST /backups/import Import a backup. mode: "add" keeps existing data; the default "replace" is destructive. See below.
GET /backups/schedules scheduled backup configurations (no secrets)
PATCH/DELETE /backups/schedules/{id} {is_active?, frequency_ms?}
GET /backups/safety Automatic safety copies, newest first: {items: [{id, reason, entity, created_at, ledger_count}]}. Never the content.
POST /backups/safety/{id}/restore {confirm_restore: true, continue_without_safety_copy?} → {restored: id}. Destructive: see below.
DELETE /backups/safety/{id} {confirm_delete: true} → {deleted: 1}

Scheduled backups are always encrypted. PATCH /backups/schedules/{id} with is_active: true returns 409 for a schedule that is not encrypted (made before this rule) or whose password is not on this device (for example after a restore); the app pauses such schedules too.

Backups never contain secrets: AI keys and the scheduled-backup password stay on the device. Importing or restoring a backup never takes a password or an AI key from the file; if it changes an AI provider’s address, that provider’s stored key is removed and must be entered again.

mode chooses what a backup does:

  • "replace" (default) restores: it replaces existing data (everything, or the target ledger with ledger_id), so confirm_replace: true is required.
  • "add" puts the backup’s ledgers beside the existing ones. Nothing existing changes, no confirmation is needed, and ledger_id must be left out (400). A name already in use gets a counter (Family (01)), a single-ledger export becomes Imported ledger, and app settings are not imported (only missing currencies and exchange rates). The response lists ledgers_added: [{id, name}].

remove_unused: true then tidies the imported ledgers and returns tidied, one result per ledger. In add mode, if the tidy-up fails after the ledgers were added, the response still succeeds and carries tidy_failed: true.

Body: either content (the backup file text) or backup (a parsed object), plus password for encrypted files and force: true to accept a backup from a different app/schema version. The UI reloads after a restore.

Before restoring, the API keeps a safety copy of all current data (reason restore_file), as restoring a file in the app does. If that copy cannot be made (for example, storage is full), nothing is restored and the API answers 409 safety_copy_failed. Send continue_without_safety_copy: true to restore without one.

The app keeps the last 5 automatic safety copies of all data, made just before something changes data in bulk. They are the Automatic safety copies on the Backup screen. reason says what came next:

reason Made before Through the API
csv_import a CSV import; entity is transactions, accounts, payees (vendors) or categories (with sub-categories) each …/import route, except with dry_run: true
ai_categorize Categorize Missing writing AI results categorize-missing with use_ai: true, except with dry_run: true
restore_file restoring a backup file POST /backups/import
restore_safety_copy restoring a safety copy (the undo copy) POST /backups/safety/{id}/restore
sync applying changes from another device app only
demo_data Generate demo data app only
reset Reset All Data (when a safety copy is kept) app only
delete_all deleting all transactions of a ledger POST …/transactions/clear, except with dry_run: true

entity is null except for CSV imports. Copies hold everything, including other ledgers, but never AI provider keys. Each new copy removes the oldest beyond 5, so imports made through the API can push out older copies.

For imports and AI changes a failed copy never stops the operation: the operation still runs, and the failure is logged, not reported in the response. Restores are different: they replace everything, so a failed copy stops them with 409 safety_copy_failed unless you send continue_without_safety_copy: true.

Restoring a safety copy (it mirrors Restore on the Backup screen) replaces all data with the copy, so confirm_restore: true is required. It first makes an undo copy (restore_safety_copy), so the restore can itself be undone; the copy being restored is never pruned. AI providers and keys on the device are kept, because copies have none. The device’s backup settings (/backups/schedules: schedules, folders and backup password settings) are kept too, exactly as they were before the restore, because a copy has no folder access and may predate schedules or a password change. The UI reloads afterwards. Unknown ids return 404.

Passwords are never accepted in the URL; use POST for encrypted exports.

API versions of the maintenance buttons in the app. Every operation that changes data accepts dry_run: true to preview it, and deletions also need confirm_delete: true. Do the dry run first, read the result, then repeat without it.

App button Endpoint Body
Transactions → Detect Transfers POST /ledgers/{id}/transactions/detect-transfers {dry_run?, keep_categories?}
Transactions → Cleanup Duplicates POST /ledgers/{id}/transactions/cleanup-duplicates {dry_run?, confirm_delete?}
Transactions → Categorize Missing POST /ledgers/{id}/transactions/categorize-missing {dry_run?, use_ai?}
Accounts → Reconcile Balance POST /ledgers/{id}/accounts/reconcile {adjustments:[{account, actual_balance}], date?, dry_run?}
Accounts / Vendors / Categories → De-duplicate GET …/accounts|vendors|categories/duplicates (suggestions), then POST …/accounts/merge, …/vendors/merge, …/categories/merge {target, sources:[…]}
Vendors / Categories → Cleanup Unused GET …/vendors|categories/unused, then POST …/vendors|categories/cleanup {ids?, dry_run?, confirm_delete?}

How each behaves:

  • Detect Transfers pairs transactions on different accounts, at most one day apart, that cancel out in the same currency or look like a transfer (swapped account/vendor, both Transfer, or both vendors mentioning transfer). It links them with a shared transfer_id. The same code runs behind the app’s button.
  • Cleanup Duplicates removes extra copies of a recurring transaction created twice on the same day, keeping the oldest.
  • Categorize Missing (the app first offers to link likely transfers; the API does not, so call detect-transfers first) gives uncategorized transactions the category last used with the same vendor. AI is opt-in: with use_ai: true it also asks your default AI provider about vendors with no history. That sends vendor names (never amounts) to the provider and fails with 400 ai_not_configured if no default provider is set, or it has no key. A custom (OpenAI-compatible) provider, such as a model running on your own computer, needs no key. It also needs the app’s one-time permission for that provider at its current address: until someone has chosen “Allow” in the app’s permission screen (Transactions → Categorize Missing with AI, or Test Connection in the provider form under AI & agents), it fails with 409 ai_permission_needed and sends nothing. The permission is per address, so changing a provider’s baseUrl (or restoring a file that does) asks again, and it can be withdrawn at any time in AI & agents. The default is false, so nothing leaves the device unless you ask. When use_ai is true (and it is not a dry run), a safety copy (reason ai_categorize) is kept before the changes are written.
  • Detect Transfers keeps each side’s category by default (blank ones become Transfer), so reports still count them there. Send keep_categories: false to set both to Transfer, which reports leave out.
  • Reconcile Balance compares the real balance you give with the app’s balance (as of date, default today) and creates one Balance Adjustment transaction (category Adjustment) for the difference. Accounts that already match are left alone.
  • Duplicate suggestions group names that are identical after ignoring case, accents, punctuation and spacing, and suggest which to keep. (The app makes you pick duplicates by hand; the merge itself is the same.)
  • Merging keeps the target and moves past transactions onto it. The merged-away names’ recurring transactions and budgets are deleted, not moved: with duplicates there is no telling which schedule or budget you still want. Re-create any you need on the target.
  • Unused is stricter than the app: a vendor or category counts as unused only if no transaction, recurring transaction or budget refers to it, so cleanup never silently deletes schedules or budgets. Others and Transfer are never listed. ids may only name currently-unused entries.

What bulk actions changed (categorize, transfer linking, duplicate cleanup, transaction CSV imports, deleting all transactions), whether they ran in the app or through the API. A dry_run records nothing. Undo is only in the app, under Transactions → Actions → Change history. The history is per device: it is not in backups, exports or sync, and a restore clears it. The newest 50 runs and at most 20,000 transactions are kept per ledger.

Endpoint Result
GET /ledgers/{id}/history Newest first: {items: [{id, action, outcome, created_at, transaction_count, removed_count, undoable, provider?, unanswered?, error?}]}
GET /ledgers/{id}/history/{runId} The same plus rows: each transaction with kind (changed, added, removed), before, after and, for categorize, source (history or ai). Suggested schedules and budgets (action generate_schedules / generate_budgets, app only) list rows with item (schedule or budget), whose transaction_id is that item’s id.

Exactly the formats of the app’s Import CSV / Export CSV buttons, so files move freely between the app and the API.

Export Import (body {csv, dry_run?})
Transactions GET /ledgers/{id}/transactions/export (same filters as the list; ?delimiter=,) POST …/transactions/import also takes delimiter?, detect_transfers? (default false), keep_categories? (default true), mode?, remove_unused? and confirm_delete?
Accounts GET …/accounts/export POST …/accounts/import
Vendors GET …/vendors/export POST …/vendors/import
Categories GET …/categories/export POST …/categories/import
  • Transaction files use ; as the delimiter and DD/MM/YYYY dates, with the columns Date;Account;Vendor;Category;Sub Category;Amount;Remarks;Currency;transfer_id;is_scheduled_origin;Frequency;End Date. Sub Category is optional on import; missing sub-categories are created under their category. Accounts are Account Name,Currency,Starting Balance,Remarks; vendors Vendor Name; categories Category Name,Sub Category Name.

  • Imports create missing accounts, vendors and categories, never overwrite existing ones, and report imported/created, already_existed and skipped row numbers. Use dry_run to validate a file first.

  • Transaction imports take mode: "append" (default) or "replace". Replace removes the ledger’s transactions only (recurring transactions and budgets stay), and only once the file has at least one valid row. mode: "replace" and remove_unused: true need confirm_delete: true. With dry_run: true the response adds would_remove_transactions and would_tidy; would_tidy is judged on the ledger as it will be once the rows are imported.

  • Duplicates: an appending dry_run reports possible_duplicates: rows with the same day, account, vendor and amount as a transaction already in the ledger (each stored one counts once). Send skip_duplicates: true to leave them out; the response then adds skipped_duplicates. Without it every row is imported.

POST /ledgers/{id}/transactions/clear removes every transaction of one ledger. Accounts, payees, categories, recurring transactions and budgets stay. Preview with {"dry_run": true} (would_delete), then send {"confirm_delete": true} (deleted). Unknown fields are refused. A safety copy (reason delete_all) is kept first; if it cannot be made, nothing is deleted and the answer is 409 safety_copy_failed. The run appears in the change history as delete_all.

remove_unused: true deletes payees, categories and sub-categories that have no transactions in the ledger (never accounts, Others or Transfer), and budgets that tracked them. Recurring transactions that used one are kept but ended (end date yesterday, or before the next due date if that is past). The result is {vendors, categories, sub_categories, schedules_ended, budgets_removed}. Unlike the clean-up routes, it does not keep an item just because a recurring transaction or budget uses it.

  • Each import that is not a dry_run first keeps a safety copy of all data (reason csv_import). A failed copy does not stop the import.
  • Exports escape cells starting with =, +, -, @, a tab or a carriage return so spreadsheets do not run them as formulas.
  • CSV is for spreadsheets and bank exports. For a complete, lossless copy (budgets, schedules, sub-category tags, settings) use Backups.

GET /settings and PATCH /settings: the Settings page as one resource.

Field Settings page Notes
base_currency Default Currency Must be an active currency with a rate
language Language Built-in or custom language code
future_months Future Transactions Whole number 0–120
default_ai_provider_id Default AI Provider A provider id, or null for None (Disabled)

Send any subset; all values are validated first, so a bad value changes nothing. Per-ledger settings (name, currency, icon) are on /ledgers/{id}. Cross-Device Continuity needs an operating-system folder grant, so it can only be set up in the app.

Generating analytics, insights and reports

Section titled “Generating analytics, insights and reports”

These are computed on demand from the ledger’s data. Every one accepts the same output options:

  • default: JSON in the response body
  • ?download=true: the same JSON as a file
  • ?format=csv: a flat CSV table as a file (spreadsheet formula prefixes in user data are escaped)
GET /ledgers/{id}/analytics from, to, group_by=day|week|month (default month), currency, include_transfers. Totals, spend by category/vendor/account, and a time series. Future-dated transactions are excluded.
GET /ledgers/{id}/insights Budget health (good/warning/critical) and the biggest vendor-spending and account-activity changes over the latest 30 days versus the 30 before.
GET /reports report types
GET /ledgers/{id}/reports/{type} income-expense, net-worth (to = as-of date), trends (monthly series). Accept from, to, currency.

currency defaults to the ledger’s currency; amounts are converted with the exchange rates stored in the app.

Terminal window
curl -H "Authorization: Bearer $VM_TOKEN" -OJ \
"$VM/ledgers/$LEDGER/reports/income-expense?from=2026-01-01&format=csv"
curl -H "Authorization: Bearer $VM_TOKEN" -X POST -OJ \
-H "Content-Type: application/json" -d '{"password":"correct horse battery"}' \
$VM/backups/export

The API can read and change all financial data, so it is locked down:

  • Opt-in and loopback-only. Disabled until enabled in Settings; listens on 127.0.0.1 only.
  • Bearer token. 256 random bits, compared in constant time, stored in api-config.json in the app’s user-data folder with owner-only permissions. Regenerate it any time from Settings; the old token stops working immediately.
  • No browser access. Requests carrying an Origin header are refused (no CORS), and the Host header must be loopback plus the configured port, which blocks DNS-rebinding attacks. Use curl, scripts or other non-browser clients.
  • Bounded input. Request bodies are capped at 64 MiB and validated before use.
  • Secrets stay local. AI API keys are never returned; backup passwords are never accepted in a URL.

Anything running as your user on the same computer can read the token file, so treat the API like any other local credential.

  • Desktop only, and only while the app is running.
  • Scheduled-backup folders must be chosen in the app (they need an OS folder grant), so the API can pause, resume, retime and remove schedules but not create them.
  • Only one app instance serves the API; if the port is taken, pick another in Settings.
  • Cross-Device Continuity (shared sync folder) can only be configured in the app.
  • AI-based categorization needs a default AI provider and key in the app (the API never returns keys).
curl ──HTTP──▶ electron/apiServer.ts ──IPC──▶ src/api/ApiBridge.tsx ──▶ src/api/* ──▶ DataProvider ──▶ IndexedDB
(auth, framing, limits) (renderer owns the data) (router, validation, calculations)

Any change to what the API exposes must also update the tests, this document and the Postman collection; src/api/postmanCoverage.test.ts enforces the collection part.

IndexedDB lives in the renderer, so the main process only owns the socket and security, and relays each authorised request to the renderer. src/api is transport-agnostic and fully unit-tested against the real Dexie provider; add an endpoint by adding a RouteDef to the relevant file in src/api/routes/.