Explore documentation

Your account and team

Set up a test organization and decide who can access it.

Your account identifies you. Your organization brings together your team’s data, applications, and access permissions. Start in the management console. The examples below show how to use the API directly.

What an organization brings together

An organization can represent a clinic, a laboratory, or a team building health software. Its resources and permissions are managed within that context.

The API applies organization-level access controls and Row-Level Security (RLS) policies in the database. Give each person the permissions they need for their work.

Create an account

To try registration through the API, replace the fictional details below. Use your own password and keep it out of application source code:

curl -X POST https://api.esus.health/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@example.com",
    "password": "SecurePass123!",
    "firstName": "Admin",
    "lastName": "User",
    "organizationName": "City General Hospital"
  }'

Response (HTTP 202 Accepted):

{
  "message": "Account created. Check your email for a verification code before signing in."
}

The 202 Accepted response confirms that the request was accepted; it does not start a session. Check your email for a six-digit verification code. You can enter it in the console’s verification screen.

Verify your account through the API

Send the code you received to POST /auth/verify-email. A successful verification returns the session tokens:

curl -X POST https://api.esus.health/auth/verify-email \
  -H "Content-Type: application/json" \
  -d '{ "email": "admin@example.com", "code": "123456" }'

User Roles

Roles are scoped to the organization. Every user has an organizational role and may have additional custom roles defined by administrators within the organization.

RoleScopeMeaning
ownerOrganizationCreated the organization or was promoted. Also receives the admin role, which gives full access, including billing, member management, and API keys.
memberOrganizationInvited user. Access is determined by the custom roles assigned in the organization.
Custom rolesOrganization-definedFine-grained roles with specific FHIR resource/action permissions (RBAC + ABAC).

Custom roles let administrators model real-world clinical roles and bind them to the exact permissions each role needs. Resource policies recognize specific role names (admin, doctor, nurse, receptionist, and others): a role with a different name does not unlock clinical data even if it has the permissions. See Access Control.

Inviting Team Members

Users with the admin role (owners have it) can invite team members to join the organization:

curl -X POST https://api.esus.health/auth/invite \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "doctor@example.com",
    "role": "member"
  }'

Response (HTTP 201 Created):

{
  "message": "Invitation sent successfully",
  "invitationId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890"
}

The invitee receives an email with a link to accept the invitation and complete their profile.

Next Steps

With your account and organization set up, learn how to authenticate with the API.