Skip to main content
Internal documentation for developers. This page covers the Contacts API endpoints, bulk operations, merge detection, and the customer-360 data model. Not intended for end users.

Route Map


Auth Pattern

All queries must scope to req.session.organization.id.

Contact Object Schema


List Contacts (Filters)


Bulk Delete


Merge Candidates

The merge-candidates endpoint runs a fuzzy-match algorithm to identify potential duplicate contacts:
Merge strategy:
  • Primary contact keeps its ID
  • Secondary contact’s conversations are re-attributed
  • Secondary contact is deleted
  • No undo — warn users before merge

Customer-360 View

The individual contact page aggregates data from multiple sources:

Prisma Indexes Used


Known Issues / Gotchas

  • Bulk delete cascade: Deleting contacts deletes their conversations. This is a destructive operation. Always confirm with the user before calling.
  • Phone normalization: Phone numbers should be stored in E.164 format (+5511999990000). Inconsistent formats cause merge candidates to miss duplicates.
  • externalId is used for CRM sync (e.g., HubSpot, Salesforce). When syncing from external systems, always use upsert on organizationId + externalId.
  • Merge candidates uses application-level matching (not DB-level). For large contact lists (100k+), this can be slow. Consider adding a background job for large orgs.