Skip to main content

QuickBooks (/api/v1/quickbooks)

Connect QuickBooks Online accounts to sync financial data (Profit & Loss, Balance Sheet) directly from QuickBooks.

All endpoints require authentication via X-API-Key.


1. Get Auth URL

Start the OAuth flow by retrieving the QuickBooks authorization URL.

  • Method: GET
  • Endpoint: /api/v1/quickbooks/auth-url

Response

{
"authUrl": "https://appcenter.intuit.com/connect/oauth2?..."
}

Open this URL in a browser to authorize the connection. After authorization, QuickBooks redirects back to the app with code, realmId, and state.


2. Handle Callback

Complete the OAuth flow by exchanging the authorization code for tokens.

  • Method: POST
  • Endpoint: /api/v1/quickbooks/callback

Request Body

{
"code": "Q011-...",
"realmId": "123456789",
"state": "random-state-string"
}

Response

{ "connected": true }

3. Get Connection Status

Check if QuickBooks is connected and when it was last synced.

  • Method: GET
  • Endpoint: /api/v1/quickbooks/status

Response

{
"connected": true,
"lastSyncedAt": "2025-01-01T00:00:00.000Z"
}

4. Sync Financials

Trigger a manual sync of QuickBooks financial data (Profit & Loss + Balance Sheet).

  • Method: POST
  • Endpoint: /api/v1/quickbooks/sync

Response

{
"success": true,
"financials": {
"id": 1,
"business_name": "My Business",
"report_type": "ProfitAndLoss+BalanceSheet",
"total_income": 500000,
"total_expenses": 350000,
"net_income": 150000,
"total_assets": 1000000,
"total_liabilities": 400000,
"total_equity": 600000,
"cash_balance": 50000,
...
}
}

5. Get Financials

Retrieve the latest synced financial data.

  • Method: GET
  • Endpoint: /api/v1/quickbooks/financials

Response

{
"financials": {
"business_name": "My Business",
"total_income": 500000,
"total_expenses": 350000,
"net_income": 150000,
"total_assets": 1000000,
"total_liabilities": 400000,
"total_equity": 600000
}
}

6. Disconnect

Disconnect QuickBooks and remove stored credentials.

  • Method: DELETE
  • Endpoint: /api/v1/quickbooks/disconnect

Response

{ "disconnected": true }