Workspaces
Isolated areas of an organization, each with its own documents, contacts, members, and credentials
A workspace is an isolated area inside an organization, such as a department, a team, or a client. Every document lives in exactly one workspace, and so do the templates, contacts, and settings it uses.
Every API request works in one workspace. An OAuth token is bound to the workspace chosen when it was granted. An API key can act in several workspaces: a request acts in the key's default workspace, or in the one named in the Sajn-Workspace header.
What belongs to a workspace
Each workspace has its own set of the following:
- Documents, folders, and document categories
- Templates and forms
- Contacts and companies
- Custom fields
- Webhook endpoints
- API keys
- Members, workspace roles, and document settings, such as the default expiration and allowed signing methods
A document in one workspace can't use a contact, template, or custom field from another workspace.
Workspace properties
The following properties identify a workspace:
| Property | Description | Example |
|---|---|---|
id | Unique ID | cm4k2x9p00003abcd0000qrst |
slug | Short random code used in dashboard URLs | k3x9p |
name | Display name | Sales |
Workspaces in the API
A request with an API key acts in the key's default workspace, unless the Sajn-Workspace header names another workspace that the key can act in. To check which workspace a request acts in, call GET /me:
curl https://app.sajn.se/api/v1/me \
-H "Authorization: Bearer $SAJN_API_KEY" \
-H "Sajn-Version: 2026-10"To list the workspaces the key can act in, call GET /workspaces. The workspace that the request acts in has isCurrent set to true. To work in another of them, send its id in the Sajn-Workspace header. For more information, see Choose a workspace.
Members and roles
Each member has one workspace role per workspace. The role decides what the member can do in the workspace. An API key has its own permissions, which you set when you create the key. Every workspace has the built-in roles Läsare, Medarbetare, Säljare, Godkännare, and Avdelningsansvarig, and you can add custom roles.
You can manage members and roles through the API:
| Resource | Endpoints | Required permission |
|---|---|---|
Members, at /members | List, add, update the role of, and remove members | MANAGE_WORKSPACE_MEMBERS |
Invitations, at /member-invites | Invite someone, list pending invitations, resend, and revoke | MANAGE_WORKSPACE_MEMBERS |
Roles, at /roles | List, create, update, and delete roles | MANAGE_WORKSPACE_ROLES |
Permissions, at /permissions | List the permissions you can assign | MANAGE_WORKSPACE_ROLES |
A member's id is the user ID, and the /members/{userId} endpoints take it. A member has the following shape:
{
"id": "cm4k2x9p00000abcd0000mnop",
"email": "alex@example.com",
"name": "Alex Lindqvist",
"role": { "id": "cm4k2x9p60008abcd2345yzab", "name": "Säljare" },
"status": "ACTIVE",
"lastActiveAt": "2026-10-01T08:12:00.000Z",
"joinedAt": "2026-03-14T09:00:00.000Z"
}POST /members with email and roleId adds someone who is already a member of the organization. For any other email address, it returns 404, unless the address is on a domain that your organization manages through SSO. To invite someone new, call POST /member-invites with the same body. The response is the invitation, with its status and expiresAt.
Workspace limits
Your plan decides how many workspaces the organization can have. To read the quota and current usage, call GET /limits and read quota.workspaces and usage.workspaces. An unlimited quota is returned as null.
Next steps
Was this page helpful?
Last updated on