Documentation Index
Fetch the complete documentation index at: https://docs.flexportal.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Deactivate a customer by marking them as inactive. This is a soft delete—the customer record is preserved for historical data integrity but hidden from active customer lists.
Customers with active subscriptions cannot be deleted. Cancel or complete all subscriptions first.
What Happens When You Delete a Customer
- Customer status changes to
inactive
- Customer hidden from default list queries
- Historical orders and subscriptions preserved
- New orders cannot be created for this customer
- Reporting data remains intact
Common Use Cases
- Data Cleanup: Remove test customers or duplicate records
- Account Closure: Customer requested account deletion
- Compliance: Remove inactive customers per data retention policies
- Fraud Prevention: Disable accounts flagged for suspicious activity
Prerequisites
Before deleting a customer, ensure:
- No active subscriptions
- No pending orders
- All devices returned (if applicable)
async function canDeleteCustomer(customerId) {
const customer = await getCustomer(customerId);
// Check for active subscriptions
if (customer.profitability.activeDevices > 0) {
console.log('Cannot delete: Customer has active subscriptions');
return false;
}
// Check for pending orders
const { orders } = await listOrders({
customerId,
status: 'pending'
});
if (orders.length > 0) {
console.log('Cannot delete: Customer has pending orders');
return false;
}
return true;
}
Reactivating a Customer
To reactivate a deleted customer, use Update Customer:
PUT /v1/customers/{customerId}
{
"status": "active"
}
Data Retention
After deletion:
| Data | Status |
|---|
| Customer profile | Preserved, marked inactive |
| Order history | Preserved |
| Subscription history | Preserved |
| Payment history | Preserved |
| Addresses | Preserved |
Soft deletion ensures data integrity for financial reporting, auditing, and compliance requirements.
Error Handling
| Error Code | Cause | Solution |
|---|
NOT_FOUND | Customer doesn’t exist | Verify customer ID |
CUSTOMER_HAS_ACTIVE_SUBSCRIPTIONS | Cannot delete with active subscriptions | Cancel subscriptions first |
CUSTOMER_HAS_PENDING_ORDERS | Cannot delete with pending orders | Complete or cancel orders first |
API key obtained from FlexPortal dashboard