Tenants
Set customer tenants
You can also set all tenants for a customer. Unlike the more specific add or remove mutations this is useful if you are sycing tenants and customers with Plain.
For this mutation you need the following permissions:
customer:edit
customerTenantMembership:create
customerTenantMembership:delete
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.setCustomerTenants({
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);
}
Was this page helpful?