Resend Verification
Sends a new verification email to the user. Use this when the original verification email was not received or the token expired.
Endpointβ
POST /api/v1/auth/resend-verification
Authenticationβ
No authentication required (public endpoint).
Requestβ
Content-Typeβ
application/json
Request Bodyβ
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Email address to resend verification to |
Example Requestβ
{
"email": "john@example.com"
}
Responseβ
Success Response (200 OK)β
{
"message": "Verification email sent successfully",
"success": true
}
Examplesβ
curl -X POST https://api.callcov.com/api/v1/auth/resend-verification \-H "Content-Type: application/json" \-d '{ "email": "john@example.com"}'Errorsβ
400 Bad Requestβ
Email already verified:
{
"detail": "Email already verified"
}
404 Not Foundβ
User not found:
{
"detail": "User not found"
}
500 Internal Server Errorβ
Failed to send email:
{
"detail": "Failed to send verification email"
}
Behaviorβ
When this endpoint is called:
- Invalidates all previous verification tokens for this user
- Generates a new verification token (expires in 15 minutes)
- Sends new verification email
- Returns success message
Rate Limitingβ
To prevent abuse, this endpoint is rate-limited:
- Maximum 3 requests per email per hour
- Maximum 10 requests per IP per hour
Use Casesβ
Verification Email Not Receivedβ
function resendVerificationEmail(email) {
return fetch('https://api.callcov.com/api/v1/auth/resend-verification', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email })
});
}
// In your login form
async function handleLogin(email, password) {
try {
const response = await loginUser(email, password);
} catch (error) {
if (error.message.includes('verify your email')) {
// Show "Resend verification email" button
const resendButton = document.getElementById('resend-button');
resendButton.style.display = 'block';
resendButton.onclick = async () => {
await resendVerificationEmail(email);
alert('Verification email sent! Please check your inbox.');
};
}
}
}
Verification Token Expiredβ
// When user clicks expired verification link
const urlParams = new URLSearchParams(window.location.search);
const token = urlParams.get('token');
try {
const response = await fetch('/api/v1/auth/verify-email', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code: token })
});
if (!response.ok) {
const error = await response.json();
if (error.detail.includes('expired')) {
// Show resend verification form
showResendVerificationForm();
}
}
} catch (error) {
console.error(error);
}
Security Considerationsβ
- Previous tokens invalidated: All old verification tokens are marked as used
- Rate limited: Prevents email bombing
- Single-use tokens: Each new token can only be used once
- Time-limited: New tokens expire in 15 minutes
Relatedβ
- Register - Create new account
- Verify Email - Verify email with token
- Login - Log in after verification