Overview
Creating a provider involves either flagging an existing user as a provider or creating a new user with the provider flag enabled. This guide covers both scenarios.Per-Clinic Providers: When you create a provider, they are flagged as a provider ONLY in the current clinic. The same user can be a regular staff member in other clinics.
Prerequisites
Before creating a provider:1
Required Permissions
You must have
CLINIC_ADMIN role in the clinic where you’re creating the provider.2
Clinic Context
Ensure the correct clinic is selected in the clinic selector (top-right dropdown).
3
User Information
Prepare the provider’s email, phone number, and full name.
Method 1: Flag Existing User as Provider
Use this method when the user already exists in your clinic (e.g., administrative staff becoming a provider).1
Navigate to Users
Go to Users section from the main menu.
2
Find the User
Use search to locate the user by name or email.
3
Open Edit Dialog
Click the Edit icon on the user’s card.
4
Enable Provider Flag
Toggle Is Provider to
true.5
Save Changes
Click Save to update the user’s profile.
API Request (Method 1)
Response
Method 2: Create New User as Provider
Use this method when hiring a new team member who will be a provider.
1
Navigate to Create User
Go to Users → Create User or click the Add User button.
2
Fill User Information
- Full Name: Provider’s full name
- Email: Professional email address (must be unique globally)
- Phone: E.164 format (e.g.,
+34612345678) - Role: Select clinic role (
STAFForCLINIC_ADMIN)
3
Enable Provider Flag
Toggle Is Provider to
true.4
Set Initial Status
Choose
approved (active immediately) or pending (requires approval).5
Submit Form
Click Create User to save.
API Request (Method 2)
Response
Audit Logging: Provider creation is automatically logged in
audit_logs with action USER_CREATED and details including is_provider: true.Field Details
Uniqueness Constraint
Uniqueness Constraint
Email must be unique globally (across all clinics). Two users cannot share the same email address.Error Example:Solution: Use a different email or identify the existing user and flag them as a provider instead (Method 1).
Format Validation
Format Validation
Email must be a valid email address format.Valid:
[email protected], [email protected]Invalid: maria.garcia, juan@, @namsec.esPhone Number
E.164 Format Required
E.164 Format Required
Phone numbers MUST be in E.164 format:
+[country code][number]Examples:- Spain:
+34612345678 - US:
+14155551234 - Mexico:
+525512345678
612345678, (415) 555-1234, +34 612 345 678Global Uniqueness
Global Uniqueness
Phone numbers must be unique globally (across all clinics), similar to email.Error Example:
Normalization
Normalization
The system uses Best Practice: Always provide phone numbers in E.164 format to avoid parsing issues.
normalize_phone_to_e164() to convert various formats:Full Name
Per-Clinic Storage
Per-Clinic Storage
Full name is stored in
user_clinic_profiles.full_name, meaning:- The same user can have different names in different clinics
- Name is tied to the
user_clinicrelationship, not the globaluserstable
- Clinic A: “Dr. María García Rodríguez”
- Clinic B: “María García” (same user, informal name)
Multi-Clinic Name Updates
Multi-Clinic Name Updates
When a patient exists in Clinic A as “Manuel López” and books in Clinic B as “Eduardo Cassanovas”, the system:
- Associates the user to Clinic B (creates new
user_clinic) - Updates the global name to “Eduardo Cassanovas” (respects most recent input)
docs/FIX_MULTI_CLINIC_PATIENT_NAME_UPDATE.md for full details.Clinic Role
STAFF
Standard team member with access to their clinic’s data.
CLINIC_ADMIN
Can manage clinic configuration, users, providers, and services.
ADMIN
System administrator with access to ALL clinics (global role).
Status
approved
Active Provider: Can deliver services immediately. Availability slots are generated.
pending
Awaiting Approval: Provider is not yet active. No availability slots generated. Use for onboarding.
suspended
Temporarily Inactive: Provider is suspended (leave, disciplinary action). No availability slots.
Post-Creation Steps
After creating a provider, complete their setup:1
Configure Work Hours
Navigate to Configure Schedule to set the provider’s working hours.Without work hours: Provider will have NO availability (no slots generated).
2
Assign Services
Navigate to Assign Services to link the provider to services they deliver.Without service assignments: Provider won’t appear when patients book specific services.
3
Verify Availability
Test availability by simulating an appointment booking for a service assigned to this provider.
4
Notify Provider
Send login credentials and onboarding information to the new provider.
Common Errors
403 Forbidden - Cannot Manage Clinic
403 Forbidden - Cannot Manage Clinic
Cause: You don’t have
CLINIC_ADMIN role in the selected clinic.Solution: Contact your system administrator to grant you CLINIC_ADMIN permissions for this clinic.400 Bad Request - Email Already in Use
400 Bad Request - Email Already in Use
Cause: A user with this email already exists globally.Solution:
- Search for the existing user in the Users section
- If they exist in your clinic, use Method 1 to flag them as a provider
- If they exist in another clinic but not yours, add them to your clinic first (Create UserClinic association)
400 Bad Request - Phone Already in Use
400 Bad Request - Phone Already in Use
Cause: A user with this phone number already exists globally.Solution: Similar to email conflict. Locate the existing user and either flag them as a provider or verify the phone number is correct.
400 Bad Request - Invalid Phone Format
400 Bad Request - Invalid Phone Format
Cause: Phone number is not in E.164 format.Solution: Reformat the phone number to E.164. Examples:
- Spain:
+34+ 9-digit number - US:
+1+ 10-digit number - Mexico:
+52+ 10-digit number
Validation Logic
The system performs several validations when creating a provider:Database Changes
Creating a provider modifies three tables:1. users Table (Global Identity)
2. user_clinics Table (Clinic Association + Provider Flag)
3. user_clinic_profiles Table (Per-Clinic PII)
GDPR Compliance: PII (full_name, notes) is stored separately in
user_clinic_profiles to enable GDPR-compliant deletion without losing access audit trail.