> ## Documentation Index
> Fetch the complete documentation index at: https://control-dev.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Visma eEkonomi

> Authorize Control to read accounting data from a Visma eEkonomi company.

export const ControlAppLink = ({path, breadcrumb, children}) => {
  const link = <a href={`https://app.control.dev${path}`} target="_blank" rel="noopener noreferrer" aria-label={breadcrumb ? `Open ${breadcrumb} in Control` : undefined}>
      {children}
    </a>;
  return breadcrumb ? <Tooltip tip={breadcrumb}>{link}</Tooltip> : link;
};

Visma eEkonomi connects to Control through OAuth. In Sweden, Visma eEkonomi is now called Spiris Bokföring &
Fakturering. Use an account that can access the company you want to connect and approve third-party integrations.

## Before you begin

* The selected company must have third-party integration and API access activated in Visma or Spiris. When this access
  is missing, the Visma API identifies the required internal entitlement as `api_standard`.
* The person authorizing Control must be able to select the intended company and approve the requested permissions.
* Create the corresponding entity in Control before adding the data source.

<Warning>
  Completing OAuth confirms the Visma account and consent, but it does not prove that the selected company's
  subscription includes API access. Control verifies data access when the first sync begins.
</Warning>

## Activate API access in Visma or Spiris

Visma calls the customer-facing option **Visma Integration (API)**. The Visma API reports the same company-level
entitlement internally as `api_standard`.

1. Sign in to the intended Visma eEkonomi or Spiris company as an administrator.
2. Open **Apps and extensions**. In the older Swedish eEkonomi interface, the documented path is **Appar & tillval** →
   **Vismas tillval** → **Övriga integrationer**.
3. Activate or add **Visma Integration (API)**.
4. If the option is not available, ask Spiris support to confirm that the company's edition and administrator account
   can enable API integrations.

Menu labels can differ between eEkonomi editions and the newer Spiris interface. API access only needs to be activated
once for the company; it can then be used by multiple integrations.

## Connect in Control

1. Open <ControlAppLink path="/entities-data-sources/overview"><strong>Entities & sources</strong></ControlAppLink>.
2. Open the intended entity, choose **Add data source**, and select **Visma eEkonomi**.
3. Give the data source a recognizable name.
4. Choose **Connect Visma eEkonomi**.
5. Sign in to Visma or Spiris, select the intended company, and approve Control's read access.
6. Return to Control and wait for the first sync to finish.

Control stores the OAuth credentials securely and refreshes them automatically.

## Permissions requested

Control requests read-only access to the accounting, sales, and purchase resources used by the connector.

| Scope                    | Purpose                                        |
| ------------------------ | ---------------------------------------------- |
| `ea:api`                 | Access the Visma eAccounting API               |
| `offline_access`         | Refresh the connection for scheduled syncs     |
| `ea:accounting_readonly` | Read accounts, vouchers, and projects          |
| `ea:sales_readonly`      | Read customers, company settings, and projects |
| `ea:purchase_readonly`   | Read suppliers and projects                    |

Control does not request write access.

## Data imported

* Chart of accounts
* General-ledger vouchers
* Customers and suppliers
* Projects
* Company settings, including the accounting lock date

## Verify the connection

OAuth can succeed even when the company lacks API access. Verify the connection by opening

<ControlAppLink path="/entities-data-sources/sync-history">
  <strong>Sync history</strong>
</ControlAppLink>

and confirming that the first Visma eEkonomi sync completed successfully. Then confirm that the entity has imported
accounts and transactions.

## Common problems

* **The first sync fails with `403`, error code `4002`, or `No access to module: api_standard`:** the selected company
  does not currently have the required Visma API integration entitlement. Ask the company's Visma or Spiris
  administrator to activate third-party integrations and API access. If the option is unavailable, contact Visma API
  support. After access is enabled, retry the sync; reconnect only if the retry still fails.
* **The wrong company was connected:** reconnect the data source and select the company that belongs to the Control
  entity.
* **The company is not available during authorization:** confirm that the signed-in user has access to it and that
  integrations are activated for the company.
* **The connection stopped working:** access may have been revoked in Visma. Reconnect the data source in Control.

When contacting Visma API support, include the `ErrorId` returned with the failed request. If Visma asks for the app's
client ID, contact Control support for help. Never send a client secret or an access token.

## Provider documentation

* [Visma API getting-started guide](https://community.visma.com/xqnef94594/attachments/xqnef94594/IN_MA_eAccountingAPI_knowledgebase/35/13/2%20-%20Getting%20started%20with%20API.pdf)
* [Visma eAccounting authentication and OAuth scopes](https://developer.vismaonline.com/docs/authentication)
* [Visma eAccounting API reference](https://eaccountingapi.vismaonline.com/scalar/v2)
* [Spiris integration help](https://support.spiris.se/bokforing-fakturering-plus/sv-se/content/online-help/apps-extensions-extensions-integration.htm)
* [Visma API support guidance](https://developer.vismaonline.com/docs/spiris-eaccounting-api-documentation)
