# Notes

Source: https://docs.arcweave.com/rest-api/notes
Section: REST API
Description: REST API endpoints for notes

Note endpoints create, retrieve, update, and delete notes placed on project boards.

## Endpoints

Context: Arcweave docs > REST API > Notes > Endpoints

### Create note

Context: Arcweave docs > REST API > Notes > Endpoints > Create note

`POST /api/v1/{hash}/note`

**Request**

```http title="HTTP"
POST /api/v1/{hash}/note
```

```bash title="curl"
curl --request POST \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data @payload.json \
  "https://arcweave.com/api/v1/PROJECT_HASH/note"
```

```json
{
  "boardId": "b1",
  "x": 200,
  "y": 300,
  "content": "<p>Remember to revisit this scene.</p>"
}
```

Request fields:

| Property     | Required | Type                          | Description                                                                        |
| ------------ | -------- | ----------------------------- | ---------------------------------------------------------------------------------- |
| `boardId`    | Yes      | String                        | Board that will contain the note.                                                  |
| `x`          | Yes      | Number                        | Horizontal board coordinate.                                                       |
| `y`          | Yes      | Number                        | Vertical board coordinate.                                                         |
| `content`    | No       | String or `null`              | Note content. Defaults to `null`.                                                  |
| `theme`      | No       | String                        | One of the [color themes](https://docs.arcweave.com/rest-api/overview#color-themes). Defaults to `default`. |
| `autoHeight` | No       | Boolean                       | Automatic-height setting. Defaults to `true`.                                      |
| `width`      | No       | Number                        | Note width. Defaults to `301`.                                                     |
| `height`     | No       | Number                        | Note height. Defaults to `101`.                                                    |
| `index`      | No       | Non-negative integer or `"-"` | Position within the board's note list. Defaults to `"-"`, which appends the note.  |

`boardId` must identify a regular board, not a folder. The note must fit inside the `40000` by `40000` board canvas. `width` and `height` must each be between `0` and `40000`; `x` must be between `0` and `40000 - width`, and `y` must be between `0` and `40000 - height`.

`content` accepts a string or `null`. Note content is not localized, so locale maps are rejected. Provide it as [valid rich text HTML](https://docs.arcweave.com/rest-api/rich-text#supported-html); notes do not support blockquotes or code blocks. The server generates the note ID.

**Response**

Returns `201 Created` with the generated resource ID and project version data:

```json
{
  "version": 12,
  "newVersion": 13,
  "versionTime": ["1720788000", "123456"],
  "id": "65139ea3-331f-4b25-88b4-ea7a65ff106c"
}
```

### Get note

Context: Arcweave docs > REST API > Notes > Endpoints > Get note

`GET /api/v1/{hash}/note/{noteID}`

**Request**

```http title="HTTP"
GET /api/v1/{hash}/note/{noteID}
```

```bash title="curl"
curl --request GET \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  "https://arcweave.com/api/v1/PROJECT_HASH/note/{noteID}"
```

**Response**

Returns `200 OK`.

```json
{
  "id": "n1",
  "boardId": "b1",
  "x": 3100,
  "y": 2200,
  "width": 50,
  "height": 100,
  "theme": "cyan",
  "content": "<p>Testing note</p>"
}
```

### Update note

Context: Arcweave docs > REST API > Notes > Endpoints > Update note

`PATCH /api/v1/{hash}/note/{noteID}`

**Request**

```http title="HTTP"
PATCH /api/v1/{hash}/note/{noteID}
```

```bash title="curl"
curl --request PATCH \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data @payload.json \
  "https://arcweave.com/api/v1/PROJECT_HASH/note/{noteID}"
```

```json
{
  "x": 240,
  "content": "<p>Updated note content</p>"
}
```

Request fields:

| Property     | Required | Type             | Description                                                                                 |
| ------------ | -------- | ---------------- | ------------------------------------------------------------------------------------------- |
| `content`    | No       | String or `null` | Updated HTML content. If omitted, the current value is retained.                            |
| `theme`      | No       | String           | One of the [color themes](https://docs.arcweave.com/rest-api/overview#color-themes). Omit to keep the current theme. |
| `autoHeight` | No       | Boolean          | Updated automatic-height setting. If omitted, the current value is retained.                |
| `x`          | No       | Number           | Updated horizontal coordinate. If omitted, the current value is retained.                   |
| `y`          | No       | Number           | Updated vertical coordinate. If omitted, the current value is retained.                     |
| `width`      | No       | Number           | Updated width. If omitted, the current value is retained.                                   |
| `height`     | No       | Number           | Updated height. If omitted, the current value is retained.                                  |

Supported fields are `content`, `theme`, `autoHeight`, `x`, `y`, `width`, and `height`.

Geometry updates must keep the complete note inside the `40000` by `40000` board canvas. The server uses the note's current geometry for fields omitted from the request.

The [content rules](https://docs.arcweave.com/rest-api/notes#create-note) for creating notes also apply to updates.

**Response**

Returns `200 OK` with project version data:

```json
{
  "version": 12,
  "newVersion": 13,
  "versionTime": ["1720788000", "123456"]
}
```

### Delete note

Context: Arcweave docs > REST API > Notes > Endpoints > Delete note

`DELETE /api/v1/{hash}/note/{noteID}`

**Request**

```http title="HTTP"
DELETE /api/v1/{hash}/note/{noteID}
```

```bash title="curl"
curl --request DELETE \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Accept: application/json" \
  "https://arcweave.com/api/v1/PROJECT_HASH/note/{noteID}"
```

**Response**

Returns `200 OK` with project version data:

```json
{
  "version": 12,
  "newVersion": 13,
  "versionTime": ["1720788000", "123456"]
}
```

## Common errors

Context: Arcweave docs > REST API > Notes > Common errors

| Status | Meaning                                                                                                 |
| ------ | ------------------------------------------------------------------------------------------------------- |
| `400`  | Invalid payload, unsupported field, malformed content, invalid theme, or `boardId` identifies a folder. |
| `403`  | Project permission denied.                                                                              |
| `404`  | Project or note not found when retrieving a note.                                                       |
| `409`  | The board or note does not exist when the command is applied.                                           |
