Plain automatically derives a customer’s company for you, but you can also update it manually.

The customer in question is identified by their id (ie c_...).

With regards to the company, you can either specify an existing company using the ID we’ve generated (ie co_...), or pass the company domain, which we’ll use to derive the rest of the company’s info.

If you wish to only remove the customer’s associated company, then you can pass null as the companyIdentifier.

For this mutation you need the following permissions:

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

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

const res = await client.updateCustomerCompany({
  customerId: 'c_01H14DFQ4PDYBH398J1E99TWSS',
  companyIdentifier: {
    companyDomainName: 'nike.com',
  },
});

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