# Contact notes

`crm.contactNotes` — `/v1/audience/contacts/:contactId/notes`

Internal notes on a contact: free text, attachments, and team members mentioned
in them. Notes are never shown to the contact.

> **Not mounted yet.** These routes are commented out in the audience service's
> `routes.ts`, so they answer `404` until that line is restored. The contract,
> the service and this client are complete; only the mount is missing.

Every method takes the contact id first — notes are addressed under their
contact, and a note id belonging to another contact is a `404` rather than a
match.

| Action | Route | Scope |
| --- | --- | --- |
| [`list`](#list) | `GET /v1/audience/contacts/:contactId/notes` | `contacts:read` |
| [`get`](#get) | `GET /v1/audience/contacts/:contactId/notes/:noteId` | `contacts:read` |
| [`create`](#create) | `POST /v1/audience/contacts/:contactId/notes` | `contacts:write` |
| [`update`](#update) | `PATCH /v1/audience/contacts/:contactId/notes/:noteId` | `contacts:write` |
| [`delete`](#delete) | `DELETE /v1/audience/contacts/:contactId/notes/:noteId` | `contacts:write` |

## The note object

```ts
interface ContactNote {
  id: string;
  contact: string;                       // the contact it hangs off
  note: string;
  attachments: ContactNoteAttachment[];
  mentions: string[];                    // team member ids
  createdAt: string;
  updatedAt: string;
}

interface ContactNoteAttachment {
  url: string;          // required
  type?: string;
  size?: string;
  mime?: string;
  file_name?: string;
}
```

---

## list

```ts
crm.contactNotes.list(contactId: string, query?: Partial<ListContactNotesQuery>): Promise<Page<ContactNote>>
```

`GET /v1/audience/contacts/:contactId/notes` · `contacts:read` · **200**

**Cursor paginated**, not offset — notes are appended constantly, and an offset
would shift under a caller mid-walk.

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `limit` | number | `50` | 1–100. |
| `cursor` | string | — | From the previous response's `nextCursor`. |

```ts
let cursor: string | null = null;
do {
  const page = await crm.contactNotes.list(contactId, { limit: 25, cursor: cursor ?? undefined });
  for (const note of page.data) render(note);
  cursor = page.nextCursor;
} while (cursor);
```

---

## get

```ts
crm.contactNotes.get(contactId: string, noteId: string): Promise<ContactNote>
```

`GET /v1/audience/contacts/:contactId/notes/:noteId` · `contacts:read` · **200**

---

## create

```ts
crm.contactNotes.create(contactId: string, input: CreateContactNoteInput): Promise<ContactNote>
```

`POST /v1/audience/contacts/:contactId/notes` · `contacts:write` · **201**

| Field | Type | Required | Default | Notes |
| --- | --- | --- | --- | --- |
| `note` | string | yes | — | 1–5000 chars. |
| `attachments` | `ContactNoteAttachment[]` | no | `[]` | `url` is the only required key on each. |
| `mentions` | ObjectId[] | no | `[]` | Team member ids. |

```ts
await crm.contactNotes.create(contactId, {
  note: 'Called back — wants a demo on Friday.',
  mentions: [teamMemberId],
});
```

---

## update

```ts
crm.contactNotes.update(contactId: string, noteId: string, input: UpdateContactNoteInput): Promise<ContactNote>
```

`PATCH /v1/audience/contacts/:contactId/notes/:noteId` · `contacts:write` · **200**

Same fields as `create`, all optional. `attachments` and `mentions` **replace**
their stored value rather than appending to it.

---

## delete

```ts
crm.contactNotes.delete(contactId: string, noteId: string): Promise<void>
```

`DELETE /v1/audience/contacts/:contactId/notes/:noteId` · `contacts:write` · **204**, no body.

Destroying a contact (the second `crm.contacts.delete`) removes its notes too.
