# Notepads

Manage rich-text notepads organized in folders. Supports markdown input, iterative editing (append/prepend/section patches), per-record visibility, and ACL-based access control for restricted notes.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /notepads

List all notepads. Supports filters for folder_id, folder (legacy name), visibility, is_favorite, and title search.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads.md)

### GET /notepads/:id

Retrieve a notepad including full content and visibility.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads-id.md)

### POST /notepads

Create a notepad. Content accepts plain text or markdown (auto-converted to rich editor format) or a { html, tiptapJson } object. Defaults to visibility="all_users" -- pass "restricted" to restrict access. For "restricted" notes, add ACL entries via POST /notepads/:id/acl. Pass customer_id or contact_id to automatically link the notepad to a Company or Contact page (appends its ID to that entity's notepads array). folder_id and folder string are synced bidirectionally -- set either one and the other is auto-populated. Response is slim by default (id, title, folder, folder_id, visibility, is_favorite, timestamps) -- pass return_content: true to receive the full rendered HTML.

**Scopes:** `notepads:write` — [full detail](./notepads/post-notepads.md)

### PATCH /notepads/:id

Update a notepad. Three editing modes: (1) replace (default) -- pass content to overwrite; (2) append/prepend -- set mode plus content to grow the document without re-sending existing text; (3) patches -- pass a patches array to replace or append to specific sections by heading text. Can also update visibility or folder_id. Response is slim by default -- pass return_content: true for full HTML.

**Scopes:** `notepads:write` — [full detail](./notepads/patch-notepads-id.md)

### DELETE /notepads/:id

Delete a notepad.

**Scopes:** `notepads:delete` — [full detail](./notepads/delete-notepads-id.md)

### GET /notepads/folders

List notepad folders. Each folder has id, name, parent_id, visibility, created_by, and timestamps.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads-folders.md)

### POST /notepads/folders

Create a notepad folder.

**Scopes:** `notepads:write` — [full detail](./notepads/post-notepads-folders.md)

### GET /notepads/folders/:id

Get a single notepad folder by ID.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads-folders-id.md)

### PATCH /notepads/folders/:id

Update a notepad folder -- rename, re-parent, or change visibility.

**Scopes:** `notepads:write` — [full detail](./notepads/patch-notepads-folders-id.md)

### DELETE /notepads/folders/:id

Delete a notepad folder. Notepads inside are unfiled (folder_id cleared) -- not deleted.

**Scopes:** `notepads:delete` — [full detail](./notepads/delete-notepads-folders-id.md)

### GET /notepads/:id/acl

List ACL entries for a restricted notepad. Returns user_id and role_name grants.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads-id-acl.md)

### POST /notepads/:id/acl

Grant a user or role access to a restricted notepad. Set visibility to "restricted" first, then add ACL entries.

**Scopes:** `notepads:write` — [full detail](./notepads/post-notepads-id-acl.md)

### GET /notepads/folders/:id/acl

List ACL entries for a restricted notepad folder.

**Scopes:** `notepads:read` — [full detail](./notepads/get-notepads-folders-id-acl.md)

### POST /notepads/folders/:id/acl

Grant a user or role access to a restricted notepad folder.

**Scopes:** `notepads:write` — [full detail](./notepads/post-notepads-folders-id-acl.md)

### DELETE /notepads/acl/:id

Revoke an ACL entry by its ID. Works for both notepad and folder ACL entries.

**Scopes:** `notepads:write` — [full detail](./notepads/delete-notepads-acl-id.md)
