> For the complete documentation index, see [llms.txt](https://docs.younium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.younium.com/erp-and-accounting-integrations/fortnox.md).

# Fortnox

## Synchronisation scope

| Synchronisation                              | Direction         | When it runs                                                          |
| -------------------------------------------- | ----------------- | --------------------------------------------------------------------- |
| Invoices and credit notes                    | Younium → Fortnox | When an invoice is posted in Younium, with invoice posting on         |
| Invoice accruals                             | Younium → Fortnox | When an invoice is posted in Younium, with Fortnox accruals turned on |
| Accounts                                     | Fortnox → Younium | On demand from the integration settings, or as a scheduled job        |
| Accounts                                     | Younium → Fortnox | On demand from the integration settings, or as a scheduled job        |
| Products                                     | Fortnox → Younium | On demand from the integration settings, or as a scheduled job        |
| Projects and cost centres                    | Fortnox → Younium | On demand from the integration settings, or as a scheduled job        |
| Currencies, exchange rates and payment terms | Fortnox → Younium | On demand from the integration settings, or as a scheduled job        |
| Chart of accounts                            | Fortnox → Younium | On demand from the integration settings, or as a scheduled job        |

Not in scope: payments, journals.

***

## Overview

The Fortnox integration imports customers, products, currencies, payment terms, financial accounts, exchange rates, cost centres, and projects from Fortnox, and exports Younium accounts to Fortnox as customers. When invoice posting is enabled, Younium creates a Fortnox customer invoice when an invoice is posted, optionally creates Fortnox invoice accruals for recognised revenue, and stores the Fortnox document number on the invoice.

OAuth authorisation against Fortnox is used for API access.

***

## Authentication

You connect Younium to Fortnox by authorising it from Fortnox itself: follow the connection link in the integration settings, sign in to Fortnox, and approve the access Younium asks for. Fortnox returns you to the integration settings page in Younium, where the connection now shows as live.

You land back on the same settings page whether or not the authorisation succeeds. If it fails, the connection simply does not show as live and you can retry from there — the settings page is always the place to check the current connection state.

There is nothing to copy or store yourself, and nothing that has to be renewed on a schedule — Younium refreshes its own access before each call to Fortnox. The connection lasts until it is disconnected in Younium or the approval is withdrawn in Fortnox.

***

## Activation

Approving the connection in Fortnox is what activates the integration. From that point Younium can create invoices, customers and the other records the integration maintains in Fortnox.

The first time you connect, Younium turns on **Apply Fortnox e-invoice rules** (see [Save and setup](#save-and-setup)). Authorising again on an existing connection keeps the current value of that setting.

Each authorisation attempt is single-use: Younium checks the callback against the connection attempt that started it, so completing the same authorisation link a second time, or returning to Fortnox on a stale or bookmarked link, fails and the connection must be started again from Younium.

***

## Deactivation

Deactivating the integration clears the Fortnox settings and stops invoice posting: posting an invoice in Younium no longer creates one in Fortnox. Invoices already sent stay in Fortnox untouched.

***

## Save and setup

Saving the settings creates the integration custom fields listed below if they are missing, and starts or stops invoice posting to match the **Create invoices** setting. Turning it off stops posting immediately; turning it back on resumes it for invoices posted from then on.

### Settings

| Setting                                                              | Description                                                                                                                                                                                                                                                                                                       | Default                                                                                            |
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| **Create invoices** (`CreateInvoices`)                               | Sends each posted Younium invoice to Fortnox                                                                                                                                                                                                                                                                      | —                                                                                                  |
| **Use Fortnox accrual** (`UseFortnoxAccrual`)                        | Creates a Fortnox invoice accrual after the invoice. If the accrual fails, the invoice just created in Fortnox is cancelled, so the two never disagree                                                                                                                                                            | —                                                                                                  |
| `UseProject` / `UseCostCenter`                                       | Maps list custom fields to Fortnox project/cost centre (Key from list item)                                                                                                                                                                                                                                       | —                                                                                                  |
| `ProjectCustomField` / `CostCenterCustomField`                       | Invoice-level list field names                                                                                                                                                                                                                                                                                    | —                                                                                                  |
| `InvoiceLineProjectCustomField` / `InvoiceLineCostCenterCustomField` | Line-level list field names                                                                                                                                                                                                                                                                                       | —                                                                                                  |
| `MapRenewalTextOnInvoice`                                            | Appends auto-renewal text to remarks from order                                                                                                                                                                                                                                                                   | —                                                                                                  |
| `MapEUQuarterlyReport`                                               | Sets `EUQuarterlyReport` when customer VAT type is EU reversed VAT                                                                                                                                                                                                                                                | —                                                                                                  |
| **Apply Fortnox e-invoice rules**                                    | Applies Fortnox's e-invoice validation rules when an invoice is posted to Fortnox: rows with a negative unit price are sent as a negative quantity with a positive unit price, and *Your reference* and *Our reference* are required for e-invoice customers. See [Post invoice workflow](#post-invoice-workflow) | On for new Fortnox connections; off for connections that existed before the setting was introduced |

Fortnox checks e-invoices from 19 October 2026, when the customer sends the e-invoice from Fortnox. The check does not run when Younium creates the invoice, so Younium applies the rules before the invoice is sent. Only invoices posted after the setting is turned on are affected: an e-invoice already in Fortnox with a negative unit price must be corrected in Fortnox, or cancelled and posted again.

***

## Custom fields created by the integration

| Entity                              | Custom field name | Notes                                         |
| ----------------------------------- | ----------------- | --------------------------------------------- |
| Account                             | `Customer Number` | Required for posting; Fortnox customer number |
| Product, Charge, OrderProductCharge | `Product Number`  | Fortnox article number on lines               |
| Invoice                             | `Invoice Number`  | Fortnox document number after post            |
| Country                             | `Fortnox country` | Country code on invoice/delivery addresses    |

Renaming breaks lookups via `IntegrationUtils.GetIntegrationCustomFieldName`.

***

## Eligibility and filtering

* Post handler requires account custom field **Customer Number**; otherwise throws.
* Invoice lines: `ApplyZeroAmountFilters` per invoice settings.
* Lines ordered: recurring/usage first (by product line, charge number), then one-off charges.
* Maximum 2000 Fortnox rows per invoice.
* Accrual: only lines with `RevenueRecognitionMethod.MonthlyRecognitionOverTime`; all lines must share same project/cost centre list values when accrual and dimensions enabled.
* Accrual amounts use sum of line subtotals × Fortnox `CurrencyRate` (default 1), in SEK; deferred/recognised revenue codes must parse as numeric Fortnox account ids.

***

## Field mapping — posted invoice (Younium → Fortnox)

### Invoice header

| Younium field                                        | Fortnox field                             |
| ---------------------------------------------------- | ----------------------------------------- |
| Account custom field **Customer Number**             | `CustomerNumber`                          |
| `Invoice.TotalAmount.CurrencyCode`                   | `Currency`                                |
| `Invoice.InvoiceDate`                                | `InvoiceDate`                             |
| `Invoice.DueDate`                                    | `DueDate`                                 |
| `Invoice.Notes` (+ optional renewal text from order) | `Remarks`                                 |
| `Invoice.YourReference`                              | `YourReference`                           |
| `Invoice.OurReference`                               | `OurReference`                            |
| `Invoice.YourOrderNumber`                            | `YourOrderNumber`                         |
| `Invoice.InvoiceAddress.*`                           | `Address1`, `Address2`, `City`, `ZipCode` |
| Invoice address country custom **Fortnox country**   | `Country`                                 |
| `Invoice.DeliveryAddress.*`                          | `DeliveryName`, `DeliveryAddress1`, etc.  |
| Delivery country custom **Fortnox country**          | `DeliveryCountry`                         |
| Order custom field `deliverydate` (if configured)    | `DeliveryDate`                            |
| `Invoice.Id`                                         | `ExternalInvoiceReference1`               |
| Invoice/list custom field Key                        | `Project`, `CostCenter` (when enabled)    |

### Invoice row

| Younium field                                                | Fortnox field                                            |
| ------------------------------------------------------------ | -------------------------------------------------------- |
| Order product charge custom **Product Number**               | `ArticleNumber`                                          |
| `ChargeDescription` (+ optional qty/UoM/SP description row)  | `Description`                                            |
| Price/qty from `GetPriceAndQuantityParameters` or tier split | `DeliveredQuantity`, `Price`, `Discount`, `DiscountType` |
| Sum of tax rates × 100                                       | `VAT`                                                    |
| Line list custom field Key                                   | `Project`, `CostCenter`                                  |
| `InvoiceLine.Notes` (split by newline, 255 chars per row)    | Extra rows with `Description` only                       |

When **Apply Fortnox e-invoice rules** is on, a row with a negative unit price is sent with the sign of both the unit price and the quantity flipped, so a row of 1 × −500 is sent as −1 × 500. The row total, VAT and invoice total do not change. This applies to credit invoices and to negative rows on regular invoices, such as discount lines. Description-only rows are left as they are, and the description row that shows quantity and period keeps the Younium quantity without a minus sign.

### Write-back (Younium)

| Fortnox field    | Younium field                                    |
| ---------------- | ------------------------------------------------ |
| `DocumentNumber` | Custom field **Invoice Number**, `ExternalERPId` |

***

## Post invoice workflow

**Runs when:** an invoice is posted in Younium.

Creates the corresponding invoice in Fortnox, rate-limited to stay within Fortnox's API limits. When **Use Fortnox accrual** is on, a monthly invoice accrual is created alongside it; if the accrual cannot be created, the Fortnox invoice is cancelled so the two never disagree.

### Rate limits

Fortnox limits how many requests an access token can make in a short period, and Younium paces its calls to stay within that limit. Other applications connected with the same Fortnox access token share the limit, so Fortnox can still refuse a request with a "Too Many Requests" response. When that happens during invoice posting, Younium waits and tries the same call again, up to three times, after 2, 5 and 10 seconds. Each attempt waits for a free slot in Younium's pacing first. This applies to the customer lookup used for the EU quarterly report, creating the invoice, creating the accrual, and cancelling the invoice after a failed accrual. Fortnox rejects a rate-limited request before processing it, so a retry cannot create a duplicate invoice. Any other error, and a refusal that persists after the third retry, fails the invoice as before and the invoice can be posted again.

### E-invoice reference check

When **Apply Fortnox e-invoice rules** is on, Younium checks the invoice before sending it. If the account is an e-invoice customer in Fortnox, the invoice must have both *Your reference* and *Our reference*. The account counts as an e-invoice customer when its **Fortnox Delivery Method** custom field is set to e-invoice or, when that field is empty, when the account's own invoice delivery method is electronic invoice. This is the same rule Younium uses when it exports the customer to Fortnox.

If either reference is missing, the invoice is not sent to Fortnox and the integration log names the missing field. Accounts with any other delivery method are not checked.

### When Fortnox rejects the invoice

If Fortnox rejects the invoice, the integration log records one failure entry for **Create invoice** with Fortnox's own error: *Fortnox error {code} (HTTP {status}): {message}*. The same text appears when you post the invoice in Younium, so the reason is visible on the invoice page as well as in the log. If Fortnox answers with a status but no error details, the entry reads *Fortnox returned HTTP {status} without error details*.

When Fortnox limits the rate of requests (HTTP 429), the entry says that the Fortnox rate limit is reached and to try again later.

If the accrual fails after the invoice is created, Younium cancels the invoice in Fortnox and logs that it did so. If the cancellation also fails, the integration log says that the invoice must be removed manually in Fortnox and gives Fortnox's reason, and the posting error still names the accrual failure.

***

## Errors from Fortnox in synchronisations

Every synchronisation records Fortnox's error in the integration log in the same form: *Fortnox error {code} (HTTP {status}): {message}*, with the rate-limit and no-details wording described above. Only these details are logged; the raw Fortnox response is never included.

| Synchronisation                                                                     | What happens when Fortnox returns an error                                                                                                                                                   |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cost centres and projects                                                           | The failure is logged and the error is shown where you start the synchronisation                                                                                                             |
| Accounts, products, currencies, exchange rates, payment terms and chart of accounts | The failure is logged and the run ends                                                                                                                                                       |
| Accounts, Younium → Fortnox                                                         | The failure is logged with the Younium account number appended, and the export continues with the next account                                                                               |
| Accounts, Fortnox → Younium                                                         | If Fortnox cannot return a customer's details, the failure is logged with the customer's name and number, the customer is counted as failed, and the import continues with the next customer |

Scheduled jobs report the same message in their job result.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.younium.com/erp-and-accounting-integrations/fortnox.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
