The OFX format, explained for accountants
You do not need to write OFX, but being able to open one and see what it says turns a failed import from a mystery into a two-minute check.
What OFX is for
Open Financial Exchange is a specification for exchanging financial data between institutions and software, first published in the late nineties and stable since. Xero, Sage, MYOB, Wave, Zoho Books and QuickBooks all read some form of it.
Its advantage over CSV is that it is self-describing. A CSV date is ambiguous and its amount column may or may not be signed; an OFX date states its own format and its amounts are signed by definition. There is no mapping step because there is nothing to map.
Where a CSV import has fought you twice over column mapping, an OFX file with unambiguous dates and signed amounts removes the mapping step entirely because the format describes itself.
Reading one
A file has a header block, then a nested body. The parts worth knowing are few:
<BANKID> the routing or sort code
<ACCTID> the account number the file claims
<ACCTTYPE> CHECKING, SAVINGS, CREDITLINE
<DTSTART> period start, YYYYMMDD
<DTEND> period end
<STMTTRN> one transaction
<TRNTYPE> DEBIT, CREDIT, CHECK, FEE, INT...
<DTPOSTED> the date, YYYYMMDD
<TRNAMT> signed: negative is money out
<FITID> the transaction identifier
<NAME> descriptionMost import failures are visible here. A missing ACCTID, a period in the future, an ACCTTYPE that disagrees with the account you are importing into — all findable in under a minute with a text editor.
The two versions
Version 1.x is SGML: the header block above, and tags that need not be closed. Version 2.x is XML and begins with an XML declaration. Both are legitimate OFX, and a program that reads one may reject the other — QuickBooks in particular has historically expected 1.x.
A quick tell
If a file opens in a browser as a tidy expandable tree, it is OFX 2.x. That is a warning sign rather than a good one where the target software expects the older form.
Why it needs no bank ID
OFX carries a BANKID — a routing or sort code — which identifies the bank in the ordinary sense. What it does not carry is Intuit’s INTU.BID, which exists to confirm the institution participates in Web Connect. That tag is a commercial check, not a technical one, which is why plain OFX imports into non-Intuit software without one.
In practice this makes OFX the best default for anything that is not QuickBooks or Quicken: same data, no number to hunt for.
The transaction types, and what they change
TRNTYPE classifies each transaction, and importers use it to suggest a posting or to filter. The values you will actually meet are few.
- DEBIT and CREDIT — the generic pair, and what most converters write when the statement does not say more.
- CHECK — a cheque, usually with a CHECKNUM alongside it.
- FEE, SRVCHG and INT — bank charges and interest, which some importers route to their own accounts automatically.
- XFER — a transfer between accounts, worth distinguishing because posting one as income overstates revenue.
- ATM, POS, DIRECTDEP, DIRECTDEBIT — self-explanatory, and useful for filtering rather than for posting.
The sign in TRNAMT is authoritative regardless. A DEBIT with a positive amount is a contradiction some software resolves one way and some the other, so the type should never be relied on to carry direction.
The status block, and what a rejection looks like
Near the top of every file sits a sign-on response with a status code inside it. Zero means success. Anything else is the bank or the file telling you why it will not proceed, and it is worth reading before assuming the transactions are the problem.
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>Statement files produced by converters generally set this to zero as a formality. Files downloaded from a bank sometimes carry a real error here, which is the actual cause of an import that appeared to fail for no reason.
Balances, and why they matter for checking
A statement block carries LEDGERBAL, the closing balance, and often AVAILBAL, the available balance. These are the closest thing OFX has to a self-check: opening plus the sum of the transactions should reach the ledger balance.
Available balance is not the same figure and should never be used for that arithmetic — it reflects pending items and any overdraft facility, so it will not agree and is not supposed to.
Related
QBO vs QFX vs OFX vs QIF: which one does your software need?
Four formats, three of them nearly the same file with different requirements. What separates them, and which your accounting package will actually accept.
ReadWhat is a FITID, and why you keep getting duplicate transactions
One field decides whether re-importing a statement is harmless or doubles your books. How FITIDs work, and how to tell if your converter generates them badly.
ReadWhat is INTU.BID, and why does QuickBooks check it?
One tag inside a .qbo file decides whether QuickBooks accepts it. What the number is, where to find yours, and what to do when your bank has none.
Read