Skip to content

Organizations

Organizations group users and patients. A user can be member of many organizations (Free can join unlimited, but only Pro can create — organizations: 0 for free).

Organizations are dashboard-only: there is no API-key equivalent. All routes below require a session cookie.

Roles

RoleCapabilities
viewerRead patients assigned to the org
memberSame as viewer (default on join)
adminInvite, edit, delete, manage patients, QR share

Invite is email-based (POST /api/v1/organizations/:id/invite), or via QR ?join=slug. Leaving is POST /:id/leave (admins cannot leave, must transfer).

API

  • POST /api/v1/organizations — Pro only (402 if canCreateOrganization fails). Body { name, type, slug? }.
  • POST /api/v1/organizations/join — unlimited for Free, creates membership + optional patientAssignment (only patients the user owns, IDOR guard).
  • GET /api/v1/organizations — lists memberships with memberCount subquery.
  • GET /api/v1/organizations/patients/data — enriched patient view across orgs with lateral join on glucose_reading (3h sparkline, TIR).

UI

OrganizationsPage.vue shows two cards: total organizations and “Crear: solo Pro · Unirte es ilimitado” (Lock vs Building2), plus GenericTable and v-if="!selectedBlock && !settingsOpen" placeholder fix. Create button opens PremiumUpsellModal for Free.