Email Services API

Email ServicesAPI Reference

Complete email management endpoints for verification, password reset, and notification services. EasyAuth server handles all email templating and sending automatically.

Base URL

https://easyauth-server.vercel.app/api/v1

Email Service

• Professional HTML email templates

• Automatic app name extraction from URL

• Built-in rate limiting protection

• Server handles all email configuration

Email Endpoints

Professional email templates with automatic app branding and secure token generation

POST/auth/verify-email

Verify Email Address

Verify a user's email address using a verification token. This endpoint is called when users click the verification link in their email.

Parameters

tokenstringrequired

Email verification token from the verification email

applicationUrlstring

Optional redirect URL after verification

Example Request

curl -X POST https://easyauth-server.vercel.app/api/v1/auth/verify-email \
  -H "Content-Type: application/json" \
  -d '{
    "token": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
    "applicationUrl": "https://myapp.com"
  }'

Responses

Success (200)
{
  "success": true,
  "message": "Email verified successfully",
  "data": {
    "user": {
      "id": "user_1234567890",
      "email": "user@example.com",
      "email_verified": true,
      "verified_at": "2023-12-01T10:30:00Z"
    }
  }
}
Error (400)
{
  "success": false,
  "message": "Invalid or expired verification token",
  "error": "INVALID_TOKEN"
}
POST/auth/resend-verification-email

Resend Verification Email

Resend the email verification email to a user who hasn't verified their email yet.

Parameters

emailstringrequired

User's email address to resend verification to

applicationUrlstring

Optional application URL for the verification redirect

Example Request

curl -X POST https://easyauth-server.vercel.app/api/v1/auth/resend-verification-email \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "applicationUrl": "https://myapp.com"
  }'

Responses

Success (200)
{
  "success": true,
  "message": "Verification email sent successfully"
}
Error (400)
{
  "success": false,
  "message": "Email already verified or user not found",
  "error": "EMAIL_ALREADY_VERIFIED"
}
POST/auth/forgot-password

Send Password Reset Email

Send a password reset email to the user's registered email address. The email contains a secure link to reset their password.

Parameters

emailstringrequired

User's registered email address

applicationUrlstring

Optional application URL for the reset redirect

Example Request

curl -X POST https://easyauth-server.vercel.app/api/v1/auth/forgot-password \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "applicationUrl": "https://myapp.com"
  }'

Responses

Success (200)
{
  "success": true,
  "message": "Password reset email sent successfully"
}
Error (404)
{
  "success": false,
  "message": "No account found with this email address",
  "error": "USER_NOT_FOUND"
}
POST/auth/reset-password

Reset Password

Reset user's password using the reset token received via email. This is typically called from the password reset form.

Parameters

tokenstringrequired

Password reset token from the reset email

newPasswordstringrequired

New password for the user account (minimum 6 characters)

Example Request

curl -X POST https://easyauth-server.vercel.app/api/v1/auth/reset-password \
  -H "Content-Type: application/json" \
  -d '{
    "token": "abc123def456ghi789jkl012mno345pqr678stu901vwx234yz",
    "newPassword": "newSecurePassword123"
  }'

Responses

Success (200)
{
  "success": true,
  "message": "Password reset successfully"
}
Error (400)
{
  "success": false,
  "message": "Invalid or expired reset token",
  "error": "INVALID_TOKEN"
}

Email Workflow

Understanding the email verification and password reset flow

Email Verification

1

User Registration

User registers with email and verification email is automatically sent

2

Click Verify Link

User clicks verification link in email with embedded token

3

API Verification

Your app calls POST /email/verify with token

Email Verified

User's email is marked as verified in the system

Password Reset

1

Request Reset

Call POST /email/reset with user's email

2

Email Sent

Password reset email with link is sent to user's email

3

Click Reset Link

User clicks link and is taken to password reset page

Password Updated

User enters new password and it's updated in the system

Common Error Codes

Email Verification Errors

INVALID_TOKEN

Verification token is invalid or expired

EMAIL_ALREADY_VERIFIED

User's email is already verified

EMAIL_NOT_FOUND

Email address not found in system

Password Reset Errors

USER_NOT_FOUND

No account found with this email

RATE_LIMITED

Too many reset requests from this IP

EMAIL_SERVICE_ERROR

Failed to send email due to service error

Related APIs

Explore other EasyAuth API endpoints that work with email services