Fortnox direct integration
Connect Hubhus directly to Fortnox via OAuth 2.0 — no third-party middleware required. The integration creates customers and invoices in Fortnox, writes back the customer and invoice numbers to the Hubhus lead, and supports Swedish RUT/ROT tax reduction rows (HouseWorkType) on invoice lines.
TL;DR
Create an OAuth 2.0 · Authorization Code (with PKCE) connection in Hubhus with authorize URL https://apps.fortnox.se/oauth-v1/auth, token URL https://apps.fortnox.se/oauth-v1/token, scopes invoice customer, and custom authorize param access_type: offline. Create two HTTP request templates — POST to /3/customers and POST to /3/invoices. Use JSON map to write Customer.CustomerNumber and Invoice.DocumentNumber back to the lead. Never set a manual Authorization header — Hubhus injects it automatically.
Get started in 5 steps
Create the Fortnox OAuth connection
Go to Account → Integrations & API → Connections → + New connection. Auth type: OAuth 2.0 · Authorization Code (with PKCE). Authorize URL: https://apps.fortnox.se/oauth-v1/auth. Token URL: https://apps.fortnox.se/oauth-v1/token. Scopes: invoice customer. Custom authorize params: access_type: offline. Leave all other fields empty. Click Save & Connect to authorize.
Create the "Create customer" HTTP request template
Method: POST. URL: https://api.fortnox.se/3/customers. Select the Fortnox connection. Header: Content-Type: application/json. Set URL encode placeholder values: No. In the JSON map, add: {{fortnox_customer_number}}=Customer.CustomerNumber.
Create the "Create invoice" HTTP request template
Method: POST. URL: https://api.fortnox.se/3/invoices. Select the Fortnox connection. Header: Content-Type: application/json. Set URL encode placeholder values: No. In the JSON map, add: {{fortnox_invoice_number}}=Invoice.DocumentNumber.
Set up the flow logic
Use two automation steps/statuses: Step 1 runs "Create customer" if no customer number exists yet and writes the result back. Step 2 runs "Create invoice" using the stored customer number and writes the invoice number back. This ensures the customer number is persisted before the invoice request runs.
Add HouseWorkType to invoice rows where applicable
RUT/ROT invoice rows must include HouseWork, HouseWorkType, and (for work rows) HouseWorkHoursToReport. Non-work rows must explicitly set HouseWorkType to EMPTYHOUSEWORK or OTHERCOSTS — setting only HouseWork: false is not sufficient for Fortnox to categorize the row correctly.
POST /3/customers ·
Invoice endpoint: POST /3/invoices ·
URL encode placeholder values: No
Read more⌄
OAuth connection — field reference
| Field | Value |
|---|---|
| Auth type | OAuth 2.0 · Authorization Code (with PKCE) |
| Authorize URL | https://apps.fortnox.se/oauth-v1/auth |
| Token URL | https://apps.fortnox.se/oauth-v1/token |
| Scopes | invoice customer (add companyinformation if needed) |
| Custom authorize params | access_type: offline |
| Custom token params | Leave empty |
Do not add a manual Authorization header on any HTTP request template that uses this connection — Hubhus injects the Bearer token automatically.
Create customer — request body
{
"Customer": {
"Name": "%lead_name%",
"Address1": "%lead_street_address%",
"ZipCode": "%lead_postal_code%",
"City": "%lead_city_name%",
"Phone1": "%lead_phone%",
"Email": "%lead_email%",
"OrganisationNumber": "{{personnummer}}",
"Type": "PRIVATE"
}
}
JSON map:
{{fortnox_customer_number}}=Customer.CustomerNumber
Adapt field names and placeholders to match the campaign's data fields. If the Hubhus data field is named differently, adjust the left side of the JSON map accordingly.
Create invoice — minimal request body
{
"Invoice": {
"ExternalInvoiceReference1": "%lead_id%",
"CustomerNumber": "{{fortnox_customer_number}}",
"DeliveryDate": "%event_start_date_db%",
"InvoiceRows": [
{
"Description": "Arbejde",
"DeliveredQuantity": 1,
"Price": 100,
"VAT": 25
}
]
}
}
JSON map:
{{fortnox_invoice_number}}=Invoice.DocumentNumber
Invoice med HouseWorkType — eksempel med alle tre linjetyper
{
"Invoice": {
"ExternalInvoiceReference1": "%lead_id%",
"CustomerNumber": "{{fortnox_customer_number}}",
"DeliveryDate": "%event_start_date_db%",
"TaxReductionType": "rut",
"InvoiceRows": [
{
"Description": "Transport",
"DeliveredQuantity": 1,
"Price": 1000,
"HouseWork": false,
"HouseWorkType": "OTHERCOSTS"
},
{
"Description": "Rabat",
"DeliveredQuantity": 1,
"Price": -300,
"HouseWork": false,
"HouseWorkType": "EMPTYHOUSEWORK"
},
{
"Description": "Arbejde",
"DeliveredQuantity": 1,
"Price": 2500,
"HouseWork": true,
"HouseWorkType": "GARDENING",
"HouseWorkHoursToReport": 3
}
]
}
}
Setting HouseWork: false alone is not sufficient — Fortnox requires an explicit HouseWorkType value on every row to display the correct category in the Fortnox UI.
HouseWorkType — komplet oversigt / Komplett översikt
ROT (Reparation, Ombyggnad, Tillbyggnad)
| HouseWorkType | Beskrivelse / Beskrivning |
|---|---|
CONSTRUCTION | Byggnadsarbete |
ELECTRICITY | Elarbete |
GLASSMETALWORK | Glas- och metallarbete |
GROUNDDRAINAGEWORK | Mark- och dräneringsarbete |
MASONRY | Murningsarbete |
PAINTINGWALLPAPERING | Målning och tapetsering |
HVAC | VVS-arbete |
RUT (Rengöring, Underhåll, Tvätt)
| HouseWorkType | Beskrivelse / Beskrivning |
|---|---|
BABYSITTING | Barnpassning |
CLEANING | Städning |
FURNISHING | Möblering |
GARDENING | Trädgårdsarbete |
HOMEMAINTENANCE | Hemunderhåll |
ITSERVICES | IT-tjänster |
MAJORAPPLIANCEREPAIR | Reparation av vitvaror |
MOVINGSERVICES | Flyttjänster |
OTHERCARE | Övrig omsorg |
SNOWPLOWING | Snöröjning |
TEXTILECLOTHING | Textil och kläder |
TRANSPORTATIONSERVICES | Transporttjänster |
WASHINGANDCAREOFCLOTHING | Tvätt och klädvård |
Grön teknik / Green technology
| HouseWorkType | Beskrivelse / Beskrivning |
|---|---|
SOLARCELLS | Solceller |
STORAGESELFPRODUCEDELECTRICITY | Lagring av egenproducerad el |
CHARGINGSTATIONELECTRICVEHICLE | Laddstation för elfordon |
Særlig / Teknisk
| HouseWorkType | Anvendelse / Användning |
|---|---|
EMPTYHOUSEWORK | Ej husarbete — linjer der ikke er husarbejde og ikke skal kategoriseres som övrig kostnad |
OTHERCOSTS | Övrig kostnad — øvrige omkostningslinjer |
Anbefalet produktionsopsætning
Create at minimum these data fields in Hubhus to support the integration:
fortnox_customer_number
fortnox_invoice_number
fortnox_status
fortnox_error
Use the JSON map on each template to write Customer.CustomerNumber → {{fortnox_customer_number}} and Invoice.DocumentNumber → {{fortnox_invoice_number}}.
Fejl og løsninger / Felmeddelanden
"Har inte behörighet för scope."
The connection is missing a required scope. Add invoice customer (or companyinformation if needed) to the connection scopes and reconnect.
"Ogiltigt kundnummer."
The invoice request is using a customer number that doesn't exist in Fortnox. Create the customer first via POST /3/customers, write back Customer.CustomerNumber via JSON map, and only then run the invoice request.
"Unable to log in. Access token or client secret missing."
The Fortnox connection is not selected on the HTTP request template, or the connection has expired and needs to be reconnected. Select the connection and verify it shows Connected. Do not set a manual Authorization header.
Common searches
Fortnox • faktura • invoice • customer • OAuth • HouseWorkType • RUT • ROT • GARDENING • EMPTYHOUSEWORK • OTHERCOSTS • CustomerNumber • DocumentNumber
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article