Skip to main content

Edit Account

PUT /user

Description

Updates the authenticated user's profile. This route accepts multipart form data and can update text fields, privacy, password, email, timezone, and profile picture.

Request Parameters

Requires Authentication: true

BODY (multipart/form-data)

NameTypeRequiredDescription
usernamestringNoNew username.
displayNamestringNoNew display name.
emailstringNoNew email. Changing it marks the account as unverified again.
biostringNoNew bio.
timeZonestringNoNew IANA timezone.
privatebooleanNoAccount privacy, sent as "true" or "false" in form-data.
passwordstringNoNew password.
lastPasswordstringNoRequired when changing password.
filefileNoNew profile picture image.

Usage Example

const formData = new FormData()
formData.append("displayName", "John Doe")
formData.append("bio", "My new bio")
formData.append("private", "true")

await axios.put("https://api.daykeeper.app/user", formData, {
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "multipart/form-data",
},
})

Success Response

{
"message": "user updated successfully",
"user": {
"_id": "65cbaab84b9d1cce41e98b60",
"username": "johndoe",
"displayName": "John Doe"
}
}

Notes

  • If email changes, a new verification code is generated and sent.
  • If password is sent, lastPassword must also be correct.
  • Duplicate username or email values are rejected.

Error Response

CodeDescription
400Invalid email, time zone, or missing lastPassword
401Wrong lastPassword
404User not found
409Email or username already in use
413Bio, username, display name, password, or time zone too long
500Server error