Leave Zaprite or Request Finance
Sealbill imports your clients and every invoice you issued there as paid history, with its original number. Export, rehearse with a dry run, read the report, then import.
Before you start
- Sealbill installed and running.
- The organization the invoices belong to, created on the staff pages. You need its slug.
- The vault unsealed. The importer refuses to run while it is sealed, and reads nothing.
Export from Zaprite
tools/migrate/zaprite_export.py is a standalone script: Python 3.11 or newer and the requests library, nothing else.
It only reads: it takes your API key from ZAPRITE_API_KEY, pages through your contacts and orders, and writes NDJSON, one record per line, to a file it creates with mode 0600.
read -rsp 'Zaprite API key: ' ZAPRITE_API_KEY; echo; export ZAPRITE_API_KEY
python3 tools/migrate/zaprite_export.py zaprite.ndjson
- An order with an invoice keeps its number, lines, discounts, tax rates and dates. Any other order, such as a payment-link checkout, becomes a payment request with one line at the order’s total.
- Payments made through anonymous payment links are filed under one placeholder contact.
- Pending orders are left out, and every order left out is named by its id.
- Only counts and order ids go to the terminal, never a name, an e-mail address or an amount.
Export from Request Finance
tools/migrate/request_finance_export.js runs in your own browser, inside the Request Finance app, while you are logged in. It needs no API key.
- Log in at app.request.finance and open Get paid, then Sent.
- Open the browser’s developer console. Read the script before you paste it: Chrome asks you to type “allow pasting” first.
- Paste it, press Enter and leave the tab in front. It turns the list’s pages through the app’s own requests, about six seconds each, then offers
request-finance-export-<date>.ndjsonas a download. Nothing is sent anywhere.
- Each distinct buyer becomes one contact.
- Amounts are converted exactly. An invoice whose amounts do not convert exactly, or whose currency the table does not know, is left out and named, never rounded. Invoices in USDT, USDC, DAI, ETH and similar tokens are imported in that token, for history only: nothing new can be issued in them.
- The paid date comes from the payment declarations on each invoice, or else its first tracked transaction.
- Drafts and canceled or rejected invoices are passed through with their status; the importer skips them and counts them.
Rehearse with a dry run
With --dry-run the importer does everything, rolls it back and prints the report.
uv run manage.py import_invoices --source zaprite --org <slug> --dry-run < zaprite.ndjson
uv run manage.py import_invoices --source rf --org <slug> --dry-run < request-finance-export-<date>.ndjson
Read the report
The report counts and names records by id. It never prints a client’s name, address, e-mail or amount.
Example output:
DRY RUN: nothing was written (source rf, org studio)
contacts: new 38, merged 3, without e-mail 2, skipped (already imported) 0
invoices invoice EUR: 112
invoices invoice USDC: 9
total EUR: 9412650 minor units
total USDC: 18420500000 minor units
skipped, already imported: 0
source status paid: 121
skipped by source status canceled: 1
skipped by source status draft: 1
number collisions: 2
rf:6f1c0e9a number 14 -> 14-RF
rf:a03b77d2 number 15 -> 15-RF
refused lines: 1
line 88 rf:9d24c5e1: the lines do not add up to total_minor
skipped rf:51e8b2f0: source status draft
skipped rf:c7a90d13: source status canceled
- Contacts are merged with clients you already have by e-mail address; the newer record’s details win.
- Number collisions list every invoice that was renumbered, with its old and new number.
- Refused lines say what is wrong, never the value. Fix the export and run again.
Import
Run the same command without --dry-run.
uv run manage.py import_invoices --source rf --org <slug> < request-finance-export-<date>.ndjson
An import that stopped half-way is simply run again: invoices already imported are skipped.
What the importer does
- Every invoice is imported as paid. It gets a confirmed payment for its total, dated the day the source says it was paid.
- Every invoice is marked migrated. Nothing can send, pay, reverse, void, reissue, quote or delete it afterwards, from the staff pages or through the API. An attempt answers:
- Numbers are kept. A number the organization already uses becomes
14-RF(then-RF2,-RF3) for Request Finance, or14-Z2(then-Z3) for Zaprite. A number shaped like your own numbering and not below your next number is refused, to be decided by hand. - Idempotent. An invoice whose source reference is already there is skipped. Each invoice is written in a transaction of its own.
- One at a time. A second import while one runs is refused, and writes nothing.
- Quiet. No letter, no webhook, no quote, no client link, and your own next invoice number does not move.