# Delete user Soft delete a user account. Sets deletion flags while preserving data for audit purposes. Performs a soft delete on a user account by setting `is_deleted` and `is_active` flags. The user will no longer appear in active user lists, but their data is preserved for audit and compliance purposes. **Access Control:** Users can only delete their own account. Attempting to delete another user's account will result in a 403 error. #### Path Parameters **`user_id`** string required The unique identifier of the user to delete. Must match the authenticated user's ID. ## Returns Returns a JSON response indicating success or failure. Request ```bash curl -X DELETE "https://api.aitronos.com/v1/user/usr_abc123" \ -H "X-API-Key: $FREDDY_API_KEY" ``` ```python import os import requests user_id = "usr_abc123" api_key = os.environ["FREDDY_API_KEY"] response = requests.delete( f"https://api.aitronos.com/v1/user/{user_id}", headers={"X-API-Key": api_key} ) result = response.json() print(result) ``` ```javascript const userId = 'usr_abc123'; const apiKey = process.env.FREDDY_API_KEY; const response = await fetch(`https://api.aitronos.com/v1/user/${userId}`, { method: 'DELETE', headers: { 'X-API-Key': apiKey } }); const result = await response.json(); console.log(result); ``` 200 OK ```json { "success": true, "message": "User account deleted successfully", "user_id": "usr_abc123" } ``` 403 Forbidden ```json { "success": false, "error": { "code": "INSUFFICIENT_PERMISSIONS", "message": "You can only delete your own account.", "system_message": "You can only delete your own account.", "type": "authorization_error", "status": 403, "details": {}, "trace_id": "req_abc123xyz", "timestamp": "2025-12-22T15:30:00Z" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "USER_NOT_FOUND", "message": "User not found.", "system_message": "User not found.", "type": "client_error", "status": 404, "details": {}, "trace_id": "req_abc123xyz", "timestamp": "2025-12-22T15:30:00Z" } } ``` ## Related Resources - [Get Profile](/docs/api-reference/users/get-profile)