πŸ—‘οΈ DELETE /delete

Deletes a user account and its associated data file. Requires a valid user_id parameter. Returns success message or appropriate error if the user doesn’t exist or deletion fails.


πŸ“Œ Summary

Method: DELETE URL: /delete Auth: Not Required Tag: accounts β€”

πŸ” Headers

Authorization: Bearer <your-token>
Content-Type: application/json

πŸ“€ Request Parameters

Name Type Required Description
user_id string βœ… Unique ID of the user to be deleted

πŸ“₯ Example Request (Query Parameter)

DELETE /delete?user_id=4a76343a-e971-4bd7-b8c4-5fa9fccee433

πŸ“€ Success Response

{
  "success": true,
  "status": 200,
  "message": "Account for user_id '4a76343a-e971-4bd7-b8c4-5fa9fccee433' deleted successfully.",
  "start_time": "2025-07-17T08:34:02.123Z",
  "end_time": "2025-07-17T08:34:02.160Z",
  "execution_time": 0.037
}

❌ Failure Response Examples

Status Reason
400 Missing required user_id
404 Account for given user_id not found
500 Internal server error during deletion
{
  "success": false,
  "status": 404,
  "error": "Account for user_id 'xyz' does not exist.",
  "start_time": "2025-07-17T08:34:02.123Z",
  "end_time": "2025-07-17T08:34:02.150Z",
  "execution_time": 0.027
}

🧠 Notes

  • The user ID is used to identify the user’s account file (e.g., account_tree.Rds) in persistent storage.
  • The operation is wrapped in a file lock to ensure safe concurrent access.
  • No JWT token required, but the endpoint is still protected by rate limiting and exponential backoff to prevent abuse.
  • This is a destructive operation and should be called with caution.

πŸ’– Sponsors

Support my work through GitHub Sponsors!

GitHub Sponsors