Authentication Required: Bearer token
Role Required: ADMIN
Permanently deletes a user from the platform. This endpoint is restricted to administrators only.
This action is irreversible. All user data will be permanently deleted from the database.
Authentication
This endpoint requires a valid JWT Bearer token with ADMIN role.
Authorization: Bearer <your_jwt_token>
Path Parameters
The id_user of the user to delete
Request
No request body required.
curl -X DELETE https://api.marsai.com/users/1 \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Response
Success Response
{
"message": "Utilisateur supprimé avec succès"
}
According to HTTP standards, a 204 response typically has no body, but this endpoint includes a confirmation message for clarity.
Error Responses
{
"error": "Token invalide ou manquant"
}
{
"error": "Accès interdit. Rôle ADMIN requis."
}
{
"error": "Utilisateur non trouvé"
}
500 Internal Server Error
{
"error": "Erreur base de données"
}
Important Considerations
- Cascade effects: Deleting a user may affect associated data (movies, votes, awards)
- Cannot be undone: This operation permanently removes the user from the database
- Admin restriction: Only users with ADMIN role can delete users
- Self-deletion: Be cautious not to delete your own admin account