> ## Documentation Index
> Fetch the complete documentation index at: https://docs.viewmargin.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 📘 QuickBooks

> Connect QuickBooks accounting data to Margin

Margin supports QuickBooks production and sandbox connections.

## 1. What Margin Needs

From your finance/data team:

1. An Intuit developer app with **Client ID** and **Client Secret**
2. OAuth redirect URI set to the callback URL shown in Margin's integration setup
3. Tenant-scoped QuickBooks authorization (per-company connection)
4. Optional **Realm ID** (Margin can usually detect this automatically after authorization)

## 2. Create and Configure the Intuit App

1. Create an account in the [Intuit Developer portal](https://developer.intuit.com/app/developer/qbo/docs/get-started).
2. Create a new **QuickBooks Online and Payments** app.
3. In app settings, add redirect URI:
   * the callback URL shown in Margin
4. Copy **Client ID** and **Client Secret** from **Keys and credentials**.
5. (Optional for testing) create a sandbox company and note the **Company ID / Realm ID**.

## 3. Configure the Integration in Margin

| Field         | Value                                     |
| :------------ | :---------------------------------------- |
| Environment   | Production or Sandbox                     |
| Client ID     | Intuit app client ID                      |
| Client Secret | Intuit app client secret                  |
| Realm ID      | Optional override; can be auto-discovered |

During auth, each tenant authorizes its own QuickBooks company. Margin stores those credentials server-side only.

## 4. Scopes and Token Behavior

* Common scope: `com.intuit.quickbooks.accounting`
* Optional scope: `com.intuit.quickbooks.payment`
* Access tokens are short-lived (\~1 hour), but refresh is handled automatically by Margin.

## 5. Useful References

* [QuickBooks API docs](https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/account)
* [QuickBooks OAuth guide](https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0)
* [QuickBooks OAuth scopes](https://developer.intuit.com/app/developer/qbo/docs/learn/scopes#current-scopes)

## Next Steps

Once QuickBooks is connected, continue to data modelling.

<Card title="📊 Data Modelling" horizontal="true" href="/modelling/overview">
  Align accounting data with your event data for reconciled unit economics
</Card>
