Stitch an anonymous session into a known contact
Declare that a tracked-anonymous session (an SDK anonymous_id: a visitor who arrived on your web / messaging widget, then popped up elsewhere as a bare session id) IS a known person you can name (your own external_id, your system’s stable key). Both sides are resolved against live contact rows. If both resolve to the same person the call is a no-op; if only the anonymous side resolves, its contact is re-keyed to your id (linked); if both resolve as distinct people, the anonymous session’s contact is folded into the known one with the standard merge cascade across messaging threads, voice calls, video participants, CDP events, and consent (merged). Phone- or email-shaped known_id values are refused with a 200 { outcome: "refused" } — route those through the ingest identify with an explicit trait so a mistyped number can never collapse one person’s record into another’s. Idempotent: re-POSTing the same pair after a stitch returns noop. Every outcome writes one consolidated cdp.identity_stitched audit entry naming both ids. Requires the contacts:write scope, owner / admin / developer role. Rate-limited to 10 calls per minute per tenant.
Body
The anonymous session id and the known identity to bind it to.
The anonymous session id and the known identity to bind it to.
The SDK anonymous_id — the anonymous handle from your web SDK (e.g. anon_01h2x8…).
1 - 200Your known identity for the person — your own stable external_id (e.g. crm-44882). Phone- or email-shaped values are refused; route those through identify.
1 - 200Response
The stitch outcome. outcome is one of merged (both sides resolved as distinct contacts and the anonymous one was folded in), linked (only the anonymous side resolved; its contact was re-keyed), noop (already stitched / nothing to resolve — see reason), refused (phone/email-shaped known_id), or error (retry-safe — re-POST the same pair).
The stitch outcome. outcome is one of merged (both sides resolved as distinct contacts and the anonymous one was folded in), linked (only the anonymous side resolved; its contact was re-keyed), noop (already stitched / nothing to resolve — see reason), refused (phone/email-shaped known_id), or error (retry-safe — re-POST the same pair).