LM-02
Organizations
LM-02Organizations
Sell to companies. Each one gets its own members, roles and directory.
An organization is a tenant: a customer's people, the teams they sit in, what each of them may do, and the identity provider that says who still works there. This chapter follows one, Okapi Health, through all of it.
- Title
- Organizations
- Doc. no.
- LM-02
- Rev.
- 04
- Issued
- Nov 2026
- Sheet
- 2 of 4
1.0Structure
An organization is a tree you can rearrange.
One organization per customer, teams inside it, members inside those. The figure is the admin screen your customers get; the listing beside it is what your API returns for the same state.
org_okapi_health- 3 members
- Marta LindqvistOwner
- Sun-hee ParkClinician
- Jonas WeberSuspended
- 2 members
- Deji OkonkwoAdmin
- Tomás RiveraClinician
- 2 members
- Leon FischerBilling
- Priya RamanAuditor
{ "id": "org_okapi_health", "name": "Okapi Health", "members_count": 7, "teams": [ { "id": "team_clinical", "name": "Clinical", "members": [ "usr_marta", "usr_sun", "usr_jonas" ] }, { "id": "team_engineering", "name": "Engineering", "members": [ "usr_deji", "usr_tomas" ] }, { "id": "team_finance", "name": "Finance", "members": [ "usr_leon", "usr_priya" ] } ]}2.0Roles
Roles are data. Your customers edit them, your code only asks.
Five roles ship by default and each organization can add its own. A permission is a plain string; a check is one call that reads the session token and answers in microseconds.
| Permission | Ownerorg-wide | Adminorg-wide | Clinicianown team | Billingorg-wide | Auditororg-wide |
|---|---|---|---|---|---|
| Members | |||||
Invite membersmembers:invite | |||||
Remove membersmembers:remove | |||||
Edit rolesroles:edit | |||||
| Patient records | |||||
Read recordsrecords:read | |||||
Write recordsrecords:write | |||||
Export recordsrecords:export | |||||
| Billing | |||||
See invoicesbilling:read | |||||
Change plan and cardsbilling:manage | |||||
| Security | |||||
Read the audit logaudit:read | |||||
Create API keysapikeys:create | |||||
Configure SSO and SCIMsso:configure | |||||
Owners always hold every permission.
2.2Check a permission
Input
Rules, in order
- 1Tenant boundaryThe resource is in Okapi Health.Next
- 2Active memberSun-hee is an active member.Next
- 3OwnerClinician is not Owner.Next
- 4Role grantClinician holds records:write.Next
- 5Team scopeClinician is team-scoped and Sun-hee is in Clinical, not the team that owns this.deny
Result
await latch.can({
user: "usr_sun",
action: "records:write",
resource: "engineering",
})→ denyDecided by rule 5: team scope.
0 network callsRead from the session token.
3.0Joining
Two ways in: an invitation, or the right email domain.
Invitations are for the first few people. After that, a verified domain does the work: anyone who signs up with a company address lands in the company's organization, with the role its admin chose.
amara@okapi.health
Clinician · 2 days ago · by Marta Lindqvist
ext.audit@northwind.example
Auditor · 6 days ago · by Deji Okonkwo
- Link lifetime
- 7 days
- Resend limit
- 3 per day
- Accepts with
- Any sign-in method
okapi.health
TXT _latch.okapi.health "latch-verify=9c41e07b2a6d"- New sign-ups with this domain become members.
- Given to members who auto-join.
ResultJoins Okapi Health as Clinician.
No invitation needed. The sign-up finishes inside the organization, and an audit event records it.
Directory sync
4.0Directory sync
Their directory is the source of truth. Sync is a diff.
With SCIM 2.0 the customer's identity provider pushes changes as they happen: joiners, movers, leavers. Latch applies each one and answers. Nobody files a ticket to remove a login.
- Protocol
- SCIM 2.0
- Providers
- Okta, Entra ID, JumpCloud
- Median apply time
- 1.8 s
- Leaver to signed out
- ≤ 60 s
- Plan
- Business
Okta · Okapi Health directory
Pushed 18 Nov 2026, 14:02:11 UTC
- POST /scim/v2/UsersAmara Nwosu joins, group clinical-leadsQueued
- POST /scim/v2/UsersKarim Haddad joins, group clinical-leadsQueued
- PATCH /scim/v2/Users/usr_tomasTomás Rivera: department Engineering → ClinicalQueued
- PATCH /scim/v2/Groups/finance-adminsPriya Raman added: role Auditor → BillingQueued
- PATCH /scim/v2/Users/usr_jonasJonas Weber: active → falseQueued
- DELETE /scim/v2/Users/usr_leonLeon Fischer removed from the directoryQueued
Okapi Health in Latch
- Marta LindqvistClinicalOwner
- Deji OkonkwoEngineeringAdmin
- Sun-hee ParkClinicalClinician
- Tomás RiveraEngineeringClinician
- Priya RamanFinanceAuditor
- Jonas WeberClinicalClinician
- Leon FischerFinanceBilling
6 changes queued. Nothing applied yet.
5.0Audit log
Every change above is already in the log.
Who did what, to whom, from where, and whether it was allowed. The log is append-only, searchable for a year on Business, and streams to your SIEM as it is written.
| Time | Actor | Event | Target | Result |
|---|---|---|---|---|
| 14:02:19 | SCIM · Okta | leon@okapi.health | allowed | |
| 14:02:17 | SCIM · Okta | jonas@okapi.health | allowed | |
| 14:02:16 | SCIM · Okta | jonas@okapi.health | allowed | |
| 14:02:14 | SCIM · Okta | priya@okapi.health | allowed | |
| 14:02:12 | SCIM · Okta | amara@okapi.health | allowed | |
| 13:47:52 | Sun-hee Park | records:write · rec_8842 (Engineering) | denied | |
| 13:20:05 | Deji Okonkwo | role: auditor | allowed | |
| 12:58:41 | Deji Okonkwo | conn_okapi_scim | allowed | |
| 11:31:09 | Leon Fischer | members:invite · org_okapi_health | denied | |
| 10:44:27 | Marta Lindqvist | amara@okapi.health | allowed | |
| 09:41:07 | Marta Lindqvist | sess_m4t8qz2k9w | allowed | |
| 09:40:58 | unknown | conn_okapi_saml | denied | |
| 08:15:33 | Deji Okonkwo | okapi.health | allowed | |
| 08:02:10 | Priya Raman | 1–17 Nov 2026 (CSV) | allowed |
6.0
Get started
6.0Get started
Your first B2B customer can onboard themselves.
Organizations, invitations and the roles matrix are on every plan, free for teams of five. Add SSO and SCIM per customer the day their IT department asks.
npm install @latch/nextjsOrganizations, by plan
- Organizations
- Unlimited
- Members on Free
- 5 each
- Custom roles on Pro
- 10
- SSO connection
- $50 / month
- SCIM and audit log
- Business