Skip to content
Desktop Accounting API

Connect an end user

Create a setup link for the customer’s company file.

  1. Create an end user and save its ID.
  2. Create an auth session and show authFlowUrl on the QuickBooks computer.
  3. Verify the connection with a health check after setup.

Use the setup-link example

Still stuck? Contact the app’s support.

Create one end user per customer company file, usually when the customer turns on your QuickBooks integration. Set sourceId to your own ID for that customer.

import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";
const client = new DesktopAccountingApi(); // reads DAAPI_SECRET_KEY
const endUser = await client.endUsers.create({
companyName: "Acme Supply",
sourceId: "cust_8812",
email: "ops@acme.example",
});
console.log(endUser.id); // eu_01j9...

Save the returned id with your customer record. End users and connections covers the fields and rules.

import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";
const client = new DesktopAccountingApi();
const session = await client.authSessions.create({
publishableKey: process.env.DAAPI_PUBLISHABLE_KEY ?? "",
endUserId: "eu_01j9...",
linkExpiryMins: 1440, // one day
redirectUrl: "https://app.example.com/settings/quickbooks/done",
});
// Send the customer to session.authFlowUrl

The hosted flow configures Web Connector and tests the connection. A completed redirect records setup history; it does not prove the connection is online now.

Treat authFlowUrl and clientSecret as credentials. Never log them. Create links only on an explicit setup action, not during rendering. Expiry is 15 minutes to 7 days; the default is 30 minutes.

Use replacement setup to move computers. Use installMode: add to keep existing computers. Moved files keep their connector and reset the stored path. A restored backup may require a new connector.

Preserve authSessionId and status in the redirect. Handle completed, canceled and expired. Verify server-side with a health check or connection.setup_completed, then read current connection status. An expired auth session cannot be extended.

Use an iframe with download and navigation permissions. Allow frame-src https://connect.desktopaccountingapi.com in your CSP. allow-popups opens help; allow-top-navigation-by-user-activation permits the completion redirect. Brand name, logo and personal-data settings remain in dashboard settings.

<iframe
src="https://connect.desktopaccountingapi.com/setup/authsess_secret_..."
title="Connect QuickBooks Desktop"
sandbox="allow-scripts allow-same-origin allow-downloads allow-popups allow-top-navigation-by-user-activation"
style="width: 100%; height: 720px; border: 0"
></iframe>
https://app.example.com/settings/quickbooks/done?authSessionId=authsess_01j9...&status=completed

Use the project’s personal-data setting when the app needs payroll access. For an existing connection, follow the personal-data permission steps.