ποΈ 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!