Skip to main content
POST
https://app.medisync.me
/
api
/
register
User Registration
curl --request POST \
  --url https://app.medisync.me/api/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "title": "<string>",
  "firstName": "<string>",
  "lastName": "<string>",
  "email": "<string>",
  "password": "<string>",
  "specialty": "<string>",
  "ehr_system_type": "<string>",
  "ehr_system_name": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "user": {
    "id": "<string>",
    "email": "<string>",
    "isVerified": true
  }
}

Overview

The registration endpoint creates new healthcare professional accounts in the MediSync platform. All registrations require medical credentials and EHR system information for proper healthcare workflow integration.

Request

title
string
required
Medical title (e.g., “Dr.”, “Prof.”, “Nurse”, “PA”)
firstName
string
required
First name of the healthcare professional
lastName
string
required
Last name of the healthcare professional
email
string
required
Professional email address (must be unique)
password
string
required
Account password (minimum 8 characters, must include letters and numbers)
specialty
string
required
Medical specialty (e.g., “Cardiology”, “Pediatrics”, “General Practice”)
ehr_system_type
string
required
Type of EHR system used (e.g., “Epic”, “Cerner”, “Allscripts”)
ehr_system_name
string
required
Specific name of the EHR system instance

Example Request

curl -X POST https://app.medisync.me/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Dr.",
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "password": "SecurePass123!",
    "specialty": "Cardiology",
    "ehr_system_type": "Epic",
    "ehr_system_name": "Epic MyChart"
  }'

Response

success
boolean
Indicates whether the registration was successful
message
string
Success message with next steps
user
object
Created user information

Success Response

{
  "success": true,
  "message": "User registered successfully. Please verify your email to activate your account.",
  "user": {
    "id": "user_123456",
    "email": "[email protected]",
    "isVerified": false
  }
}

Error Responses

{
  "success": false,
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "details": {
    "email": "Email is required",
    "password": "Password must be at least 8 characters",
    "specialty": "Medical specialty is required"
  }
}

Field Validation

Password Requirements

Requirements:
  • Minimum 8 characters
  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number
  • Special characters recommended
Example Valid Passwords:
  • SecurePass123!
  • MyPassword2024#
  • Healthcare@456
Requirements:
  • Valid email format
  • Professional domain preferred
  • Must be unique across all users
  • No disposable email providers
Example Valid Emails:

Medical Specialties

Common medical specialties accepted:

Primary Care

  • General Practice
  • Family Medicine
  • Internal Medicine
  • Pediatrics

Specialists

  • Cardiology
  • Neurology
  • Orthopedics
  • Dermatology

Other

  • Emergency Medicine
  • Radiology
  • Pathology
  • Anesthesiology

EHR Systems

Supported EHR system types:
  • Epic - Epic MyChart, Epic Hyperspace
  • Cerner - Cerner PowerChart, Cerner Millennium
  • Allscripts - Allscripts Professional, Allscripts TouchWorks
  • NextGen - NextGen EPM, NextGen Office

Usage Examples

Complete Registration Flow

async function registerUser(userData) {
  // Client-side validation
  const validation = validateRegistrationData(userData);
  if (!validation.isValid) {
    return {
      success: false,
      errors: validation.errors
    };
  }

  try {
    const response = await fetch('https://app.medisync.me/api/register', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(userData)
    });

    const data = await response.json();

    if (response.ok) {
      // Registration successful
      return {
        success: true,
        userId: data.user.id,
        message: data.message,
        needsVerification: !data.user.isVerified
      };
    } else {
      // Handle server-side errors
      return {
        success: false,
        error: data.error,
        code: data.code,
        details: data.details
      };
    }
  } catch (error) {
    return {
      success: false,
      error: 'Network error occurred'
    };
  }
}

function validateRegistrationData(data) {
  const errors = {};
  
  if (!data.email || !/\S+@\S+\.\S+/.test(data.email)) {
    errors.email = 'Valid email is required';
  }
  
  if (!data.password || data.password.length < 8) {
    errors.password = 'Password must be at least 8 characters';
  }
  
  if (!data.firstName?.trim()) {
    errors.firstName = 'First name is required';
  }
  
  if (!data.lastName?.trim()) {
    errors.lastName = 'Last name is required';
  }
  
  if (!data.specialty?.trim()) {
    errors.specialty = 'Medical specialty is required';
  }

  return {
    isValid: Object.keys(errors).length === 0,
    errors
  };
}

// Usage
const registrationData = {
  title: 'Dr.',
  firstName: 'John',
  lastName: 'Doe',
  email: '[email protected]',
  password: 'SecurePass123!',
  specialty: 'Cardiology',
  ehr_system_type: 'Epic',
  ehr_system_name: 'Epic MyChart'
};

const result = await registerUser(registrationData);
if (result.success) {
  console.log('Registration successful:', result.message);
  if (result.needsVerification) {
    console.log('Please check your email for verification');
  }
} else {
  console.error('Registration failed:', result.error);
}

Registration Form Integration

import React, { useState } from 'react';

function RegistrationForm() {
  const [formData, setFormData] = useState({
    title: '',
    firstName: '',
    lastName: '',
    email: '',
    password: '',
    specialty: '',
    ehr_system_type: '',
    ehr_system_name: ''
  });
  
  const [errors, setErrors] = useState({});
  const [isSubmitting, setIsSubmitting] = useState(false);

  const handleSubmit = async (e) => {
    e.preventDefault();
    setIsSubmitting(true);
    setErrors({});

    try {
      const response = await fetch('https://app.medisync.me/api/register', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(formData)
      });

      const data = await response.json();

      if (response.ok) {
        alert('Registration successful! Please check your email for verification.');
        // Redirect to login or verification page
      } else {
        if (data.details) {
          setErrors(data.details);
        } else {
          setErrors({ general: data.error });
        }
      }
    } catch (error) {
      setErrors({ general: 'Network error occurred' });
    } finally {
      setIsSubmitting(false);
    }
  };

  return (
    <form onSubmit={handleSubmit}>
      <div>
        <label>Title:</label>
        <select 
          value={formData.title}
          onChange={(e) => setFormData({...formData, title: e.target.value})}
          required
        >
          <option value="">Select Title</option>
          <option value="Dr.">Dr.</option>
          <option value="Prof.">Prof.</option>
          <option value="Nurse">Nurse</option>
          <option value="PA">PA</option>
        </select>
        {errors.title && <span className="error">{errors.title}</span>}
      </div>

      <div>
        <label>First Name:</label>
        <input
          type="text"
          value={formData.firstName}
          onChange={(e) => setFormData({...formData, firstName: e.target.value})}
          required
        />
        {errors.firstName && <span className="error">{errors.firstName}</span>}
      </div>

      <div>
        <label>Last Name:</label>
        <input
          type="text"
          value={formData.lastName}
          onChange={(e) => setFormData({...formData, lastName: e.target.value})}
          required
        />
        {errors.lastName && <span className="error">{errors.lastName}</span>}
      </div>

      <div>
        <label>Email:</label>
        <input
          type="email"
          value={formData.email}
          onChange={(e) => setFormData({...formData, email: e.target.value})}
          required
        />
        {errors.email && <span className="error">{errors.email}</span>}
      </div>

      <div>
        <label>Password:</label>
        <input
          type="password"
          value={formData.password}
          onChange={(e) => setFormData({...formData, password: e.target.value})}
          minLength="8"
          required
        />
        {errors.password && <span className="error">{errors.password}</span>}
      </div>

      <div>
        <label>Medical Specialty:</label>
        <input
          type="text"
          value={formData.specialty}
          onChange={(e) => setFormData({...formData, specialty: e.target.value})}
          placeholder="e.g., Cardiology, Pediatrics"
          required
        />
        {errors.specialty && <span className="error">{errors.specialty}</span>}
      </div>

      <div>
        <label>EHR System Type:</label>
        <select
          value={formData.ehr_system_type}
          onChange={(e) => setFormData({...formData, ehr_system_type: e.target.value})}
          required
        >
          <option value="">Select EHR System</option>
          <option value="Epic">Epic</option>
          <option value="Cerner">Cerner</option>
          <option value="Allscripts">Allscripts</option>
          <option value="NextGen">NextGen</option>
          <option value="Other">Other</option>
        </select>
        {errors.ehr_system_type && <span className="error">{errors.ehr_system_type}</span>}
      </div>

      <div>
        <label>EHR System Name:</label>
        <input
          type="text"
          value={formData.ehr_system_name}
          onChange={(e) => setFormData({...formData, ehr_system_name: e.target.value})}
          placeholder="e.g., Epic MyChart"
          required
        />
        {errors.ehr_system_name && <span className="error">{errors.ehr_system_name}</span>}
      </div>

      {errors.general && <div className="error">{errors.general}</div>}

      <button type="submit" disabled={isSubmitting}>
        {isSubmitting ? 'Registering...' : 'Register'}
      </button>
    </form>
  );
}

Email Verification

After successful registration, users must verify their email address before accessing most API features. Check the email verification endpoints for managing this process.

Post-Registration Flow

  1. Registration - Account created but unverified
  2. Email Sent - Verification email sent automatically
  3. Email Verification - User clicks verification link
  4. Account Activated - Full API access enabled

Security Considerations

Password Security:
  • Passwords are hashed using bcrypt
  • Never stored in plaintext
  • Minimum complexity requirements enforced
Email Security:
  • Unique email validation
  • Professional domain verification
  • Anti-spam measures implemented
HIPAA Considerations:
  • Professional verification required
  • Medical specialty validation
  • EHR system integration planning
  • Audit trail for all registrations

Rate Limiting

Registration endpoint has specific rate limits to prevent abuse:
  • Limit: 3 attempts per hour per IP address
  • Lockout: 1 hour after 3 failed attempts
  • Headers: Monitor X-RateLimit-* headers

Testing

Integration Testing

# Test successful registration
curl -X POST https://app.medisync.me/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Dr.",
    "firstName": "Test",
    "lastName": "Doctor",
    "email": "[email protected]",
    "password": "TestPass123!",
    "specialty": "General Practice",
    "ehr_system_type": "Epic",
    "ehr_system_name": "Epic MyChart"
  }' \
  -w "\nHTTP Status: %{http_code}\n"

# Test duplicate email
curl -X POST https://app.medisync.me/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Dr.",
    "firstName": "Another",
    "lastName": "Doctor",
    "email": "[email protected]",
    "password": "AnotherPass123!",
    "specialty": "Cardiology",
    "ehr_system_type": "Cerner",
    "ehr_system_name": "Cerner PowerChart"
  }' \
  -w "\nHTTP Status: %{http_code}\n"

Next Steps