# Notes API

> Notes and the records they belong to. Every route, its parameters and fields.

Notes and the records they belong to. 8 routes; send a bearer token with each (see [Authentication](/api/authentication.md)).

| Route | What it does |
| --- | --- |
| `GET /v1/notes` | List notes |
| `POST /v1/notes` | Create a note |
| `GET /v1/notes/{id}` | Get a note |
| `PATCH /v1/notes/{id}` | Update a note |
| `DELETE /v1/notes/{id}` | Delete a note (soft delete) |
| `POST /v1/notes/{id}/restore` | Restore a deleted note |
| `POST /v1/notes/{id}/links` | Link a note to a record |
| `DELETE /v1/notes/{id}/links/{type}/{recordId}` | Unlink a note from a record |

## List notes

`GET https://staging-api.naruskacrm.com/v1/notes`

Declared filters only (an unknown one is refused); `q` searches the name (accent- and case-insensitive); `sort` takes a declared field, `-` for descending. Pass `next_cursor` back as `cursor`.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `limit` | query | integer |  | 1–200, default `50` |
| `cursor` | query | string |  | next_cursor of the previous page. 1–400 characters |
| `owner` | query | `me` or string (uuid) |  |  |
| `contact_id` | query | string (uuid) |  |  |
| `account_id` | query | string (uuid) |  |  |
| `opportunity_id` | query | string (uuid) |  |  |
| `case_id` | query | string (uuid) |  |  |
| `q` | query | string |  | 1–200 characters |
| `sort` | query | `created_at`, `-created_at`, `updated_at`, `-updated_at` |  | Sort by created_at, updated_at; prefix "-" for descending. |
| `updated_since` | query | string (date-time) |  |  |
| `include_deleted` | query | `true`, `false` |  |  |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `data` | array of [Note](/api/reference/objects.md#note) | yes |  |
| `next_cursor` | string or null | yes |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Create a note

`POST https://staging-api.naruskacrm.com/v1/notes`

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `body` | string | yes | 1–100000 characters |
| `owner_user_id` | string (uuid) or null |  |  |
| `owner_team_id` | string (uuid) or null |  |  |
| `source_system` | string or null |  | 1–100 characters |
| `source_id` | string or null |  | 1–500 characters |
| `links` | object | yes |  |
| `links.contact_ids` | array of string (uuid) |  | at most 50 items |
| `links.account_ids` | array of string (uuid) |  | at most 50 items |
| `links.opportunity_ids` | array of string (uuid) |  | at most 50 items |
| `links.case_ids` | array of string (uuid) |  | at most 50 items |

### Response 201

Returns: [Note](/api/reference/objects.md#note).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Get a note

`GET https://staging-api.naruskacrm.com/v1/notes/{id}`

`include` adds `children` (emails, phones, addresses, affiliations, deal contacts, attendees), `tags` and `related` (the first 10 of each related list), so a record page loads in one request.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `include` | query | string |  | at most 100 characters |

### Response 200

| Field | Type | Always present | Notes |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes |  |
| `company_id` | string (uuid) | yes |  |
| `created_at` | string (date-time) | yes |  |
| `updated_at` | string (date-time) | yes |  |
| `created_by` | string (uuid) or null | yes |  |
| `updated_by` | string (uuid) or null | yes |  |
| `deleted_at` | string (date-time) or null | yes |  |
| `deleted_by` | string (uuid) or null | yes |  |
| `body` | string | yes |  |
| `owner_user_id` | string (uuid) or null | yes |  |
| `owner_team_id` | string (uuid) or null | yes |  |
| `source_system` | string or null | yes |  |
| `source_id` | string or null | yes |  |
| `contact_ids` | array of string (uuid) | yes |  |
| `account_ids` | array of string (uuid) | yes |  |
| `opportunity_ids` | array of string (uuid) | yes |  |
| `case_ids` | array of string (uuid) | yes |  |
| `children` | object |  |  |
| `tags` | array of [Tag](/api/reference/objects.md#tag) |  |  |
| `related` | object |  |  |

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Update a note

`PATCH https://staging-api.naruskacrm.com/v1/notes/{id}`

JSON merge patch: send only the fields to change. custom is merged per key; a null value removes a key.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `body` | string |  | 1–100000 characters |
| `owner_user_id` | string (uuid) or null |  |  |
| `owner_team_id` | string (uuid) or null |  |  |
| `source_system` | string or null |  | 1–100 characters |
| `source_id` | string or null |  | 1–500 characters |

### Response 200

Returns: [Note](/api/reference/objects.md#note).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Delete a note (soft delete)

`DELETE https://staging-api.naruskacrm.com/v1/notes/{id}`

Soft delete. Anyone who can edit the note may delete it; admins can restore it for 30 days.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Restore a deleted note

`POST https://staging-api.naruskacrm.com/v1/notes/{id}/restore`

Admins only. Children and links deleted with the record come back with it.

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Response 200

Returns: [Note](/api/reference/objects.md#note).

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Link a note to a record

`POST https://staging-api.naruskacrm.com/v1/notes/{id}/links`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |

### Request body

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| `type` | `contact`, `account`, `opportunity`, `case` | yes |  |
| `id` | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

## Unlink a note from a record

`DELETE https://staging-api.naruskacrm.com/v1/notes/{id}/links/{type}/{recordId}`

### Parameters

| Parameter | In | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| `id` | path | string (uuid) | yes |  |
| `type` | path | `contact`, `account`, `opportunity`, `case` | yes |  |
| `recordId` | path | string (uuid) | yes |  |

### Response 204

Done.
No body.

Errors are problem details with a stable `code`: see [Errors](/errors.md).

