Sign Up
Create a new user account with email and password.
POST /api/auth/sign-up/email
Request Body
User’s email address. Must be valid and unique.
User’s password. Should meet minimum security requirements.
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/sign-up/email" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"name": "John Doe"
}'
Response
Email verification status (false on signup)
Account creation timestamp
Response Example
{
"user": {
"id": "usr_abc123",
"email": "[email protected]",
"name": "John Doe",
"email_verified": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"session": {
"id": "ses_xyz789",
"user_id": "usr_abc123",
"expires_at": "2024-01-16T10:30:00Z"
}
}
After signup, a verification email is automatically sent. Users must verify their email before creating organizations.
Sign In
Authenticate with email and password.
POST /api/auth/sign-in/email
Request Body
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/sign-in/email" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123"
}'
Response
The authenticated user object
Created session object with active organization info
User’s current subscription status
subscription.isSubscribed
Whether user has an active subscription
Active product ID (pro, teams, etc.)
Response Example
{
"user": {
"id": "usr_abc123",
"email": "[email protected]",
"name": "John Doe",
"email_verified": true,
"created_at": "2024-01-15T10:30:00Z"
},
"session": {
"id": "ses_xyz789",
"user_id": "usr_abc123",
"active_organization_id": "org_456",
"expires_at": "2024-01-16T10:30:00Z"
},
"subscription": {
"isSubscribed": true,
"productId": "prod_pro_monthly"
}
}
If the user’s email is not verified, a verification email will be sent on sign-in.
Verify Email
Verify user’s email address using the token from the verification email.
GET /api/auth/verify-email
Query Parameters
Email verification token from the verification email link
Request Example
curl -X GET "{NEXT_PUBLIC_APP_URL}/api/auth/verify-email?token=verify_token_123"
Response
{
"success": true,
"message": "Email verified successfully"
}
Request Password Reset
Request a password reset email.
POST /api/auth/forget-password
Request Body
Email address of the account to reset
Optional redirect URL after password reset
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/forget-password" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"redirectTo": "/dashboard"
}'
Response
{
"success": true,
"message": "Password reset email sent"
}
Reset Password
Reset password using the token from the reset email.
POST /api/auth/reset-password
Request Body
Password reset token from the email
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/reset-password" \
-H "Content-Type: application/json" \
-d '{
"token": "reset_token_123",
"password": "newSecurePassword456"
}'
Response
{
"success": true,
"message": "Password reset successfully"
}
Sign Out
End the current session.
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/sign-out" \
-H "Cookie: session=session_token_here"
Response
Get Session
Retrieve current session information.
GET /api/auth/get-session
Request Example
curl -X GET "{NEXT_PUBLIC_APP_URL}/api/auth/get-session" \
-H "Cookie: session=session_token_here"
Response
Current subscription status
Response Example
{
"user": {
"id": "usr_abc123",
"email": "[email protected]",
"name": "John Doe",
"email_verified": true
},
"session": {
"id": "ses_xyz789",
"user_id": "usr_abc123",
"active_organization_id": "org_456",
"expires_at": "2024-01-16T10:30:00Z",
"ip_address": "192.168.1.1",
"user_agent": "Mozilla/5.0..."
},
"subscription": {
"isSubscribed": true,
"productId": "prod_teams_yearly"
}
}
Generate JWT Token
Generate a JWT token for API access.
Request Example
curl -X POST "{NEXT_PUBLIC_APP_URL}/api/auth/token" \
-H "Cookie: session=session_token_here"
Response
JWT token valid for 1 hour
Response Example
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
JWT tokens expire after 1 hour. Generate a new token before the expiration to maintain API access.
Error Responses
All authentication endpoints may return the following error responses:
400 Bad Request
{
"error": "INVALID_EMAIL",
"message": "Email address is invalid"
}
401 Unauthorized
{
"error": "INVALID_CREDENTIALS",
"message": "Email or password is incorrect"
}
409 Conflict
{
"error": "USER_EXISTS",
"message": "User with this email already exists"
}
429 Too Many Requests
{
"error": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests, please try again later"
}