Authentication
User authentication operations
Creates a new user account.
User's email address.
User's password (at least 6 characters).
The role of the user.
User registered successfully.
Bad request (e.g., invalid input).
Conflict (e.g., user with this email already exists).
POST /api/v1/auth/register HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 66
{
"email": "[email protected]",
"password": "password",
"role": "retailer"
}
{
"message": "User created successfully. Please check your email to verify your account."
}
Authenticates a user and returns access and refresh tokens.
User's email address.
User's password.
User logged in successfully.
Bad request (e.g., invalid input).
Unauthorized (e.g., invalid credentials).
POST /api/v1/auth/login HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 48
{
"email": "[email protected]",
"password": "password"
}
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Refreshes the access token using the refresh token.
Access token refreshed successfully.
Unauthorized.
GET /api/v1/auth/refresh HTTP/1.1
Host: localhost:3000
Accept: */*
{
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Verifies a user's email address using a verification code.
The email verification code.
Email verified successfully.
No content
Bad request (e.g., invalid or expired code).
Not found (e.g., user not found).
GET /api/v1/auth/email/verify/{code} HTTP/1.1
Host: localhost:3000
Accept: */*
No content
Sends a password reset email to the user.
User's email address.
Password reset email sent successfully.
No content
Bad request (e.g., invalid email).
Not found (e.g., user not found).
POST /api/v1/auth/password/forgot HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 26
{
"email": "[email protected]"
}
No content
Resets the user's password using a verification code.
The new password (at least 6 characters).
The password reset verification code.
Password reset successfully.
No content
Bad request (e.g., invalid or expired code).
POST /api/v1/auth/password/reset HTTP/1.1
Host: localhost:3000
Content-Type: application/json
Accept: */*
Content-Length: 49
{
"password": "password",
"verificationCode": "text"
}
No content