Finance export files and master-data import
Freeze ready journals or contacts into a CSV file for your accounting system, confirm the import to mark them posted, and bring accounts, tax codes, dimensions and contacts in from CSV with a mapping screen.
Your accounting system keeps the books; Finance keeps it in step. Files come first: an export file and a CSV import
work on every install, air-gapped ones included, and make no outbound call. Petawork never sends the file anywhere. A
person downloads it and imports it in the accounting system. Both live in Finance > Connectors
(/finance/connectors), which appears in the side nav when your organisation has the Connectors module
(finance.connectors). With the module off, the page, the tools and the REST routes answer 403 product_not_enabled.
Export files
An export batch takes the ready journals of one entity whose date falls in a month or a date range, freezes them,
and renders them with a template. Pick New export, then the entity, the template and the month (or a from and to
date). The batch gets a number per entity (EXP-000001) and opens beside the list.
- Only ready journals are exported: never a draft, a voided or posted journal, or one whose amounts do not balance in the entity's functional currency. A batch that would hold one is refused with the journal's number.
- A journal is in at most one open batch. When two people make a batch for the same month at the same time, the journals go into one batch and the other person is told nothing is left to export.
- The batch keeps what it exported as it was: account codes and names, tax code names, party names, dimension names. Download it again next week and you get the same bytes, even if an account was renamed since. The page shows the file's SHA-256 so you can compare.
- At most 1,000 journals per batch. For more, export shorter ranges.
Confirm or cancel
After your accounting system has imported the file, open the batch and press Confirm import. Each journal in it is
marked posted in the journal outbox, with the batch's id as its external reference, and the batch is
confirmed. Only a person confirms, with journals.write on the entity (a controller), from the console or with a
credential that has finance:admin. An agent may make a batch but never confirms one: the import happened in a system
it did not see.
If a journal in the batch changed since the file was made, confirming is refused: cancel the batch and make a new one. Cancel export before confirming releases its journals for another batch and marks nothing posted.
While a batch is open, its journals cannot be voided: the file may already be in the accounting system. Voiding one is refused with the batch's number; cancel the batch first, or confirm it and then reverse the journal. After a confirm, the journals are posted and only reversed; the reversal is ready for the next batch like any other journal.
Templates
Every template is a JSON column map with a golden file in the tests: the columns in order, a field of the journal or
contact for each, the date format, the line ending and the encoding. Files are UTF-8 with no byte order mark and CRLF
line ends. Amounts are written from whole minor units, with the currency's decimal places and no thousands separator.
A text cell that a spreadsheet would run as a formula (starting with =, +, -, @, a tab or a carriage return)
gets a leading apostrophe; negative amounts are numbers, not text, and are left as they are.
| Template | What it holds | Offered |
|---|---|---|
generic_journal_csv Journal CSV (Petawork) |
One row per journal line: number, date, period, memo, source, line, account code and name, description (the journal's memo when the line has none), tax code, party, dimensions (key=code;key=code), the line's currency, debit and credit, rate, functional currency, functional debit and credit |
Yes |
generic_contacts_csv Contacts CSV (Petawork) |
One row per vendor or customer of the entity and the shared ones (blocked ones left out): name, kind, legal name, tax id, country, currency, payment terms, first contact, external reference, status. Its columns are the contact import's, so it imports back | Yes |
xero_manual_journals Xero manual journals |
Narration and date on a journal's first line only, description, account code, tax rate by name, signed amount (debits positive, credits negative), two tracking pairs. Xero's import guide, checked 2026-11-23 | Not yet |
qbo_journal_entries QuickBooks Online journal entries |
Journal No., Journal Date, Account Name, Debits, Credits, Journal/Description, Name. Intuit's import guide, checked 2026-11-23 | Not yet |
xero_contacts Xero contacts |
ContactName, EmailAddress, TaxNumber, POCountry. Xero's contact import guide, checked 2026-11-23 | Not yet |
A vendor template is offered once every detail of its layout is confirmed against the vendor's current import
documentation. Xero's guide names the columns, the date format (dd/mm/yyyy), the sign rule and that a row with a
blank narration and date belongs to the journal above, but not the column order or whether the template's headings
carry an asterisk; Intuit's guide names the columns but not the date or amount format. Until they are confirmed
against the template files the vendors offer for download, these layouts are drafts: they are rendered and tested,
but no screen or tool offers them. Use the Petawork journal CSV meanwhile: both systems let you map columns when you
import a CSV.
Bills, sales invoices and payments get their templates when those records exist in Finance.
Importing the file in your accounting system
- Xero: Accounting > Manual journals > Import. Imported journals come in as drafts in Xero; post them there, then confirm the batch here.
- QuickBooks Online: Settings > Import data > Journal entries. Turn account numbers off and the duplicate journal number warning off first, as Intuit's guide says.
- Anything else: the Petawork journal CSV has every field; map its columns in your system's importer.
Master-data import
Import brings accounts, tax codes, dimensions with their values, and contacts (vendors and customers) in from a CSV file, through the same checks as adding them one by one.
- Pick what the file holds and, for accounts and contacts, the entity they belong to (or leave them shared).
- Choose the file. It is read in your browser (at most 2 MB and 5,000 rows; comma, semicolon or tab separated).
- Match the columns: for each field, pick the file's column that feeds it. A column named like the field is matched for you. Fields marked with a star are required.
- Preview shows the first rows as matched and every row that cannot be imported, by line, with why.
- Run import leaves those rows out and writes the rest. The import is a background job: the page shows its progress, and it carries on with the page closed. One import of each kind runs at a time.
The fields (* required):
| Kind | Fields |
|---|---|
| Accounts | code, name, type* (asset, liability, equity, income, expense), external_ref, active (yes or no) |
| Tax codes | code, name, kind* (vat, gst, sales, withholding), rate* (a percent, like 9 or 7.5), country* (SG, GB, ...), recoverable (yes or no), account_code (one of your accounts), active |
| Dimensions | dimension_key* (lower case, like cost_centre), dimension_name (for a new dimension), value_code, value_name, parent_code (a value earlier in the file or already there), active |
| Contacts | name, kind (vendor, customer, both), legal_name, tax_id, country, default_currency, payment_terms_days, contact_name, contact_email (a billing contact), external_ref |
- Accounts and tax codes are matched by code (and country for tax codes): a known one is updated, a new one created. Dimension values are matched by code within their dimension. Running the same file twice changes nothing the second time.
- A contact with the same name or tax id as one you have is skipped and listed, never merged. New contacts start as drafts, to be verified as usual (Finance parties).
- A row the database refuses while writing (a tax code naming an account you do not have) is listed by line; the rest are written.
- Importing accounts, tax codes and dimensions changes Finance's settings: it needs
reference.write(a controller) and, for an app,finance:admin. Contacts needparties.write. Rights are checked again at every step. - Every write lands on the event chain as it would by hand, and the job adds one
finance.import.completedevent with its counts.
For agents
| Tool | REST | What it does |
|---|---|---|
finance_export_create |
POST /api/v1/finance/exports |
Make a batch: entity_id, template, period or date_from and date_to |
finance_export_list |
GET /api/v1/finance/exports |
Batches, newest first, and the templates on offer |
finance_export_get |
GET /api/v1/finance/exports/{id} |
One batch, its entries and the file as text (up to 1 MB) |
finance_export_confirm |
POST /api/v1/finance/exports/{id}/confirm |
A person confirms the import (needs finance:admin) |
finance_export_cancel |
POST /api/v1/finance/exports/{id}/cancel |
Cancel an open batch |
finance_import_start |
POST /api/v1/finance/imports |
Preview (dry_run) or start an import: kind, csv, mapping, entity_id |
finance_import_start |
POST /api/v1/finance/imports/{job_id}/continue |
Carry a running import on |
finance_import_get |
GET /api/v1/finance/imports/{id} |
One import: status, counts and the rows it left out |
{"kind":"accounts","csv":"Code,Name,Type\n4000,Rooms,income\n","mapping":{"code":"Code","name":"Name","type":"Type"},"dry_run":true}