You can remove customers from multiple tenants in one API call.

When selecting the customer you can chose how to identify them. You can use the customer’s email, externalId or id.

For this mutation you need the following permissions:

  • customer:edit
  • customerTenantMembership:delete
const res = await client.removeCustomerFromTenants({
  customerIdentifier: {
    // You can use the customer email
    emailAddress: 'jane@aol.com',

    // ... or Plain's customer ID
    // customerId: 'c_123',

    // ... or the customer's external ID if you have set it
    // externalId: 'XXX',
  },
  tenantIdentifiers: [
    {
      externalId: 'team_123',
    },
    {
      externalId: 'team_456',
    },
  ],
});

if (res.error) {
  console.error(res.error);
} else {
  console.log(res.data);
}