For the complete documentation index, see llms.txt. This page is also available as Markdown.

Fortnox

Complete Fortnox onboarding from your client backend.

Preview · What this means for your integration

Your backend sends an unused Fortnox authorization code and your registered callback URL. Zwapgrid exchanges the code and manages token refresh.

First, complete the shared prerequisites and example setup.

What you need

  • Your own Fortnox application, with the permissions your integration needs. See the Fortnox setup guide.

  • A Published Fortnox System Setting containing that application's client ID and secret, belonging to your Zwapgrid client.

  • Your backend callback URL registered on the Fortnox application. Use this exact URL when starting authorization and submitting the code.

The Zwapgrid callback in the setup guide is for guided onboarding. Keep it if you also use that flow; confirm Fortnox's callback options or register a separate application for headless use. Headless onboarding requires your own application credentials.

OAuth scopes

Zwapgrid needs these scopes to access your customer's accounting data:

archive article payment settings bookkeeping invoice inbox companyinformation connectfile costcenter customer supplier supplierinvoice profile project currency

1. Prepare the connection

PKCE is not currently supported for Fortnox headless onboarding. Support is planned. For now, start authorization without a PKCE challenge and do not send codeVerifier in the connection request.

  1. Use the Consent created in the shared workflow. Make sure systemsSettings.fortnox contains your published setting ID.

  2. Start Fortnox authorization at https://apps.fortnox.se/oauth-v1/auth with response_type=code, access_type=offline, your application's client_id, registered redirect_uri, required scope and random, expiring state bound to the session and Consent. Offline access lets Zwapgrid refresh tokens when your customer is not signed in.

  3. The customer signs in and authorizes the intended company. Validate state at your callback and retain the unused code briefly on your backend. Do not exchange it yourself.

  4. Submit the code and exact redirect URI once. Zwapgrid exchanges the code using the selected application and completes the connection; no additional Zwapgrid company-selection call is needed.

2. Send the request

Both fields are required and limited to 2048 characters each. Use an absolute HTTPS redirect URI without a fragment or user information; HTTP loopback is accepted for local development. Do not include token, tenant, company or PKCE fields.

Replace the placeholders and save this body as a protected connection.json on your backend. Set the example variables, including a new UUID in CORRELATION_ID, then send the request once:

3. Check the result

Expect HTTP 201 with source: fortnox and state: completed. Optionally verify the connection. Zwapgrid owns token refresh after completion.

Codes are single-use: submit promptly and never automatically retry. After an uncertain outcome, use GET. A GET 404 does not mean the code is safe to reuse; if you cannot confirm the result, authorize again to get a fresh code.

Last updated

Was this helpful?