# Quickstart
Source: https://www.desktopaccountingapi.com/docs/get-started/quickstart/

> Create an API key, connect a QuickBooks Desktop company file and list its invoices from your code.

This guide takes you from a new account to a real API response from QuickBooks Desktop. Plan on about ten minutes, plus access to a Windows computer with QuickBooks Desktop installed. A trial installation with a sample company file works.

You will:

1. Get a secret key.
2. Install an SDK.
3. Create an end user, which represents one of your customers.
4. Connect that end user's QuickBooks Desktop through the setup link.
5. List the company file's invoices.

## 1. Get a secret key

1. Sign up at [/dashboard/sign-up](https://www.desktopaccountingapi.com/dashboard/sign-up) and verify your email address. Your first visit creates an organization and a test project named **Development**. Test projects are free.

2. Open **API keys**, enter a name such as `local development` and click **Create secret key**.

3. Copy the key. It starts with `sk_test_` and is shown only once. Store it as an environment variable on your server:

   ```sh
   export DAAPI_SECRET_KEY="sk_test_..."
   ```

4. On the same page, copy the **Publishable key** (`pk_test_...`). You need it in step 4 to create setup links.

> **Caution:**
> Secret keys can read and change your customers' accounting data. Keep them on your server. Never put a secret key in a browser, a mobile app or a public repository.

## 2. Install an SDK

**TypeScript**

```sh
npm install @desktopaccountingapi/quickbooks-desktop
```

**Python**

```sh
pip install desktopaccountingapi-quickbooks-desktop
```

**C#**

```sh
dotnet add package DesktopAccountingAPI.QuickBooksDesktop
```

**Java**

```xml
<dependency>
  <groupId>com.desktopaccountingapi</groupId>
  <artifactId>quickbooks-desktop</artifactId>
  <version>0.2.0</version>
</dependency>
```

**curl**

No installation. The examples use `curl` and read the key from `$DAAPI_SECRET_KEY`.

Every SDK reads `DAAPI_SECRET_KEY` from the environment when you do not pass a key.

## 3. Create an end user

An end user is your customer. Each end user connects one QuickBooks Desktop company file. Set `sourceId` to your own ID for that customer so you can find the end user again later.

**TypeScript**

```ts title="create-end-user.ts"
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...
```

**Python**

```python title="create_end_user.py"
from desktopaccountingapi import DesktopAccountingApi

client = DesktopAccountingApi()  # reads DAAPI_SECRET_KEY

end_user = client.end_users.create(
    company_name="Acme Supply",
    source_id="cust_8812",
    email="ops@acme.example",
)
print(end_user.id)  # eu_01j9...
```

**C#**

```csharp title="CreateEndUser.cs"
using DesktopAccountingApi.QuickBooksDesktop;
using DesktopAccountingApi.QuickBooksDesktop.Models;

var client = new DesktopAccountingApiClient(); // reads DAAPI_SECRET_KEY

var endUser = await client.EndUsers.CreateAsync(new EndUserCreateInput
{
    CompanyName = "Acme Supply",
    SourceId = "cust_8812",
    Email = "ops@acme.example",
});
Console.WriteLine(endUser.Id); // eu_01j9...
```

**Java**

```java title="CreateEndUser.java"
import com.desktopaccountingapi.quickbooksdesktop.DesktopAccountingApiClient;
import com.desktopaccountingapi.quickbooksdesktop.models.EndUser;
import com.desktopaccountingapi.quickbooksdesktop.models.EndUserCreateInput;

DesktopAccountingApiClient client = DesktopAccountingApiClient.fromEnv();

EndUser endUser = client.endUsers().create(
    new EndUserCreateInput("Acme Supply", "cust_8812", "ops@acme.example"));
System.out.println(endUser.id()); // eu_01j9...
```

**curl**

```sh
curl https://api.desktopaccountingapi.com/v1/end-users \
  -H "Authorization: Bearer $DAAPI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"companyName":"Acme Supply","sourceId":"cust_8812","email":"ops@acme.example"}'
```

Save the returned `id` (`eu_...`) next to your customer record. You can also create end users in the dashboard under **End users**.

## 4. Connect QuickBooks Desktop

Create an auth session. Its `authFlowUrl` is a setup link that walks the person at the QuickBooks computer through connecting the company file.

**TypeScript**

```ts title="create-setup-link.ts"
import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";

const client = new DesktopAccountingApi();

const session = await client.authSessions.create({
  publishableKey: "pk_test_...",
  endUserId: "eu_01j9...",
  linkExpiryMins: 60,
});
console.log(session.authFlowUrl);
```

**Python**

```python title="create_setup_link.py"
from desktopaccountingapi import DesktopAccountingApi

client = DesktopAccountingApi()

session = client.auth_sessions.create(
    publishable_key="pk_test_...",
    end_user_id="eu_01j9...",
    link_expiry_mins=60,
)
print(session.auth_flow_url)
```

**C#**

```csharp
var session = await client.AuthSessions.CreateAsync(new AuthSessionCreateInput
{
    PublishableKey = "pk_test_...",
    EndUserId = "eu_01j9...",
    LinkExpiryMins = 60,
});
Console.WriteLine(session.AuthFlowUrl);
```

**Java**

```java
AuthSession session = client.authSessions().create(
    new AuthSessionCreateInput("pk_test_...", "eu_01j9...").linkExpiryMins(60));
System.out.println(session.authFlowUrl());
```

**curl**

```sh
curl https://api.desktopaccountingapi.com/v1/auth-sessions \
  -H "Authorization: Bearer $DAAPI_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"publishableKey":"pk_test_...","endUserId":"eu_01j9...","linkExpiryMins":60}'
```

The dashboard does the same thing: open the end user and click **Create setup link**.

Open the link on the Windows computer that runs QuickBooks Desktop. The flow takes about five minutes:

1. Open the company file in QuickBooks, signed in as **Admin**, in single-user mode.
2. Download the connector file (`.qwc`) and open it. The QuickBooks Web Connector starts and adds your application.
3. In QuickBooks, allow access and choose **Yes, always; allow access even if QuickBooks is not running**.
4. Paste the Web Connector password from the setup page into the Web Connector, then turn on **Auto-Run**.
5. Wait on the last page while it checks the connection live. It finishes when the connection test passes.

[Connect QuickBooks Desktop](https://www.desktopaccountingapi.com/docs/help/setup/) in the help center shows each screen in detail, and it is the page to send your customers.

## 5. List invoices

Now call QuickBooks. QuickBooks Desktop operations need the end user's ID, either per call or on a client scoped with `forEndUser`.

**TypeScript**

```ts title="list-invoices.ts"
import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";

const client = new DesktopAccountingApi().forEndUser("eu_01j9...");

for await (const invoice of client.qbd.invoices.list({ limit: 10 })) {
  console.log(invoice.refNumber, invoice.customer?.fullName, invoice.balanceRemaining);
}
```

**Python**

```python title="list_invoices.py"
from desktopaccountingapi import DesktopAccountingApi

client = DesktopAccountingApi().for_end_user("eu_01j9...")

for invoice in client.qbd.invoices.list(limit=10):
    print(invoice.ref_number, invoice.balance_remaining)
```

**C#**

```csharp
var qb = new DesktopAccountingApiClient().ForEndUser("eu_01j9...");

await foreach (var invoice in qb.Qbd.Invoices.ListAsync(new InvoiceListParams { Limit = 10 }))
{
    Console.WriteLine($"{invoice.RefNumber} {invoice.Customer?.FullName} {invoice.BalanceRemaining}");
}
```

**Java**

```java
DesktopAccountingApiClient qb = DesktopAccountingApiClient.fromEnv().forEndUser("eu_01j9...");

for (Invoice invoice : qb.qbd().invoices().list(new InvoiceListParams().limit(10))) {
    System.out.println(invoice.refNumber() + " " + invoice.balanceRemaining());
}
```

**curl**

```sh
curl "https://api.desktopaccountingapi.com/v1/quickbooks-desktop/invoices?limit=10" \
  -H "Authorization: Bearer $DAAPI_SECRET_KEY" \
  -H "Daapi-End-User-Id: eu_01j9..."
```

The response is a list object, abridged here (real objects include every documented field, with `null` for empty values). Money is a decimal string such as `"1250.00"`, so no amount is ever rounded by floating-point math:

```json
{
  "objectType": "list",
  "url": "/v1/quickbooks-desktop/invoices",
  "data": [
    {
      "id": "1A4F-1730312567",
      "objectType": "qbd_invoice",
      "refNumber": "1042",
      "customer": { "id": "80000012-1730312001", "fullName": "Acme Supply" },
      "transactionDate": "2026-09-30",
      "subtotal": "1250.00",
      "salesTaxTotal": "0.00",
      "balanceRemaining": "1250.00",
      "revisionNumber": "1730312567"
    }
  ],
  "nextCursor": "c1.eyJ...",
  "hasMore": true,
  "remainingCount": 37,
  "cursorExpiresAt": "2026-10-05T16:04:11.120Z"
}
```

The TypeScript, Python, C# and Java loops above keep fetching pages until the list ends. [Pagination](https://www.desktopaccountingapi.com/docs/guides/pagination/) explains cursors and their expiry.

## 6. See the request in the dashboard

Every response carries a `Daapi-Request-Id` header (`req_...`). Open **Request log** in the dashboard to see that request's timeline: when it was queued, when the Web Connector picked it up, what QuickBooks returned and how long each step took.

## Next steps

- [Core concepts](https://www.desktopaccountingapi.com/docs/get-started/concepts/) explains projects, end users, connections and requests.
- [Connect an end user](https://www.desktopaccountingapi.com/docs/connect/setup-flow/) shows how to put the setup link inside your own product.
- [Error handling](https://www.desktopaccountingapi.com/docs/guides/error-handling/) covers what to do when the customer's computer is off or QuickBooks shows a dialog.
- [Going to production](https://www.desktopaccountingapi.com/docs/get-started/authentication/#test-and-production-projects) covers production projects and `sk_live_` keys.
