A journal entry's debit and credit lines come back in the order they were entered, not every debit line before every credit line
Observed 2026-10-02 on QuickBooks Enterprise Solutions 24.0 (US), reporting qbXML 17.0.
QuickBooks lists a journal entry's JournalDebitLine and JournalCreditLine elements in the order the lines were entered, not every debit line before every credit line. The TxnLineIDs rise in the order the lines are listed. The XSD allows any mix in any order, since the lines are one repeating xsd:choice, but it does not say which order QuickBooks answers in.
This query read two journal entries already in the company file:
<JournalEntryQueryRq requestID="4"><MaxReturned>2</MaxReturned><IncludeLineItems>true</IncludeLineItems></JournalEntryQueryRq>
The first entry lists its credit line first, the second its debit line first. With the account and entity refs cut:
<JournalEntryRet>
<TxnID>4E6E-1762201873</TxnID>
…
<RefNumber>1</RefNumber>
<IsAdjustment>false</IsAdjustment>
<JournalCreditLine>
<TxnLineID>4E6F-1762201873</TxnLineID>
<AccountRef>…</AccountRef>
<Amount>5000.00</Amount>
<EntityRef>…</EntityRef>
</JournalCreditLine>
<JournalDebitLine>
<TxnLineID>4E70-1762201873</TxnLineID>
<AccountRef>…</AccountRef>
<Amount>5000.00</Amount>
</JournalDebitLine>
</JournalEntryRet>
<JournalEntryRet>
<TxnID>4E71-1762201991</TxnID>
…
<JournalDebitLine>
<TxnLineID>4E72-1762201991</TxnLineID>
…
</JournalDebitLine>
<JournalCreditLine>
<TxnLineID>4E73-1762201991</TxnLineID>
…
</JournalCreditLine>
</JournalEntryRet>
A JournalEntryAdd sent with its debit line first was answered with its debit line first.
What to do
Do not assume a journal entry's lines come back grouped by element. If the order between debit and credit lines matters to your application, read the lines in document order, or sort them by TxnLineID. A parser that collects each element name into its own list keeps the order within each list but loses the order between them.
Not observed
- An entry with more than one line of a kind, so a debit, credit, debit run has not been seen.
- Invoices or bills mixing item and group lines.
- What a
JournalEntryModlisting the lines in a new order does.
QuBe Sync is a JSON API for QuickBooks Desktop that is built on what these findings show.