Skip to content
v1

Guides CRM writes and notes

CRM writes and notes

Import and update CRM leads, record opt-outs, archive leads and synchronize notes with explicit permissions, conditional versions and safe retries.

Version 1.0b adds CRM writes without changing existing read-only keys. Create a new CRM write integration in Settings → Developers. It receives crm:write alongside the ordinary read permissions. Reading note contents requires the separate CRM note content acknowledgement and crm:notes:read; writing a note does not grant access to its contents or other notes.

This page describes the coordinated release contract. Deployment and publication of a client package are separate release steps; check the changelog and your installed version before relying on a new operation.

CRM write operations

OperationPurposeConditional version
POST /v1/leadsCreate or resolve by identityIdempotency-Key required
PATCH /v1/leads/{id}Update allowlisted CRM fieldsLead If-Match required
POST /v1/leads/{id}/notesCreate a CRM noteStable idempotency key recommended
PATCH /v1/leads/{id}/notes/{note}Edit a CRM noteNote If-Match required
DELETE /v1/leads/{id}/notes/{note}Delete a CRM noteNote If-Match required
POST /v1/leads/{id}/archiveArchive without deleting the leadLead If-Match required

The generated reference and OpenAPI define the available operations. Calls, messages, bookings, assistant settings and key management are not writable through these CRM routes.

Import first; change existing data conditionally

origin is required on intake. Use import when copying a CRM or historical list. An import does not arm Totem outreach, including on an automated stage. It does not record supplied consent as permission to contact. Moving stages, patching contact details or creating a note also cannot be used to start outreach.

cURL
curl https://api.totemstudio.ai/v1/leads \
  -H "Authorization: Bearer $TOTEM_API_KEY" \
  -H "Totem-Team: $TOTEM_TEAM_ID" \
  -H "Idempotency-Key: import-example-contact-001" \
  -H "Content-Type: application/json" \
  -d '{"origin":"import","email":"alex.rivera@example.com","external_id":"crm-contact-001"}'

Intake resolves the integration's external_id, phone and email without silently merging conflicting identities. An external id alone must already resolve; a new record needs a phone or email. The external id belongs to your integration and team, not another integration's namespace. Phone values are E.164.

An existing human-entered identity value remains authoritative: upsert only fills missing identity fields or a placeholder name. It does not replace an existing pipeline, tag set, priority, value or assignments. To change those, first resolve the lead, then send PATCH with its current ETag. Use board and stage, not board_id or stage_id. Unsupported fields are rejected. validate_only: true validates intake without applying data, creating a receipt or contacting anyone.

Lead writes return object: "lead_mutation", the current lead, created and, on intake, outreach. Validation returns {"object":"lead_validation","valid":true}. Archiving requires a documented reason; it retains the lead. A birthday can be set or cleared with the patch field date_of_birth (YYYY-MM-DD or null); birthday automation settings are not API controls.

Strong versions and conflicts

Read the current ETag response header. A lead ETag has the quoted form "lead_…:7"; a note ETag is "note_…:2". Send that exact value as If-Match for conditional operations. A validator belongs to one resource: a lead ETag cannot authorize a note edit. Weak validators, wildcard validators and lists are not accepted.

If another writer changed the resource, 412 version_conflict leaves your change unapplied. Fetch and review the current resource, resolve the conflict, then make a new logical request with its new ETag. Do not automatically overwrite the newer state. A missing required validator returns 428 precondition_required.

Phone or email changes apply the product's contact-change hold so old queued callbacks or outreach cannot contact the wrong recipient. CRM operations preserve existing stronger holds, opt-outs, human-attention and service-recovery controls.

Retry one logical write safely

Persist one Idempotency-Key for a logical write, and reuse it for retries, including retries after your process restarts. Keep the same method, path, selected team, JSON body and original If-Match. Changing any of those under a reused key is rejected. Use a fresh key for a genuinely new action, not for an uncertain retry.

Receipts are retained for 48 hours and store a fingerprint and resource reference, without request bodies, note text or saved response bodies. Replay is checked before a fresh version comparison. A successful replay rereads the current resource and returns Idempotent-Replayed: true; it does not repeat stale personal data. An erased resource is not resurrected. Note deletion returns 204 with no JSON body, including a valid repeated deletion.

After outcome_unknown, reconcile using the original request/key or the current resource before starting another action. A timeout does not prove that nothing happened. Do not reuse a receipt beyond the retention window as an exactly-once guarantee.

Record opt-outs

With crm:write, patch do_not_contact: true for an all-channel restriction or email_opt_out: true for email. These fields accept true only. The API cannot clear a refusal or fabricate re-consent. A board/stage change, import or inbound event does not remove an existing restriction. Apply the same restrictions to every downstream copy before contacting anyone.

Inbound intake is separately authorized

origin: "inbound" is for an actual inbound event with a phone supplied by the person. The integration administrator must explicitly enable inbound intake. crm:write alone is insufficient. An inbound event is not WhatsApp consent: provide the person's explicit choice and its capture time, method and notice reference when needed.

Outreach eligibility is limited to the team's recorded default country and valid internationally diallable mobile, fixed-line or fixed-line-or-mobile numbers. An organization-and-phone fence permits at most one newly armed intake per rolling seven days; each principal can arm at most 500 per UTC day. Team policy, route/stage configuration, holds and consent still apply. If these guards cannot be checked, outreach is withheld. outreach.status: "eligible" means admitted under the normal product rules, not that a call or message was delivered.

Notes are an explicit content capability

GET /v1/leads/{id}/notes returns cursor-paged note contents only with crm:notes:read, an explicit content grant and the team's completed note backfill. Existing read-only keys never acquire that capability automatically. Until preparation finishes, keep your copy/cursor and retry capture_not_ready; do not treat a partial snapshot as a deletion.

Create/edit note bodies contain 1–20000 characters. Existing reads can contain up to 50000 characters, including historical empty text. Write receipts contain object: "lead_note_receipt" and note metadata only, including the note id and version; they omit the body and other notes. Note external ids are scoped to the integration, team and parent lead.

The changes feed includes kind: "lead_note" only for authorized content readers. Notes have independent versions. Deleting one leaves a tombstone; deleting or erasing its parent lead removes associated exports. Persist the note-to-lead association while applying records, because a removal contains its kind/id/version and reason rather than private parent details. Recreated leads and notes do not inherit an old incarnation's identity or external-id binding.

Use the TypeScript SDK or n8n node with the same ordinary integration key. Neither client can broaden its permissions or bypass contact protections.

API version 1.0.0