This endpoint permanently removes a user account from the database using Mongoose’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt
Use this file to discover all available pages before exploring further.
findByIdAndDelete. The operation is irreversible — once the document is deleted there is no recovery path. As a safeguard, the controller checks that the userId path parameter matches the _id of the document that was found and deleted; a mismatch is returned as a 203 error. Because the check happens after deletion has already occurred, the primary defense against unauthorized deletion is the token-access header middleware applied at the route level, which must be a valid JWT before the controller is ever reached.
POST /api/user/delete/:userId/account
Authentication
A valid JWT obtained from the Login endpoint. The middleware validates this token before the controller logic runs.
Path Parameters
The MongoDB ObjectId of the account to delete. Must match the
_id of the document located by the database lookup.Request Body
No request body is required for this endpoint.Response
200 — Success
Confirmation that the account was deleted:
"Cuenta eliminada correctamente".Always
true on success.Error Responses
| Status | Cause |
|---|---|
203 | The userId in the URL did not match the _id of the deleted document. |
500 | Unexpected server or database error, including an invalid or non-existent userId. |