Skip to main content
Contact methods represent communication channels for clients, such as email addresses and phone numbers.

Contact Method Types

TypeDescription
emailEmail address
phonePhone number
faxFax number
otherOther contact type

Creating Contact Methods

// Create an email contact
const email = await sdk.contactMethods.create({
  clientId: "client_abc123",
  type: "email",
  value: "juan@example.com",
  label: "Personal",
  isPrimary: true,
});

// Create a phone contact
const phone = await sdk.contactMethods.create({
  clientId: "client_abc123",
  type: "phone",
  value: "+52 55 1234 5678",
  label: "Mobile",
  isPrimary: false,
});

Retrieving Contact Methods

// Get a specific contact method
const contact = await sdk.contactMethods.retrieve("contact_xyz789");

console.log(contact.type); // "email"
console.log(contact.value); // "juan@example.com"
console.log(contact.isPrimary); // true
Also available: retrieveByExternalId and retrieveByMetadata for custom identifiers or metadata lookups (see SDK reference).

Listing Contact Methods

List by Client

// Get all contact methods for a client
const { data: contacts } =
  await sdk.contactMethods.listByClient("client_abc123");

for (const contact of contacts) {
  console.log(`${contact.type}: ${contact.value}`);
}

Filter by Type

// Get only email contacts for a client
const { data: emails } = await sdk.contactMethods.list({
  filter: {
    clientId: "client_abc123",
    type: "email",
  },
});

Updating Contact Methods

// Update a contact method
const updated = await sdk.contactMethods.update("contact_xyz789", {
  value: "new.email@example.com",
  isPrimary: true,
});

Deleting Contact Methods

await sdk.contactMethods.delete("contact_xyz789");

Primary Contact

Each client can have one primary contact method per type:
// Get the primary email for a client
const primaryEmail = await sdk.contactMethods.getPrimary(
  "client_abc123",
  "email",
);

if (primaryEmail) {
  console.log(`Primary email: ${primaryEmail.value}`);
}

// Set a contact as primary
await sdk.contactMethods.update("contact_xyz789", {
  isPrimary: true,
});
Setting a contact method as primary automatically removes the primary flag from other contact methods of the same type for that client.

Contact Method Model Properties

PropertyTypeDescription
idstringUnique identifier
clientIdstringParent client ID
typeContactMethodTypeContact type
valuestringThe contact value
labelstring | undefinedOptional label
isPrimarybooleanWhether this is primary
isVerifiedbooleanWhether verified
createdAtDateCreation timestamp
updatedAtDateLast update timestamp

Batch Operations

// Create multiple contact methods
const result = await sdk.contactMethods.createMany([
  {
    clientId: "client_abc123",
    type: "email",
    value: "work@company.com",
    label: "Work",
  },
  {
    clientId: "client_abc123",
    type: "phone",
    value: "+52 55 9876 5432",
    label: "Work",
  },
]);
See Batch Operations for more details.