# Twinfield — Accounting API: connection

> Canonical URL: https://developers.apideck.com/apis/accounting/twinfield/connection

# How to Connect to Twinfield

Twinfield (Wolters Kluwer) is connected through a standard OAuth authorization: you sign in to
Twinfield, approve access, and then tell Apideck which administration to work in. There is nothing
to install and no API key to generate.

There is no environment, server or region to choose in Vault.

## Prerequisites

Before you start, you'll need:

- **A Twinfield login** (organisation user) with access to the administration you want to connect.
  The connection can only see what that user can see.
- **The administration to connect.** You pick it from a list in step 2.
- **A user you can dedicate to the integration.** The connection stays tied to whichever Twinfield
  user authorizes it, so a shared, non-personal user maintained for integrations keeps the
  connection alive when people change roles. See [Choosing the right Twinfield user](#choosing-the-right-twinfield-user).

## 1. Authorize Twinfield

1. Open the Twinfield connector in **Apideck Vault** and click **Authorize**.
2. You're redirected to Twinfield's sign-in page at `https://login.twinfield.com`. Sign in with the
   Twinfield user you want the connection to run as.
3. Review the access request and approve it.
4. Twinfield redirects you back to Vault, and the connection shows as **Connected**.

## 2. Set your office code

Twinfield identifies administrations by **code**, and Apideck sends the code of the administration
you select with every request: it decides which administration your data is read from and written
to.

1. Decide which administration to connect. The list in Vault shows administrations by name.
2. In Vault, open the connection's **Settings** and select the administration in
   **Office code**. The list shows the administrations the authorizing Twinfield user can access.
3. Save the connection.

**Office code** is a required setting: a connection operates against one administration, and
without it Apideck cannot read from or write to Twinfield. To work with several administrations,
create one connection per administration.

## 3. Check your control accounts

Twinfield requires a control (system) account on every bill and payment, and its API offers no way
to look yours up. Apideck therefore uses Twinfield's standard chart of accounts by default:

| Setting | Default | Used for |
|---|---|---|
| **Accounts payable control account** | `1600` | Amounts owed to suppliers: bills and bill payments |
| **Accounts receivable control account** | `1300` | Amounts owed by customers: customer payments |

**If your administration uses Twinfield's standard chart of accounts, you can skip this step.**

If it doesn't, check the codes and enter them in Vault:

1. In Twinfield, go to **Settings → Administration settings → Administration settings**, then choose
   **System accounts** (*Systeemrekeningen*) in the left submenu.
2. Read the values of **Accounts receivable control account** (*Hoofdrekening debiteuren*) and
   **Accounts payable control account** (*Hoofdrekening crediteuren*). Wolters Kluwer documents this
   screen in
   [Crediteuren en debiteuren - Administratie-instellingen](https://wktaaeu.my.site.com/nlcommunity/articles/nl_NL/Knowledge/Crediteuren-en-debiteuren-Administratie-instellingen).
3. If either differs from the default above, enter it in the matching field in the connection's
   **Settings** in Vault and save.

**Bank feed statement currency (optional).** The same **Settings** screen has a **Bank feed
statement currency** field: the ISO 4217 code (for example, `EUR` or `USD`) Twinfield records bank
feed statements in. Leave it blank to use the default, `EUR`.

## Choosing the right Twinfield user

The connection runs as the Twinfield organisation user who authorized it, so its lifetime follows
that user's. Twinfield revokes access immediately, with no advance warning, if the user is
deleted, disabled or locked, if their password expires, or if the organisation itself is
deactivated. The first sign is that the connection stops working and asks to be authorized again.

Two things keep this from surprising you:

- Authorize with a dedicated integration user rather than an individual employee's login, so staff
  changes don't take the connection down.
- Make sure that user's password policy and access to the administration are maintained the same way
  you'd maintain any other service account.

## Troubleshooting

**Authorization fails, or you see a redirect error after signing in.** The Twinfield OAuth
application is registered by whoever operates the integration, and its redirect URL has to match the
one Vault sends you back to. Report the exact error to your integration provider so they can check
the registration.

**You can sign in but the administration you expected isn't available.** Access mirrors the
Twinfield user's own rights. Ask your Twinfield administrator to grant that user access to the
administration, then reconnect.

**Data appears under the wrong administration, or writes don't show up where you expect.** The
office code in the connection settings points at a different administration. Re-check it against
step 2.

**A bill or payment is rejected with an unknown or invalid ledger account.** Your administration
likely uses a customized chart of accounts. Set the accounts payable and accounts receivable control
accounts as described in step 3.

**The connection suddenly asks to be authorized again.** The Twinfield user behind it was disabled,
locked, deleted, or its password expired. Restore that user in Twinfield, or authorize again with an
active user, ideally the dedicated integration user described above.

Still stuck? Reach out to [Apideck Support](https://help.apideck.com/en/articles/7774658).


[API reference](https://developers.apideck.com/apis/accounting/reference.md) · [Coverage matrix](https://developers.apideck.com/apis/accounting/coverage)
