DELETE {{NEXT_PUBLIC_API_BASE_URL}}/api/user/delete

Delete Current User

Allows an authenticated user to delete their account permanently. The user must confirm their email and password to do this.

Request Headers

  • Content-Type: application/json
  • X-CSRFToken: The CSRF token of the user

Request Body

  • email (string, required): The email address of the user
  • password (string, required): The current password of the user

Example:

{
  "email": "[email protected]",
  "password": "securePassword123"
}

Responses

200

The user’s account is successfully deleted.

Example:

{
  "message": "Account deleted!"
}

400

The email or password is invalid, or does not match the logged-in user’s credentials.

Example:

{
  "message": "Invalid email or password"
}

500

An error occurred while deleting the user’s account.

Example:

{
  "message": "Error deleting user",
  "error": "Some descriptive error message"
}
Last updated on