Skip to main content
This guide walks through the complete integration flow for a client platform that wants to onboard SMB users into Dolfin. By the end, your users will have session tokens they can use to interact with the Dolfin API directly from the browser.

Prerequisites

  • A Dolfin API key (distributed during onboarding)

Overview

The integration follows three phases:
1

Create an organisation and users

Your backend creates an organisation and provisions users into it using your API key.
2

Generate auth codes

When a user needs to access Dolfin, your backend generates a short-lived auth code for that user.
3

Exchange for a session token

The user’s browser exchanges the auth code for a session JWT, which is used for all subsequent API calls.

Step 1: Create an Organisation

First, create an organisation for the SMB business. You’ll need an industryId - retrieve the list of available industries from GET /v1/industries.
Response:
Store the id from the response - this is the organisationId you’ll use in all subsequent calls.

Step 2: Create Users

Now create users within the organisation. Pass an optional roleMember, Admin, or Owner — to set what the user can do. Omit it and the user is created as a Member. Provisioning with your API key acts with your client’s authority, so you can grant any role, including Owner. Most integrators make the person who signs up for the organisation its Owner, and add colleagues as Member or Admin.
A user acting with a session token can never grant a role above their own — an Admin can add Members and Admins, but not an Owner. Attempting it returns 403 User.RoleAboveCaller.

User 1: Alice

Response:

User 2: Bob

Response:
If a user with the same email already exists, they will be added to the organisation rather than duplicated. A 409 Conflict is returned if the user is already a member of that organisation.

Step 3: Generate an Auth Code

When a user needs to access Dolfin (e.g. they click “Open Invoicing” in your app), generate a short-lived auth code from your backend.
Response:
Auth codes expire after 10 minutes and are single-use. Generate a new code each time the user needs to authenticate.

Step 4: Exchange the Auth Code for a Session Token

Pass the auth code to the user’s browser (e.g. as a URL parameter in a redirect). The browser then exchanges it for a session JWT. This call is made from the browser and does not require an API key.
Response:
The session token is a JWT valid for 8 hours.

Step 5: Make Authenticated API Calls

The user can now call any Dolfin API endpoint using the session token:

Sequence Diagram

Summary