Skip to main content
DELETE
/
api
/
usuarios
/
{id}
Delete User
curl --request DELETE \
  --url https://api.example.com/api/usuarios/{id}
{
  "204": {},
  "401": {},
  "403": {},
  "404": {},
  "409": {}
}

Authentication

Required: Admin only This endpoint requires administrator privileges. Only users with the ADMIN role can delete users.

Path Parameters

id
long
required
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

204
No Content
User successfully deleted. No response body is returned.
401
Unauthorized
Missing or invalid authentication token
403
Forbidden
User does not have admin privileges. Only administrators can delete users.
404
Not Found
User with the specified ID does not exist
409
Conflict
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

  1. Audit Trail: Log all user deletion operations for security and compliance purposes
  2. Confirmation: Always implement a confirmation step in your application before calling this endpoint
  3. Data Retention: Check your data retention policies and legal requirements before deleting user accounts
  4. Related Data: Clean up or transfer any related data (orders, addresses, payment methods) before deletion
  5. Consider Deactivation: In most cases, deactivating a user account (activo: false) is preferable to permanent deletion

Build docs developers (and LLMs) love