DELETE
https://api.myidvirtual.com
/
customer
/
{userID}
curl -X DELETE "https://api.vpn.tv/customer/user123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"
{
  "success": true,
  "message": "Customer deleted successfully",
  "deletedAt": "2024-01-20T14:45:00.000Z"
}

Overview

This endpoint allows authorized users to permanently delete a customer account. This is a destructive operation that removes all customer data and cannot be undone. Use with extreme caution.
This operation permanently deletes the customer account and all associated data. This action cannot be undone.

Authentication

This endpoint requires JWT authentication. Include your bearer token in the Authorization header.

Authorization

Access is restricted to high-level roles:
  • ADMIN: Full deletion permissions
  • MASTER: Full deletion permissions
  • RESALE: Can delete customers under their management

Path Parameters

userID
string
required
The unique user ID of the customer to delete

Response

success
boolean
Indicates if the deletion was successful
message
string
Success or error message describing the operation result
deletedAt
string
Timestamp when the customer was deleted
curl -X DELETE "https://api.vpn.tv/customer/user123" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"
{
  "success": true,
  "message": "Customer deleted successfully",
  "deletedAt": "2024-01-20T14:45:00.000Z"
}

Error Handling

Status CodeDescriptionSolution
200SuccessCustomer deleted successfully
401UnauthorizedCheck your JWT token validity
403ForbiddenVerify your role permissions
404Not FoundVerify the user ID exists
409ConflictCustomer has active subscription or dependencies
500Internal Server ErrorContact support if persistent

Implementation Notes

Data Deletion Policy

  • Soft Delete: Customer records are marked as deleted but preserved for audit purposes
  • Hard Delete: Complete removal from database (admin-only in special cases)
  • Associated Data: Related transactions, logs, and subscriptions are handled according to retention policies

Cascade Operations

When a customer is deleted:
  • Active VPN sessions are terminated
  • Device connections are revoked
  • Email notifications may be sent

Audit Trail

All deletion operations are logged with:
  • Timestamp of deletion
  • User who performed the action

Security Considerations

  • Operation requires elevated permissions (ADMIN/MASTER/RESALE)
  • All deletion attempts are logged for security auditing

Best Practices

Before Deletion

  1. Backup Customer Data: Export important customer information
  2. Check Dependencies: Verify no active subscriptions or transactions
  3. Notify Customer: Send deletion notification if required by policy
  4. Document Reason: Record why the deletion is necessary

Error Recovery

  • If permission errors occur, verify user role and scope
  • For database conflicts, check for foreign key constraints