Authentication
Required: Admin only
This endpoint requires administrator privileges. Only users with the ADMIN role can delete users.
Path Parameters
The unique identifier of the user to delete
Request
curl -X DELETE https://api.iquea.com/api/usuarios/1 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Response
This endpoint returns no content on success.
Status Codes
User successfully deleted. No response body is returned.
Missing or invalid authentication token
User does not have admin privileges. Only administrators can delete users.
User with the specified ID does not exist
User cannot be deleted due to existing dependencies (e.g., active orders, pending transactions)
Security Notes
Permanent Action: Deleting a user is a permanent action and cannot be undone. All user data will be removed from the system.
Admin Only: This endpoint is restricted to administrators only. Regular users cannot delete their own accounts or other user accounts.
Data Dependencies: Before deleting a user, ensure that any associated data (orders, reviews, shopping cart items, etc.) is properly handled. The system may prevent deletion if there are active dependencies.
Soft Delete Alternative: Consider setting the activo field to false using the Update User endpoint instead of permanently deleting the user. This allows you to deactivate accounts while preserving historical data.
Best Practices
- Audit Trail: Log all user deletion operations for security and compliance purposes
- Confirmation: Always implement a confirmation step in your application before calling this endpoint
- Data Retention: Check your data retention policies and legal requirements before deleting user accounts
- Related Data: Clean up or transfer any related data (orders, addresses, payment methods) before deletion
- Consider Deactivation: In most cases, deactivating a user account (
activo: false) is preferable to permanent deletion