{
  "ListID": "80000001-1234567890",
  "TimeCreated": "2022-01-01T09:00:00-07:00",
  "TimeModified": "2024-05-02T14:30:00-07:00",
  "EditSequence": "1234567890",
  "Name": "Test Account",
  "FullName": "Parent Account:Test Account",
  "IsActive": true,
  "ParentRef": {
    "ListID": "80000002-0987654321",
    "FullName": "Parent Account"
  },
  "Sublevel": 1,
  "AccountType": "Expense",
  "SpecialAccountType": "AccountsPayable",
  "IsTaxAccount": true,
  "AccountNumber": "1234",
  "BankNumber": "987654321",
  "Desc": "This is a test account.",
  "Balance": "1000.00",
  "TotalBalance": "1500.00",
  "SalesTaxCodeRef": {
    "ListID": "80000003-2345678901",
    "FullName": "Tax Code"
  },
  "TaxLineInfoRet": {
    "TaxLineID": 1,
    "TaxLineName": "Tax Line Name"
  },
  "CashFlowClassification": "Operating",
  "CurrencyRef": {
    "ListID": "20000000-1234567890",
    "FullName": "USD"
  },
}

In QuickBooks Desktop, an account is a record that tracks the money coming in and going out of your business. Accounts are organized into a chart of accounts which includes assets, liabilities, income, and expenses. Each account has specific properties and characteristics.

To see all of the request parameters and response fields for , check out our client library’s amazing autocomplete.

Fetching accounts

Fetching accounts in QuickBooks Desktop is straightforward. You can use optional request parameters to filter the results as needed.

Fetching all accounts
const accounts = await conductor.qbd.account.query("{{END_USER_ID}}");
Fetching all accounts with a filter
const accounts = await conductor.qbd.account.query("{{END_USER_ID}}", {
  NameFilter: {
    MatchCriterion: "StartsWith",
    Name: "Test Account",
  },
});

Creating accounts

Creating accounts is also straightforward. There are several optional request parameters available, but the only required ones are Name and AccountType.

Creating an account
const account = await conductor.qbd.account.add("{{END_USER_ID}}", {
  // Create a unique name for testing because QBD requires unique names.
  Name: "Test Account " + Date.now(),
  AccountType: "Expense",
});

Fully qualified names

In QuickBooks Desktop, there is no “fully qualified name” field as in QuickBooks Online. The fully qualified name represents the account’s name within its hierarchy. However, you can construct the fully qualified name by recursively querying the parent accounts and concatenating their names:

  1. Start with the desired account.
  2. Query the account to retrieve its ParentRef.
  3. Recursively query each parent account until you reach the top-level account.
  4. Concatenate the names of the accounts from top to bottom, separated by colons (:).

The following code demonstrates how to construct the fully qualified name for an account:

Constructing the fully qualified name for an account
// Recursive helper function to get the fully qualified name of an account.
async function getFullyQualifiedName(endUserId: str, accountListId: str): str {
  const accounts = await conductor.qbd.account.query(endUserId, {
    ListID: accountListId,
  });

  if (accounts.length === 0) {
    throw new Error("Account not found");
  }

  const account = accounts[0];

  // If the account has no parent, return its name.
  if (!account.ParentRef) {
    return account.Name;
  }

  // Get the fully qualified name of the parent account.
  const parentFullyQualifiedName = await getFullyQualifiedName(
    endUserId,
    account.ParentRef.ListID,
  );
}

const END_USER_ID = "{{END_USER_ID}}";
const DESIRED_ACCOUNT_LIST_ID = "80000001-1234567890";

const fullyQualifiedName = await getFullyQualifiedName(
  END_USER_ID,
  DESIRED_ACCOUNT_LIST_ID,
);
console.log("Fully qualified name:", fullyQualifiedName);
{
  "ListID": "80000001-1234567890",
  "TimeCreated": "2022-01-01T09:00:00-07:00",
  "TimeModified": "2024-05-02T14:30:00-07:00",
  "EditSequence": "1234567890",
  "Name": "Test Account",
  "FullName": "Parent Account:Test Account",
  "IsActive": true,
  "ParentRef": {
    "ListID": "80000002-0987654321",
    "FullName": "Parent Account"
  },
  "Sublevel": 1,
  "AccountType": "Expense",
  "SpecialAccountType": "AccountsPayable",
  "IsTaxAccount": true,
  "AccountNumber": "1234",
  "BankNumber": "987654321",
  "Desc": "This is a test account.",
  "Balance": "1000.00",
  "TotalBalance": "1500.00",
  "SalesTaxCodeRef": {
    "ListID": "80000003-2345678901",
    "FullName": "Tax Code"
  },
  "TaxLineInfoRet": {
    "TaxLineID": 1,
    "TaxLineName": "Tax Line Name"
  },
  "CashFlowClassification": "Operating",
  "CurrencyRef": {
    "ListID": "20000000-1234567890",
    "FullName": "USD"
  },
}