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.Documentation Index
Fetch the complete documentation index at: https://docs.dolfinai.co/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Dolfin API key (distributed during onboarding)
- Your Client ID (associated with your API key)
Overview
The integration follows three phases:Create an organisation and users
Your backend creates an organisation and provisions users into it using your API key.
Generate auth codes
When a user needs to access Dolfin, your backend generates a short-lived auth code for that user.
Step 1: Create an Organisation
First, create an organisation for the SMB business. You’ll need anindustryId - retrieve the list of available industries from GET /industries.
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. Each user is assigned the Member role.User 1: Alice
User 2: Bob
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.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.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
| Phase | Endpoint | Called by | Auth |
|---|---|---|---|
| Create org | POST /organisations | Your backend | API key |
| Create users | POST /organisations/{orgId}/users | Your backend | API key |
| Generate code | POST /auth/codes | Your backend | API key |
| Exchange code | POST /auth/exchange | User’s browser | None (public) |
| Use API | Any endpoint | User’s browser | Bearer token |