Skip to main content
DELETE
/
users
/
:id
Delete User
curl --request DELETE \
  --url https://api.example.com/users/:id
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

id
integer
required
The id_user of the user to delete

Request

No request body required.
cURL Example
curl -X DELETE https://api.marsai.com/users/1 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Response

Success Response

204 No Content
{
  "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

401 Unauthorized
{
  "error": "Token invalide ou manquant"
}
403 Forbidden
{
  "error": "Accès interdit. Rôle ADMIN requis."
}
404 Not Found
{
  "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