This document provides detailed information about the tutor authentication endpoints in the Chainverse Academy platform. These endpoints handle tutor registration, login, profile management, and other authentication-related operations.
/api/v1
Most endpoints require JWT authentication. Include the JWT token in the Authorization header:
Authorization: Bearer <your_jwt_token>
POST /tutor/createRequest Body:
{
"fullName": "John Doe",
"email": "john.doe@example.com",
"password": "SecurePassword123!",
"web3Expertise": "Blockchain Development",
"experience": 5
}Response:
{
"status": "success",
"message": "Tutor registered successfully. Please verify your email.",
"data": {
"tutorId": "60d21b4667d0d8992e610c85"
}
}POST /tutor/verify-emailRequest Body:
{
"email": "john.doe@example.com",
"verificationCode": "123456"
}Response:
{
"status": "success",
"message": "Email verified successfully"
}POST /tutor/loginRequest Body:
{
"email": "john.doe@example.com",
"password": "SecurePassword123!"
}Response:
{
"status": "success",
"message": "Login successful",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"tutor": {
"_id": "60d21b4667d0d8992e610c85",
"fullName": "John Doe",
"email": "john.doe@example.com",
"web3Expertise": "Blockchain Development",
"experience": 5,
"role": "tutor"
}
}
}POST /tutor/refresh-tokenRequest Body:
{
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Response:
{
"status": "success",
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}POST /tutor/forget/passwordRequest Body:
{
"email": "john.doe@example.com"
}Response:
{
"status": "success",
"message": "Password reset instructions sent to your email"
}POST /tutor/reset/passwordRequest Body:
{
"email": "john.doe@example.com",
"resetToken": "123456",
"newPassword": "NewSecurePassword123!"
}Response:
{
"status": "success",
"message": "Password reset successful"
}GET /tutor/profileHeaders:
Authorization: Bearer <your_jwt_token>
Response:
{
"status": "success",
"data": {
"tutor": {
"_id": "60d21b4667d0d8992e610c85",
"fullName": "John Doe",
"email": "john.doe@example.com",
"web3Expertise": "Blockchain Development",
"experience": 5,
"courses": ["60d21b4667d0d8992e610c86", "60d21b4667d0d8992e610c87"],
"role": "tutor"
}
}
}PUT /tutor/profileHeaders:
Authorization: Bearer <your_jwt_token>
Request Body:
{
"fullName": "John Smith",
"web3Expertise": "Smart Contract Development",
"experience": 6
}Response:
{
"status": "success",
"message": "Profile updated successfully",
"data": {
"tutor": {
"_id": "60d21b4667d0d8992e610c85",
"fullName": "John Smith",
"email": "john.doe@example.com",
"web3Expertise": "Smart Contract Development",
"experience": 6,
"role": "tutor"
}
}
}{
"status": "fail",
"errors": [
{
"field": "email",
"message": "Please provide a valid email address"
},
{
"field": "password",
"message": "Password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, one number, and one special character"
}
]
}{
"status": "fail",
"error": "Authentication required"
}{
"status": "fail",
"error": "You do not have permission to access this resource"
}{
"status": "fail",
"error": "Tutor not found"
}{
"status": "error",
"error": "Internal server error"
}