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
| Operation | Scope |
|---|---|
| Create, complete, confirm an import; set a CSV mapping | imports:write |
| Get or list imports; preview CSV columns | imports: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.
| Status | Meaning |
|---|---|
pending_upload | Created. Upload the file, then complete. |
previewing | The file is being validated and compared with the account. Nothing is written. Poll. |
awaiting_confirmation | The preview is ready in preview. Nothing has been written. Confirm to import. |
awaiting_mapping | CSV 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). |
queued | Accepted and waiting for a worker. |
processing | Writing transactions. |
completed | Finished. The counts report what happened. |
completed_with_errors | Finished, but some rows failed or produced warnings. |
failed | Ended without importing. errorSummary says why. |
expired | The upload was never completed, or the preview was not confirmed in time. |
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
}
}
| Field | Notes |
|---|---|
digest | An opaque fingerprint of the preview. Send it back when confirming. |
rowCount, dateFrom, dateTo, currency | Totals for the whole file. |
counts | Rows by status, for the whole file. error counts rows that could not be read. |
payees | existing 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. |
rows | Per-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. |
possibleDuplicateWindowDays | The ± day window used to flag possible duplicates. |
refreshed | true when the data changed after a confirmation and the import was returned for review. See When the data changes. |
Each row has a status:
status | Meaning | On confirm |
|---|---|---|
new | Not seen before. | Imported. |
duplicate_identity | The 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_deleted | The 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_duplicate | An 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. |
error | The 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]
}'
| Field | Required | Notes |
|---|---|---|
previewDigest | Yes | preview.digest of the preview that was reviewed. |
possibleDuplicates | No | skip (default) or import: what to do with every possible_duplicate row. |
importRows | No | Row numbers to import even when possibleDuplicates is skip. |
skipRows | No | Row 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.
| Status | code | When |
|---|---|---|
409 | IMPORT_PREVIEW_CHANGED | previewDigest is missing or is not the current preview's digest. |
409 | IMPORT_ALREADY_COMPLETED | The import is not awaiting confirmation (including a second confirm of the same import). |
410 | UPLOAD_EXPIRED | The preview expired before it was confirmed. |
422 | INVALID_POSSIBLE_DUPLICATE_ACTION | possibleDuplicates is not skip or import. |
403 | FORBIDDEN | The 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.
| Endpoint | How to keep the markers |
|---|---|
DELETE /api/v1/workspaces/{workspaceID}/transactions/{transactionID} | Query parameter excludeFromImport=true |
POST /api/v1/workspaces/{workspaceID}/transactions/bulk/delete | Body 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:completemoves it straight toqueuedfor every format. - The format, and for CSV the column mapping, come from the earlier import, so
you do not send
formatorcsvTemplateId. - 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:
| Status | code | When |
|---|---|---|
409 | IMPORT_HAS_NO_DELETED_ROWS | The import named in importDeletedFrom skipped no deleted rows. |
404 | IMPORT_NOT_FOUND | The 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.
GET …/imports/{importID}/previewreturnstemplateName(the matched preset or saved template),suggestedMapping(withaccountColumnset) andaccounts: every distinct account name in the file with its row count,[{"name": "Everyday Checking (...1111)", "count": 2}].POST …/imports/{importID}/mappingwith that mapping and anaccountFilterlisting the account names to import. The response is the import with statusqueued.
| Mapping field | Notes |
|---|---|
accountColumn | Name of the CSV column holding the source account. |
accountFilter | Account 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.