Contact and company relationship notes
Append and retrieve durable CRM notes through the same API, chat, MCP, and CLI surfaces.
Keep relationship facts in CRM notes: preferred contact times, the last agreed next step, or a company's decision process. Keep campaign strategy and writing instructions in the deployment's strategy files. Notes are data about a person or company, not authority to change an agent's instructions or send messages.
Notes are internal. Adding one never sends email or schedules a campaign. Corrections are additional notes, preserving the previous record and its author. This API exposes append and read operations, with no edit or deletion operation.
Choose the relationship
A note targets exactly one of:
- An existing contact's
contactIdfrom the contacts registry. - A
companyDomain, such asacme.com, using Tinbox's existing company grouping.
Company grouping is by exact normalized domain, not a separate legal-company
record. acme.com and subsidiary.acme.com remain separate. Use a domain without
https://, a path, or @; it is trimmed and lowercased. Shared consumer mailbox
domains such as gmail.com are rejected because their users are not one company.
A company note can exist before a contact or conversation for that company.
Contact notes follow the surviving contact when duplicate contacts are merged.
Missing or quarantined contacts cannot receive new notes or be read through the
notes API.
Append a note
const result = await tinbox.api.contacts.addNote.mutate({
target: { contactId: "con_jane" },
body: "Prefers a call after 10am. Ask about the autumn team event.",
idempotencyKey: "jane-autumn-call-2026-11-23",
provenance: { surface: "sdk", asAgent: true },
});
Or save a company-level fact:
await tinbox.api.contacts.addNote.mutate({
target: { companyDomain: "acme.com" },
body: "HR coordinates workplace wellness. Confirm the office location before quoting.",
idempotencyKey: "acme-office-followup-2026-11-23",
});
body is required, trimmed, and limited to 4,000 characters. The response is
{ note, created }. A note records the authenticated principal as actorId,
its actor type, server timestamp, and optional surface, agent, conversation,
and tool-call provenance. Clients cannot choose a different author id.
Use a unique idempotencyKey for each new note. Retrying the same target and
body with the same key returns the original note with created: false.
Reusing a key with different text or a different target returns CONFLICT.
Keys are isolated per authenticated principal. A correction needs a new key.
Read notes and follow pagination
const page = await tinbox.api.contacts.notes.query({
target: { companyDomain: "acme.com" },
limit: 20,
});
const next = page.nextCursor
? await tinbox.api.contacts.notes.query({
target: { companyDomain: "acme.com" },
cursor: page.nextCursor,
limit: 20,
})
: null;
The response is { notes, nextCursor }, newest first. The cursor contains
createdAt and id, so notes written at the same timestamp are not skipped or
repeated. API pages default to 20 notes and allow up to 100. nextCursor: null
means the history is exhausted.
The shared list_crm_notes tool defaults to one full note per page to keep
agent context bounded. It accepts the returned cursor object, or its JSON text
for CLI use. If requesting multiple notes causes model-context truncation,
repeat the same cursor with limit: 1 before following the next cursor.
Chat, MCP, and CLI
Use add_crm_note and list_crm_notes in chat or MCP. Choose either contactId
or companyDomain. Chat/MCP derive a retry key from the tool call when one is
not supplied. The generated CLI requires an explicit key for appends:
tinbox add-crm-note --contactId con_jane \
--body "Prefers a call after 10am." \
--idempotencyKey jane-call-preference-1 --json
tinbox list-crm-notes --companyDomain acme.com --limit 1 --json
tinbox list-crm-notes --companyDomain acme.com \
--cursor '{"createdAt":1795440000000,"id":"cno_example"}' --json
Reuse the key when retrying the same CLI append. A different note needs a new key. These commands use the same permission-gated tRPC API as chat and MCP.
Delegate CRM editing without campaign sending
Reading follows the tenant-wide contact directory's membership boundary and
requires a read-capable token scope. Token writes additionally require a
write-class scope (write, admin, or *) and the explicit tenant-wide
contacts:write capability. An inbox-admin user can also edit CRM data.
An organization admin grants the capability to the token's key id through the
existing admin API:
await admin.api.capabilities.grant.mutate({
principal: "key_crm_agent",
capability: "contacts:write",
});
The token also needs existing inbox/member access; the capability alone does not create membership. A send-only or read-only key cannot append notes. Tokens cannot grant this permission to themselves.
contacts:write also permits ordinary contacts.upsert and contacts.update
without requiring newsletter:send. Existing newsletter-authorized callers
retain compatibility for those two operations. Merge, delete, import, audience
operations, and campaign dispatch retain their own existing gates. A CRM-editing
token does not gain campaign-sending authority.
Deploy the engine migration and updated worker before calling these endpoints on an existing deployment. Local tests do not establish live key permissions.