Skip to main content
DELETE
/
v1
/
customers
/
{customerId}
Delete a customer
curl --request DELETE \
  --url https://api-eu.flexportal.io/v1/customers/{customerId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Tenant-ID: <tenant-id>'
{
  "success": true,
  "message": "<string>",
  "customerId": "<string>"
}

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

  1. Customer status changes to inactive
  2. Customer hidden from default list queries
  3. Historical orders and subscriptions preserved
  4. New orders cannot be created for this customer
  5. 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:
  1. No active subscriptions
  2. No pending orders
  3. 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:
DataStatus
Customer profilePreserved, marked inactive
Order historyPreserved
Subscription historyPreserved
Payment historyPreserved
AddressesPreserved
Soft deletion ensures data integrity for financial reporting, auditing, and compliance requirements.

Error Handling

Error CodeCauseSolution
NOT_FOUNDCustomer doesn’t existVerify customer ID
CUSTOMER_HAS_ACTIVE_SUBSCRIPTIONSCannot delete with active subscriptionsCancel subscriptions first
CUSTOMER_HAS_PENDING_ORDERSCannot delete with pending ordersComplete or cancel orders first

Authorizations

Authorization
string
header
required

API key obtained from FlexPortal dashboard

Headers

Tenant-ID
string
required

Your tenant identifier

Path Parameters

customerId
string
required

The customer ID

Response

Customer deleted

success
enum<boolean>
required
Available options:
true,
false
message
string
required
customerId
string
required