Skip to content

Account Activation

Activate a user account using the OTP received via email.

POST /api/users/activate/

No authentication required.

{
  "email": "user@example.com",
  "otp": "123456"
}
Field Type Required Description
email string Yes User's email address
otp string Yes 6-digit OTP code received via email

Response

{
  "message": "Account activated successfully.",
  "user": {
    "id": 1,
    "email": "user@example.com",
    "first_name": "John",
    "last_name": "Doe",
    "image_url": null,
    "image_ref": null,
    "is_active": true
  }
}
{
  "non_field_errors": ["Invalid OTP or OTP has expired."]
}

Error Cases

  • Invalid OTP: The OTP code is incorrect
  • Expired OTP: The OTP has expired (valid for 5 minutes)
  • Already Activated: The account is already active
  • User Not Found: No user exists with the provided email

Notes

  • OTPs expire after 5 minutes
  • OTPs can only be used once
  • After activation, the user can log in
  • If the OTP expires, use the resend OTP endpoint to get a new one

Example Request

curl -X POST https://api.endovillehealth.com/api/users/activate/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "otp": "123456"
  }'