Skip to main content

File Imports

A file import adds transactions from an OFX, QFX, QIF or CSV file to one existing account. It is a different thing from a source import, which moves a whole budget from another product.

For OFX, QFX and QIF the import has a review step: Budget Thing validates the whole file without writing anything, returns a preview, and only writes when you confirm. CSV imports keep their column-mapping flow and write after the mapping is confirmed; they have no confirm step.

Scopes and roles​

OperationScope
Create, complete, confirm an import; set a CSV mappingimports:write
Get or list imports; preview CSV columnsimports:read

Writing also requires the token's owner to be an owner, admin or editor of the workspace. An import can only be read by the user who created it.

The lifecycle (OFX, QFX, QIF)​

POST /api/v1/workspaces/{workspaceID}/accounts/{accountID}/imports → pending_upload
PUT <upload.url> (the file itself)
POST /api/v1/workspaces/{workspaceID}/accounts/{accountID}/imports/{importID}/complete → previewing
GET /api/v1/workspaces/{workspaceID}/accounts/{accountID}/imports/{importID} → awaiting_confirmation (with preview)
POST /api/v1/workspaces/{workspaceID}/accounts/{accountID}/imports/{importID}/confirm → queued
GET /api/v1/workspaces/{workspaceID}/accounts/{accountID}/imports/{importID} → processing → completed | completed_with_errors | failed

The same flow as statuses. Each label is the request that moves the import on; poll means reading it with GET until the status changes.

StatusMeaning
pending_uploadCreated. Upload the file, then complete.
previewingThe file is being validated and compared with the account. Nothing is written. Poll.
awaiting_confirmationThe preview is ready in preview. Nothing has been written. Confirm to import.
awaiting_mappingCSV only: waiting for a column mapping. A file matching a built-in layout (such as Goodbudget) also stops here, with csvMappingStatus suggested and the layout returned as suggestedMapping by the CSV preview; a file matching a layout the user saved is queued directly (automatically_matched).
queuedAccepted and waiting for a worker.
processingWriting transactions.
completedFinished. The counts report what happened.
completed_with_errorsFinished, but some rows failed or produced warnings.
failedEnded without importing. errorSummary says why.
expiredThe upload was never completed, or the preview was not confirmed in time.
Behavior change

Before the review step, completing an OFX, QFX or QIF upload returned queued and transactions were written immediately. It now returns previewing, and nothing is written until POST …/confirm. Integrations that complete an upload and wait for completed must call the confirm endpoint. CSV imports are unchanged.

An unconfirmed preview is kept for 24 hours (IMPORT_PREVIEW_TTL on a self-hosted installation) and then becomes expired.

The preview​

GET …/imports/{importID} returns a preview object while the status is awaiting_confirmation:

{
"id": "imp_8Hk2PqLm4Zt9VwXc1RbN6A",
"status": "awaiting_confirmation",
"format": "ofx",
"originalFilename": "checking.ofx",
"totalCount": 4,
"preview": {
"digest": "5b1f0c…",
"rowCount": 4,
"dateFrom": "2026-07-15",
"dateTo": "2026-07-18",
"currency": "USD",
"possibleDuplicateWindowDays": 3,
"counts": {"new": 1, "duplicateIdentity": 1, "excludedDeleted": 0, "possibleDuplicate": 1, "error": 1},
"payees": {"existing": 1, "new": 1, "newNames": ["Corner Shop"]},
"rows": [
{"row": 88, "status": "error", "message": "invalid amount"},
{"row": 1, "status": "possible_duplicate", "date": "2026-07-15", "amountMinor": -1234,
"payee": "Corner Shop", "payeeStatus": "new",
"match": {"transactionId": "txn_4aV7cNq2LwXe9HdYb3KfTg", "date": "2026-07-14", "amountMinor": -1234, "payee": "Corner Market"}},
{"row": 2, "status": "new", "date": "2026-07-16", "amountMinor": 100000, "payee": "Employer", "payeeStatus": "existing"},
{"row": 3, "status": "duplicate_identity", "date": "2026-07-17", "amountMinor": -500, "payeeStatus": "none"}
],
"rowsTruncated": false,
"refreshed": false
}
}
FieldNotes
digestAn opaque fingerprint of the preview. Send it back when confirming.
rowCount, dateFrom, dateTo, currencyTotals for the whole file.
countsRows by status, for the whole file. error counts rows that could not be read.
payeesexisting payees matched, and new distinct payees that would be created if every row that is not already imported were imported. newNames lists up to 50.
rowsPer-row detail, at most 1,000 rows. Errors and possible duplicates come first, then new and already-imported rows. rowsTruncated is true when the list is shorter than the file.
possibleDuplicateWindowDaysThe ± day window used to flag possible duplicates.
refreshedtrue when the data changed after a confirmation and the import was returned for review. See When the data changes.

Each row has a status:

statusMeaningOn confirm
newNot seen before.Imported.
duplicate_identityThe same bank transaction ID (or fingerprint) was already imported from this format into this account, and the transaction still exists.Skipped. Counted in duplicateCount.
excluded_deletedThe row was imported before and its transaction has since been deleted without being cleared for re-import (see Deleted rows stay out).Skipped. Counted in excludedCount, not in duplicateCount.
possible_duplicateAn existing transaction in this account has the same amount, the same direction (income or expense) and a date within the window, and did not come from an import of the same format. It could be typed in, synced, or imported from another format. match describes it.Skipped unless you choose to import it. Counted in skippedCount.
errorThe record could not be read. row is the source line (or the transaction number for formats without lines).Skipped.

amountMinor is signed, in the workspace currency's minor units, like transaction amounts: negative is money leaving the account.

Confirm the import​

curl -X POST https://api.budgetthing.com/api/v1/workspaces/wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty/accounts/acct_6TnWq1ZsB8cYpD3uVxRk2M/imports/imp_8Hk2PqLm4Zt9VwXc1RbN6A/confirm \
-H "Authorization: Bearer $BUDGETTHING_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"previewDigest": "5b1f0c…",
"possibleDuplicates": "skip",
"importRows": [1]
}'
FieldRequiredNotes
previewDigestYespreview.digest of the preview that was reviewed.
possibleDuplicatesNoskip (default) or import: what to do with every possible_duplicate row.
importRowsNoRow numbers to import even when possibleDuplicates is skip.
skipRowsNoRow numbers to skip even when possibleDuplicates is import.

Row numbers that are not flagged as possible duplicates are ignored. The response is the import with status queued. Poll GET …/imports/{importID} until it is completed, completed_with_errors or failed.

What the commit guarantees​

The commit validates the file again and classifies every row the same way the preview did. If the classification matches the preview whose digest you confirmed, it writes exactly what the preview showed. The unique source identity in PostgreSQL stays the final guard against duplicates: if a concurrent import wins the race for a row, that row is counted in duplicateCount instead of being written twice.

Skipped possible duplicates are counted in skippedCount and recorded as info entries (code possible_duplicate_skipped) in issues.

When the data changes​

If the classification no longer matches the confirmed preview — for example a bank sync added a matching transaction, or the same file was imported elsewhere — the commit writes nothing. The import returns to awaiting_confirmation with a fresh preview (refreshed: true, new digest) and your earlier choices are discarded. Review the new preview and confirm again.

A confirm request whose previewDigest is no longer current is refused with 409 IMPORT_PREVIEW_CHANGED. Fetch the import to get the current preview.

StatuscodeWhen
409IMPORT_PREVIEW_CHANGEDpreviewDigest is missing or is not the current preview's digest.
409IMPORT_ALREADY_COMPLETEDThe import is not awaiting confirmation (including a second confirm of the same import).
410UPLOAD_EXPIREDThe preview expired before it was confirmed.
422INVALID_POSSIBLE_DUPLICATE_ACTIONpossibleDuplicates is not skip or import.
403FORBIDDENThe token's owner cannot edit data in the workspace.

Deleted rows stay out​

Every transaction a file import creates carries an import marker that is what makes the same row a duplicate next time. When you delete such a transaction the marker is either cleared or kept, and the difference decides what a later import of the same file does:

  • Cleared (the default for every delete): the row is new again and a later import brings it back.
  • Kept: the row is skipped on every later import and reported as deleted before. Use this when a copy of a transaction you typed in by hand was imported and deleted, and overlapping bank exports would otherwise bring it back every time.

A marker whose transaction no longer exists counts as kept, including markers left behind by deletions made before this behavior existed: there is no way to tell whether those deletions were deliberate. Such rows are skipped and counted in excludedCount (excluded_deleted in the preview), never imported silently and never counted as duplicates.

Both delete endpoints take an opt-in to keep the markers. Omitting it, or sending false, clears them.

EndpointHow to keep the markers
DELETE /api/v1/workspaces/{workspaceID}/transactions/{transactionID}Query parameter excludeFromImport=true
POST /api/v1/workspaces/{workspaceID}/transactions/bulk/deleteBody field "excludeFromImport": true

The option only affects transactions created by a file import; for anything else it does nothing. A transaction response has fromFileImport: true when a file import created it and its marker is still in place. Deleting an account, and every other way transactions are removed, always clears the markers.

Transaction rules​

Create an import with "applyRules": false to skip the workspace's transaction rules for it. The field is optional and defaults to true; the import response echoes it as applyRules.

curl -X POST "$BASE/api/v1/workspaces/$WORKSPACE/accounts/$ACCOUNT/imports" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"filename": "checking.ofx", "applyRules": false}'

When on, rules run once for each row the import creates, after the duplicate checks, with the file's payee text as the original description and payee. They can set the payee, category, tags, memo and needs-review flag, split it across categories, and mark it cleared, in rule order with the usual stop and overwrite behavior, limited to the rules the workspace owner's plan covers. Each applied rule writes an application with trigger import. Skipped duplicates and existing transactions are never changed, and the preview classification is not affected.

Import the deleted rows anyway​

An import with excludedCount above zero can be followed by one that brings only those rows back. Create a new import with the earlier import's ID as importDeletedFrom and upload the same file again:

curl -X POST https://api.budgetthing.com/api/v1/workspaces/wks_3fQ0mZk8Xr2Lp9Va6Ne1Ty/accounts/acct_6TnWq1ZsB8cYpD3uVxRk2M/imports \
-H "Authorization: Bearer $BUDGET_THING_TOKEN" \
-H "Content-Type: application/json" \
-d '{"filename": "checking.ofx", "importDeletedFrom": "imp_8Hk2PqLm4Zt9VwXc1RbN6A"}'

The response and the rest of the lifecycle are the same as for any import, with these differences:

  • The import has mode: "excluded_only" and no review step: complete moves it straight to queued for every format.
  • The format, and for CSV the column mapping, come from the earlier import, so you do not send format or csvTemplateId.
  • It imports only the rows whose markers were kept or orphaned, and clears those markers. Every other row in the file is left alone: rows that were never imported are not added, and rows that still have their transaction are counted in duplicateCount.
  • Afterwards the imported rows are ordinary duplicates of the new transactions.

An import that skipped no deleted rows (excludedCount of 0) is refused, and so is one that does not exist for the caller, because an import can only be read by the user who created it:

StatuscodeWhen
409IMPORT_HAS_NO_DELETED_ROWSThe import named in importDeletedFrom skipped no deleted rows.
404IMPORT_NOT_FOUNDThe import named in importDeletedFrom is not an import of this account made by the caller.

CSV imports of all-accounts files​

A CSV whose headers match a preset or saved template is mapped automatically when you complete the upload. When that mapping has an accountColumn, the file holds several accounts, so the import does not start on its own: it stops at awaiting_mapping until you choose which accounts to import.

  1. GET …/imports/{importID}/preview returns templateName (the matched preset or saved template), suggestedMapping (with accountColumn set) and accounts: every distinct account name in the file with its row count, [{"name": "Everyday Checking (...1111)", "count": 2}].
  2. POST …/imports/{importID}/mapping with that mapping and an accountFilter listing the account names to import. The response is the import with status queued.
Mapping fieldNotes
accountColumnName of the CSV column holding the source account.
accountFilterAccount names to import. Matching ignores case and extra spaces. Required (at least one name) when accountColumn is set; at most 500 names. Only valid together with accountColumn.

Rows for accounts that are not listed are left out of the import and are not counted. Whatever you choose, every row lands in the account the import was created for. Column templates describe the file layout only: saving a template drops accountFilter, so a matched template always stops at awaiting_mapping and the account choice is made on each import. Workspace templates take precedence over system presets when both match the same headers.

Webhook events​

A file import publishes transaction_import.started, transaction_import.completed and transaction_import.failed. For OFX, QFX and QIF files started is sent when the confirmed import begins writing, not while the preview is prepared, and a commit that returns the import for review sends no started or completed event. A preview that fails sends transaction_import.failed.

The counts object on transaction_import.completed includes excluded, the number of rows skipped because the transaction was deleted before. They are not included in duplicates.

See also Source Imports, Scopes and Webhook Events.