You can delete customers with the deleteCustomer API, you will find this name in both our API and our SDKs.

To delete a customer you will need the customer’s ID from within Plain. You can get this ID in the UI by going to a thread from that customer and pressing the ‘Copy ID’ button from the customer details panel on the right, or via our fetch API.

Deleting a customer will trigger an asynchronous process which causes all data (such as threads) associated with that customer to be deleted.

This operation requires the following permissions:

  • customer:delete
import { PlainClient } from '@team-plain/typescript-sdk';

const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });

const res = await client.deleteCustomer({
  customerId: 'c_01H1P4TE62AS5KZ4CZFC0578ED',
});

if (res.error) {
  console.error(res.error);
} else {
  // Success
}