GraphQL
- Introduction
- Authentication
- Schema
- Customers
- Companies
- Tenants
- Threads
- Tiers
- Events
- Labels
- Messaging
- Pagination
- Error handling
- Error codes
- API Explorer
- Typescript SDK
Reference
- Customer cards
- Webhooks
- UI Components
- Attachments
Tenants
Add customers to tenants
You can add a customer to multiple tenants.
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:create
Copy
Ask AI
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.addCustomerToTenants({
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);
}
Copy
Ask AI
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.addCustomerToTenants({
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);
}
Mutation
Copy
Ask AI
mutation addCustomerToTenants($input: AddCustomerToTenantsInput!) {
addCustomerToTenants(input: $input) {
error {
message
type
code
fields {
field
message
type
}
}
}
}
Variables
Copy
Ask AI
{
"input": {
"customerIdentifier": {
"emailAddress": "jane@aol.com"
},
"tenantIdentifiers": [
{
"externalId": "team_123"
},
{
"externalId": "team_456"
}
]
}
}
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.