Skip to main content

actual-to-firefly

Zero-dependency Python CLI for migrating an unencrypted Actual Budget SQLite database (db.sqlite) into Firefly III through the public Firefly III REST API.

Built for clean, repeatable cutovers: dry-run by default, idempotent on re-run, and post-import balance verified down to the cent.

Why This Exists

Most migration guides go from Firefly III to Actual Budget via per-account CSV exports. Going the other way (from Actual's local SQLite ledger into Firefly III's double-entry model) breaks quickly with CSV exports:

  • Transfers get duplicated or decoupled across accounts.
  • Split transactions lose their parent grouping.
  • Same-account transfers fail in Firefly III (source_id == destination_id is rejected).
  • Refunds from merchants collide with expense/revenue counterparty naming unless disambiguated.
  • Interrupted imports are painful to resume safely without deterministic external_id tracking.

actual-to-firefly reads db.sqlite in read-only SQLite mode, plans the exact Firefly payloads, writes through /api/v1/*, and reconciles every account balance and external_id before returning exit code 0.

What It Migrates

  • Asset accounts (preserving opening balance, opening date, active/closed state, and off-budget → include_net_worth mapping)
  • Categories (flattened from Category Group / Category)
  • Budgets & non-zero monthly budget limits (from Actual's zero_budgets table)
  • Regular withdrawals and deposits
  • Transfers (paired rows merged into one Firefly transfer; same-account transfers converted into balanced withdrawal + deposit entries)
  • Split transactions (parent + children mapped to Firefly multi-split transaction groups)

Intentionally Out of Scope

  • Actual rules, schedules, attachments, and bank-sync automation (reported as skipped counts in migration_report.json)
  • Encrypted Actual backups (export an unencrypted copy of db.sqlite from Actual first)
  • Mixed-sign split transactions (Firefly III requires all splits in a group to share the same direction)

Quick Start

Requires Python 3.11+. No third-party runtime dependencies.

1. Dry-Run First (Read-Only, No Firefly Token Needed)

uvx actual-to-firefly \
  --actual-db /path/to/db.sqlite \
  --currency USD \
  --report migration_report.json

Or install with pipx / pip:

pip install actual-to-firefly
actual-to-firefly --actual-db /path/to/db.sqlite --currency EUR

Inspect migration_report.json to verify account counts, planned transaction groups, detected dual-role payees, and any warnings (for example, orphan transfer rows).

2. Execute Against Firefly III

Generate a Personal Access Token in Firefly III (Options → Profile → OAuth → Personal Access Tokens) and export it in your environment (tokens are never accepted on the CLI so they stay out of shell history):

export FIREFLY_TOKEN="your-personal-access-token"

actual-to-firefly \
  --actual-db /path/to/db.sqlite \
  --firefly-url https://firefly.example.com \
  --currency USD \
  --execute

Optional Payee Cleanup

Automatic Dual-Role Payee Disambiguation (On by Default)

If a merchant appears in both withdrawals and deposits (for example, a store purchase plus a later refund), actual-to-firefly automatically appends (refund) to the revenue counterparty so expense and revenue accounts stay unambiguous in Firefly III. Customize with --refund-suffix or disable with --no-disambiguate-dual-payees.

Custom Payee Aliases & Counterparty Overrides

Normalize noisy bank descriptions or override specific payees with JSON files (see examples/):

actual-to-firefly \
  --actual-db /path/to/db.sqlite \
  --firefly-url https://firefly.example.com \
  --currency USD \
  --payee-aliases examples/payee-aliases.example.json \
  --counterparty-map examples/counterparty-map.example.json \
  --execute

Verification & Exit Codes

After --execute, actual-to-firefly re-fetches all Firefly accounts and transactions and writes a full reconciliation block into migration_report.json:

  • balance_validation: exact Decimal comparison of each Actual account balance against Firefly's current_balance.
  • external_id_validation: confirms every planned actual:<id> and actual-transfer:<id1>:<id2> exists in Firefly.

Exit codes:

  • 0: dry-run succeeded, or --execute finished with 0.00 balance difference on every account and zero missing external_ids.
  • 1: API error, invalid split data, or post-import balance/ID mismatch.
  • 2: invalid CLI usage or missing FIREFLY_TOKEN.

CLI Reference

Flag Default Description
--actual-db $ACTUAL_DB Path to unencrypted Actual db.sqlite
--firefly-url $FIREFLY_URL / http://localhost:8080 Base URL of Firefly III
--currency $FIREFLY_CURRENCY / USD ISO 4217 currency code
--token-env FIREFLY_TOKEN Env var name holding the Firefly PAT
--execute false Write to Firefly III (omit for dry-run)
--set-primary-currency false Update Firefly default user group primary currency to --currency
--payee-aliases none JSON file normalizing raw payee variants
--counterparty-map none JSON file overriding expense/revenue counterparty names
--no-disambiguate-dual-payees false Disable automatic dual-role refund suffixing
--refund-suffix (refund) Suffix for dual-role revenue counterparties
--report migration_report.json Output path for structured JSON report
--sleep 0.0 Optional delay (seconds) between API requests

Development

python3 -m unittest discover -s tests -v
uvx ruff check src tests

License

MIT

Metadata

Release files for actual-to-firefly 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for actual-to-firefly 0.1.0
File Size Uploaded Provenance Actions
actual_to_firefly-0.1.0.tar.gz 23.8 kB With provenance Details for actual_to_firefly-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for actual-to-firefly 0.1.0
File Interpreter ABI Platform Actions
actual_to_firefly-0.1.0-py3-none-any.whl Python 3 none any Details for actual_to_firefly-0.1.0-py3-none-any.whl

Total release size: 41.4 kB

Release files / actual_to_firefly-0.1.0.tar.gz

Download URL actual_to_firefly-0.1.0.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
00db1e45042a21c86e1c3c3850786e3d8779b0bbe9599f63f33bdad0b4408c40
BLAKE2b-256 checksum
How to use checksums
447347a09cbb3c0d32cfab58b2d030bc7aa802f5c3af85f51a53bf75db37970c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / actual_to_firefly-0.1.0-py3-none-any.whl

Download URL actual_to_firefly-0.1.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d259935b08c6543cadca0f8b8ae54f974174d2cf63da04838f5869f86556a982
BLAKE2b-256 checksum
How to use checksums
f18a66e1a3e0409b69794b20bc07e216eaa431c29a9054355c311c72eda99ad8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for actual-to-firefly 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for actual_to_firefly-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page