> 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

## Overview

The Fortnox integration synchronises customers, products, currencies, payment terms, financial accounts, exchange rates, cost centres, and projects between Younium and Fortnox. 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.

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                                                                                     | —       |

***

## 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                       |

### 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.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
