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

# Integrations and syncs

> Connect an accounting system and import its invoices.

An **integration** connects Watchdog to your accounting system, such as Tripletex or Visma, so
invoices come in on their own. A **sync** is one run that reads invoices from it. Setting up an
integration needs an API key with **Admin** access.

## Connect an accounting system

<Steps>
  <Step title="See what the system needs">
    `GET /v1/integration-providers` lists the accounting systems Watchdog supports, and for each one
    the credentials you need to connect it.
  </Step>

  <Step title="Save the connection">
    ```bash theme={null}
    curl "$API_URL/v1/integrations" \
      -H "Authorization: Bearer $API_KEY" -H "X-Organization-Id: $ORGANIZATION_ID" \
      -H 'Content-Type: application/json' \
      -d '{"provider": "tripletex", "name": "Tripletex", "credentials": {"employee_token": "<token>"}}'
    ```

    Saving doesn't contact the accounting system yet.
  </Step>

  <Step title="Test it">
    `POST /v1/integrations/{id}/test` signs in and reads a few invoices. If something is wrong,
    `result` is `failed` and `steps` shows where it went wrong. An integration must pass its test
    before it can sync.
  </Step>
</Steps>

Some systems, such as Fortnox, ask you to sign in on their own website instead of sharing
credentials. Connect those on the **Integrations** page in the Watchdog app.

## Choose what to import

By default an integration reads every invoice. To read fewer, set its `scope` with
`PATCH /v1/integrations/{id}`, for example to only include certain suppliers.
`GET /v1/integrations/{id}/suppliers` lists the suppliers in the accounting system to choose from.
Watchdog fetches that list from the accounting system when you ask it to, with
`POST /v1/integrations/{id}/suppliers/refresh`.

## Import invoices

Turn on `auto_sync` and Watchdog syncs every night. To sync now, or to import older invoices, start
a sync for a period:

```bash theme={null}
curl "$API_URL/v1/integrations/$INTEGRATION_ID/syncs" \
  -H "Authorization: Bearer $API_KEY" -H "X-Organization-Id: $ORGANIZATION_ID" \
  -H 'Content-Type: application/json' \
  -d '{"date_from": "2026-09-01", "date_through": "2026-09-30"}'
```

Without dates, it reads the last month. Imported invoices are matched and checked automatically.

The sync's `id` is also a [workflow run](/api-reference/workflow-runs) ID, so you can follow its
progress, see which invoices failed, and cancel it there. If a sync stops before it has read
everything, `POST /v1/workflow-runs/{id}/retry` picks up where it left off.

A key with **Write** access can start syncs too, but only for named suppliers: the saved scope, or
the `scope` in the request, must list them.

Only one sync runs per integration at a time. While one is running, starting another returns `409`
with the running sync's ID.

## Change the credentials

Send new credentials with `PATCH /v1/integrations/{id}`, then test again. Saved secrets are never
returned. Send the `ETag` from your last read as `If-Match` so you don't overwrite someone else's
change.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.