Skip to main content

Confirm Email

POST /auth/confirm_email

Description

Confirms a newly registered account using the six-digit verification code sent by email. On success, the API also logs the user in and returns access and refresh tokens.

Request Parameters

Requires Authentication: false

BODY

NameTypeRequiredDescription
emailstringYesAccount email.
verificationCodestringYesSix-digit email verification code.
deviceIdstringNoOptional device identifier stored with the refresh token.

Usage Example

await axios.post("https://api.daykeeper.app/auth/confirm_email", {
email: "johndoe@example.com",
verificationCode: "123456",
deviceId: "iphone-15-pro",
})

Success Response

{
"message": "johndoe's email confirmed successfully",
"user": {
"id": "65cbaab84b9d1cce41e98b60",
"username": "johndoe",
"email": "johndoe@example.com",
"profile_picture": {
"title": "DaykeeperPFP.png",
"key": "public/DaykeeperPFP.png",
"url": ""
},
"roles": ["user"]
},
"accessToken": "<jwt>",
"refreshToken": "<refresh_token>"
}

Notes

  • If the email is already confirmed, the API still returns success and issues tokens.
  • If the wrong code is sent, the stored verification code is cleared and a new one must be requested.

Error Response

CodeDescription
400Missing email or code
401Invalid verification code
403Expired code or unavailable account
404User not found
500Server error

Example

{
"message": "Enter a valid Verification code"
}