Menu

Imports

Bulk async ingest: SIE files (Fortnox/Visma/BL/SpeedLedger/Bokio migrations) and bank statements (CSV per bank, Excel, camt.053).

Endpoints


POST /api/v1/companies/:companyId/imports/bank

imports.bank · scope transactions:write

Import a bank-file (CSV / Excel / XML / CAMT053).

Accepts a bank statement file (CSV in UTF-8 / UTF-16 / Windows-1252, an Excel workbook .xls / .xlsx, or camt.053 XML; up to 10 MB) as multipart/form-data. Auto-detects the bank format (SEB, Swedbank, Handelsbanken, Nordea, Nordea Business, Lansforsakringar, Lunar, ICA Banken, Skandia, Wise transaction history, Wise balance statement, CAMT053, generic CSV) or honors a format override. Parses transactions, ingests them into the transactions table (NOT into journal entries: see BFL note in pitfalls), and emits transaction.synced events. Returns operation_id for polling.

Use when: Importing a bank statement export for a period. Common with PSD2 bank connections that don't auto-sync, or for legacy bank accounts.

Don't use for: SIE bookkeeping import (use /imports/sie). Auto-bank sync (use the enable-banking extension). Single-transaction creation (use POST /transactions/ingest with a 1-element array).

Pitfalls

  • File size cap: 10 MB. Larger files require splitting client-side.
  • format query parameter is optional; auto-detection works for all supported banks. Pass format only to force a specific format. Accepted values: seb, swedbank, handelsbanken, nordea, nordea_business, lansforsakringar, ica_banken, skandia, lunar, northmill, wise, wise_statement, generic_csv, camt053.
  • Wise transaction-history rows with refunded or unknown statuses, unknown directions, or different source and target currencies are rejected instead of guessed. Import the matching per-currency Wise balance statements.
  • Duplicate detection is by external_id (composed from format + date + description + amount + row index, or the camt.053 entry reference / Wise transfer id where the file carries one); a re-import of the same file typically deduplicates rather than creating doubles.
  • Rows bind to the cash account the file names when the company already has it. A file covering a period a completed SIE import booked is matched against the imported vouchers and never auto-categorized.
  • A row the parser cannot read is skipped and the rest are imported. The operation still ends succeeded, so read its result: import_complete: false means rows are missing, transactions_skipped counts them and skipped_rows names each with its row and reason. Correct the file and import it again: rows already in are recognised.
  • A generic CSV whose amounts read a thousand apart under the two decimal marks ("349.000"), with no other amount settling which, is refused with 400 VALIDATION_ERROR and imports nothing. Write the amounts with two decimals.
  • BFL 5 kap 6-7 §§ note: this endpoint creates transactions rows (the underlag for a verifikation), NOT verifikationer themselves. The verifikation content requirements are in BFL 5 kap 6-7 §§; until each transaction is matched to an invoice/supplier-invoice (POST /transactions/{id}/match-*) or categorised (POST /transactions/{id}/categorize), the bookkeeping obligation isn't discharged. A successful import here means the data is ingested: not booked.
  • A successful import returns operation_id; poll /operations/{id} for the final ingested/duplicates/errors counts and whether the file was read to its last row (import_complete).

Risk: medium · Idempotent: yes · Reversible: no · Dry-run supported: no

Query parameters

NameTypeRequiredDescription
format"nordea" | "nordea_business" | "seb" | "swedbank" | "handelsbanken" | "lansforsakringar" | "ica_banken" | "skandia" | "lunar" | "northmill" | "wise" | "wise_statement" | "generic_csv" | "camt053"noForce this bank file format instead of auto-detection. Omit to auto-detect.

Response fields

NameType
operation_idstring
type"import.bank"
status"queued"
poll_urlstring

Example response

{
  "data": {
    "operation_id": "op_a8f1…",
    "type": "import.bank",
    "status": "queued",
    "poll_url": "/api/v1/operations/op_a8f1…",
    "webhook_event": "operation.completed"
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

POST /api/v1/companies/:companyId/imports/bank/:id/undo

imports.bank.undo · scope transactions:write

Undo a bank file import: delete the rows it created that are still unbooked.

Hard-deletes every transaction the import created that is still unbooked (ignored rows included) and marks the import undone, so the same file can be imported again. Rows that are booked or linked to a verifikat, and rows with payment match history, are never touched: they are counted in skipped_booked and skipped_match_history, and their verifikat stay as they are (unlink or reverse them separately). Owner/admin only. Idempotent. Dry-runnable (the dry run counts what would be deleted and skipped).

Use when: The wrong file, the wrong account or a duplicate file was imported and its rows should go.

Don't use for: Removing single rows (DELETE /transactions/{id} for manual rows; ignore bank rows), bank-feed rows (they have no import), or SIE imports (POST /imports/sie/{id}/undo).

Pitfalls

  • Only a completed import can be undone: 409 BANK_FILE_UNDO_NOT_COMPLETED otherwise.
  • Owner or admin only: a member key gets 403 BANK_FILE_UNDO_FORBIDDEN.
  • Booked rows survive the undo (skipped_booked > 0): to remove them, reverse their verifikat first, then delete or ignore the rows.
  • Imports made before rows were stamped with their import id delete nothing (deleted_transactions 0).
  • transaction_id (any row the import created) stands in for the import id over MCP, where import ids are not listed; the staged undo is pinned to the import it resolved to. Over v1 the path names the import: a body transaction_id is refused.

Risk: high · Idempotent: yes · Reversible: no · Dry-run supported: yes · Stage for approval: yes (?stage=true)

Query parameters

NameTypeRequiredDescription
dry_runstringnotrue (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits.
stagestringnotrue stages the write for approval instead of committing it: 202 with the pending operation to approve via POST /pending-operations/{id}/approve. Absent or false commits; other values are 400. A reason in the body (why you propose it, at most 500 characters) is shown to the approver as agent_reason and kept with the decision.

Request body

NameTypeRequired
transaction_idstringno

Response fields

NameTypeDescription
bank_file_import_idstring
deleted_transactionsnumber
skipped_bookednumberBooked or verifikat-linked rows left untouched.
skipped_match_historynumberUnbooked rows kept because their match history is append-only.

Example request

{}

Example response

{
  "data": {
    "bank_file_import_id": "9a8b…",
    "deleted_transactions": 212,
    "skipped_booked": 3,
    "skipped_match_history": 0
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

POST /api/v1/companies/:companyId/imports/sie

imports.sie · scope bookkeeping:write

Import a SIE4 file.

Accepts a SIE4 file (CP437 / Windows-1252 / UTF-8 auto-detected, up to 50 MB) as the request body, parses it, checks for duplicate imports by file-hash, and replays every #VER + #TRANS into the company's bookkeeping. Returns an operation_id immediately: poll GET /api/v1/operations/{id} for status + final result. The byte-equivalent dashboard route at /api/import/sie/execute backs the same lib helper, so a SIE imported via v1 matches what the dashboard would produce.

Use when: Migrating bookkeeping data from another system (Fortnox, Bokio, Visma) into Accounted, restoring from a backup .se file, or recreating a period from an archive.

Don't use for: Bank transaction CSV/XML imports (use POST /imports/bank). Single-voucher creation (use POST /journal-entries). Importing into a period that already has posted entries: SIE imports run on a fresh period.

Pitfalls

  • Body content-type must be multipart/form-data with either a file field carrying the .se / .sie / .si file, or storagePath and filename fields from the signed-upload endpoint.
  • Files up to 50 MB use POST /imports/sie/upload, then upload bytes to Storage and submit storagePath + filename. Inline multipart is limited by the hosting gateway.
  • An identical retry returns the same execution. Deliberate replacement requires options.onExistingPeriod=replace and options.supersedesImportId naming the reviewed predecessor, and uses a new batch after storno.
  • A fiscal year that already has a posted ingående balans booked outside an import (by hand or by a year-end close) answers 409 SIE_IMPORT_PERIOD_HAS_OPENING_BALANCE when the import would book the file's IB on top of it (importOpeningBalances true and no earlier bookkeeping): resend with options.importOpeningBalances=false to import the vouchers on top of the posted IB. A year that already holds an import answers 409 SIE_IMPORT_PERIOD_ALREADY_IMPORTED.
  • To add only the file's vouchers the year does not hold yet (the last weeks booked in the old system, a card provider, payroll or POS export), send options.onExistingPeriod=append: they post as their own batch beside the year's import, numbers continuing per series, and undo alone. A voucher with the same source series and number as a posted one is skipped when identical and refuses the whole append when changed (409 SIE_IMPORT_APPEND_CONFLICT, details.conflicts). One with the same date and lines as a posted entry but no matching number is a possible duplicate, skipped unless options.includePossibleDuplicates=true. Also 409: an #IB unlike the year's (SIE_IMPORT_APPEND_OPENING_BALANCE_DIFFERS), an unbalanced or unmapped new voucher (SIE_IMPORT_APPEND_INVALID_VOUCHERS), nothing new (SIE_IMPORT_APPEND_NOTHING_NEW), a closed or locked period (SIE_IMPORT_PERIOD_LOCKED). options.seriesMap books a source series in another ({"K":"A"}). The year's import cannot be undone or replaced while an append is live (409 SIE_IMPORT_HAS_LIVE_APPEND).
  • A file with #VER and no #IB, #UB or #RES (a card provider, payroll or POS export) is never a replacement of an imported year: 409 SIE_IMPORT_VOUCHERS_ONLY_FILE. Never undo the year's import for it: append it (options.onExistingPeriod=append).
  • A file whose #ORGNR is not the company's organisation number answers 409 SIE_IMPORT_ORG_NUMBER_MISMATCH with both numbers in details. Check with the user, then resend with options.confirmOrgNumberMismatch=true to import it anyway. A file without #ORGNR is not checked.
  • The operation can take 1-5 minutes for multi-year files. The HTTP response returns immediately with operation_id; poll /operations/{id} every ~2s for status.
  • Chunks are visible while importing. Filing and export are held until completion. Undo uses batch storno and retains accounting history.
  • options (a JSON string field) takes createFiscalPeriod, importOpeningBalances, importTransactions, updateAccountNames (each default true), voucherSeries (for vouchers the file gives no series; default B, as the dashboard), openingBalanceSeries (default: a series the file does not use), markImportedNoDocRequired (default false), onlyUsedAccounts (default false; true leaves out the BAS accounts with no balance and no voucher line in the file, while the file's own non-BAS accounts are still created and the archived file keeps everything), onExistingPeriod (block, replace or append), supersedesImportId, includePossibleDuplicates, seriesMap and confirmOrgNumberMismatch; any other key is 400.
  • Account mappings are generated server-side from the file's #KONTO records (plus stored per-company overrides), by the same rules as the dashboard upload: a class 9 account carrying amounts is mapped to 2999 OBS-konto, also over a stored class 9 mapping. By default the file's account names are carried into the chart, renaming existing accounts whose names differ: pass options.updateAccountNames=false to keep BAS default names.

Risk: high · Idempotent: yes · Reversible: yes · Dry-run supported: no

Response fields

NameType
operation_idstring
type"import.sie"
status"queued"
poll_urlstring

Example response

{
  "data": {
    "operation_id": "7ce97122-264e-49ca-a795-e01dc77425e7",
    "type": "import.sie",
    "status": "queued",
    "poll_url": "/api/v1/operations/7ce97122-264e-49ca-a795-e01dc77425e7"
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

POST /api/v1/companies/:companyId/imports/sie/:id/resume

imports.sie.resume · scope bookkeeping:write

Resume an interrupted SIE import from where it stopped.

Re-queues a paused or interrupted durable SIE import (or an interrupted undo) so the worker continues from the last committed chunk; entries already posted are not posted again. A finished run (completed, undone, failed) is answered unchanged. Allowed to the user who ran the import and to owners/admins. Idempotent. Dry-runnable.

Use when: An SIE import stopped part-way (state paused, or running with no progress) and should continue.

Don't use for: Starting a new import (POST /imports/sie) or cancelling one (POST /imports/sie/{id}/undo).

Pitfalls

  • Another user's import needs an owner or admin key: 403 FORBIDDEN otherwise.
  • Legacy imports made before durable jobs return 409 SIE_IMPORT_LEGACY_REVIEW_REQUIRED.
  • Resuming an undo that a lock stopped returns 409 SIE_IMPORT_PERIOD_LOCKED until the user unlocks the range in details.reason; it then continues from the last committed chunk.

Risk: medium · Idempotent: yes · Reversible: no · Dry-run supported: yes

Query parameters

NameTypeRequiredDescription
dry_runstringnotrue (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits.

Response fields

NameTypeDescription
import_idstring
action"undo" | "resume"
statestringThe job state after the request, e.g. undoing, running, undone, completed.
phasestring | null
acceptedtrue

Example response

{
  "data": {
    "import_id": "7ce9…",
    "action": "resume",
    "state": "running",
    "phase": "vouchers",
    "accepted": true
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

POST /api/v1/companies/:companyId/imports/sie/:id/undo

imports.sie.undo · scope bookkeeping:write

Undo an SIE import by batch storno: every entry it posted is reversed, nothing is deleted.

Queues a batch storno of the import: each verifikat the import posted gets a reversing entry (BFL 5 kap 5 §) and the originals stay in the ledger. Asynchronous: the answer carries state "undoing" and the worker finishes in the background (state "undone"). Refused while another SIE run is active, while a reversal of an imported voucher is already in progress, while an imported voucher has a live correction, or when a date a storno must carry is locked (the fiscal year is closed or locked, or the company lock date covers it). Owner/admin only. Idempotent. Dry-runnable (the dry run counts the entries that would be reversed).

Use when: An SIE file was imported into the wrong company or year, or with a wrong mapping, and its entries must be cancelled before a corrected import.

Don't use for: Removing single vouchers (POST /journal-entries/{id}/reverse), bank file imports (POST /imports/bank/{id}/undo), or legacy imports made before durable jobs (409 SIE_IMPORT_LEGACY_REVIEW_REQUIRED: review them in the app).

Pitfalls

  • Nothing is deleted: the ledger keeps both the imported entries and their reversals, and voucher numbers are never reused.
  • Each storno is dated like the voucher it reverses. A closed or locked fiscal year, or a company lock date on or after the first imported voucher, returns 409 SIE_IMPORT_PERIOD_LOCKED before anything is queued; details.reason names the locked range and what to unlock (the user's decision).
  • Another active run or a live correction returns 409 SIE_IMPORT_ACTION_CONFLICT with details.reason.
  • Owner or admin only: a member key gets 403 FORBIDDEN.
  • Undoing an already undone import answers its state unchanged.

Risk: high · Idempotent: yes · Reversible: no · Dry-run supported: yes · Stage for approval: yes (?stage=true)

Query parameters

NameTypeRequiredDescription
dry_runstringnotrue (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits.
stagestringnotrue stages the write for approval instead of committing it: 202 with the pending operation to approve via POST /pending-operations/{id}/approve. Absent or false commits; other values are 400. A reason in the body (why you propose it, at most 500 characters) is shown to the approver as agent_reason and kept with the decision.

Request body

NameTypeRequiredDescription
reasonstringnoWhy: shown to the approver, not stored.

Response fields

NameTypeDescription
import_idstring
action"undo" | "resume"
statestringThe job state after the request, e.g. undoing, running, undone, completed.
phasestring | null
acceptedtrue

Example request

{
  "reason": "Importerad till fel räkenskapsår"
}

Example response

{
  "data": {
    "import_id": "7ce9…",
    "action": "undo",
    "state": "undoing",
    "phase": "undo",
    "accepted": true
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}

POST /api/v1/companies/:companyId/imports/sie/upload

imports.sie.upload · scope bookkeeping:write

Reserve a direct SIE upload.

Upload exact bytes to uploadUrl with PUT, then submit storagePath and filename to POST /imports/sie. The upload URL expires after two hours.

Use when: Importing files larger than the function request limit.

Don't use for: Booking a voucher: this only reserves storage.

Pitfalls

  • Use the returned URL once with PUT and application/octet-stream. Submit the returned storagePath after upload completes.

Risk: low · Idempotent: no · Reversible: yes · Dry-run supported: no

Request body

NameTypeRequired
filenamestringyes
sizenumberyes

Response fields

NameType
storagePathstring
uploadUrlstring
filenamestring

Example request

{
  "filename": "export.se",
  "size": 10485760
}

Example response

{
  "data": {
    "storagePath": "company/sie-intake/upload.se",
    "uploadUrl": "https://storage.example/upload",
    "filename": "export.se"
  }
}

POST /api/v1/companies/:companyId/imports/skattekonto-file

imports.skattekonto-file · scope transactions:write

Import a skattekontoutdrag file (Skatteverket tax account statement) into the skattekonto rows.

Parses the statement (the CSV export or legacy .skv from Skatteverket's Skattekonto e-tjänst, sent as base64), deduplicates it server-side against the skattekonto rows already stored, inserts the new events (source file_import), promotes upcoming rows the statement proves settled and skips duplicates. Books nothing: the rows are booked afterwards through the skattekonto rules, like synced rows. A file already imported is refused; a file naming another organisation number or not summing is refused unless confirmed. Idempotent. Dry-runnable: the dry run parses and counts and writes nothing.

Use when: The company has no Skatteverket connection (self-hosted, or not yet connected) and the skattekonto should be reconciled and booked from the statement file.

Don't use for: Companies with a Skatteverket connection (the hourly sync fetches the same events), bank statements (POST /imports/bank), or booking the rows (the skattekonto booking tools).

Pitfalls

  • Send the file bytes base64-encoded in content_base64, up to about 3 MB of file; the filename matters for legacy .skv detection.
  • A file already imported answers 409 SKATTEKONTO_FILE_DUPLICATE with details.import_id.
  • A header organisation number that is not the company's answers 409 SKATTEKONTO_FILE_ORG_NUMBER_MISMATCH: check the file, then resend with confirm_org_number_mismatch=true.
  • A statement whose saldo markers do not sum (filtered, truncated or edited) answers 409 SKATTEKONTO_FILE_SUM_MISMATCH: resend with confirm_sum_mismatch=true only if the gap is understood.
  • A file that is not a skattekontoutdrag answers 400 SKATTEKONTO_FILE_NOT_RECOGNIZED: a bank CSV is never accepted here.

Risk: medium · Idempotent: yes · Reversible: no · Dry-run supported: yes

Query parameters

NameTypeRequiredDescription
dry_runstringnotrue (any case) previews the write without committing it, like the X-Dry-Run: true header. Any other value commits.

Request body

NameTypeRequiredDescription
filenamestringyesThe file name as downloaded, e.g. "Kontoutdrag 556677-8899 2026-05-03--2026-08-01.csv".
content_base64stringyesThe file's bytes, base64-encoded (any encoding Skatteverket exports; decoded server-side).
confirm_org_number_mismatchbooleannoImport even though the file names another organisation number than the company's.
confirm_sum_mismatchbooleannoImport even though opening saldo plus the events does not equal the closing saldo.

Response fields

NameTypeDescription
import_idstring
importednumberNew skattekonto rows stored.
duplicatesnumberEvents already stored, skipped.
promotednumberUpcoming rows the statement proves settled, flipped to booked status.
errorsnumberRows that could not be written.
date_fromstring
date_tostring
closing_saldonumber | null
file_hashstring
variant"csv" | "skv"
row_countnumber

Example request

{
  "filename": "Kontoutdrag 556677-8899 2026-05-03--2026-08-01.csv",
  "content_base64": "U2thdHRla29udG8…"
}

Example response

{
  "data": {
    "import_id": "1f0c…",
    "imported": 14,
    "duplicates": 2,
    "promoted": 1,
    "errors": 0,
    "date_from": "2026-05-03",
    "date_to": "2026-08-01",
    "closing_saldo": 23490,
    "file_hash": "9a1b…",
    "variant": "csv",
    "row_count": 17
  },
  "meta": {
    "request_id": "req_…",
    "api_version": "2026-05-12"
  }
}