# AnnotationsApi.update()

```ts
update(id: string, changes: AnnotationUpdate, options?: SignedDocumentOptions): Promise<void>
```

Changes `rect`, `contents`, `author`, `color`, `fillColor` (a square's, circle's or polygon's; refused on anything else) or `opacity` of the annotation with that id. A `color` with no alpha changes the color alone; one with an alpha, or an `opacity` beside it, sets the opacity too; `null` is refused, a color entry cannot be removed. A new `rect` moves and scales what the annotation draws — quads, strokes, line ends, a polygon's or polyline's corners — with it; a stamp's or text box's own picture is fitted to it.

`update({ color })` rewrites the entry and rebuilds the appearance, so every reader draws the new color. A text box is refused with `INVALID_ARGUMENT`, since its color is its words'. A stamp accepts the call, but its picture is its own and keeps its colors: only the color entry and the opacity change. `update()` stamps the modification date when it changes something; it also acts on a reply or a status entry as on any annotation. Needs the `annotations` feature, and `forms` too for a form field's widget.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `id` | `string` | The annotation's id. |
| `changes` | `AnnotationUpdate` | `{ rect?, contents?, author?, color?, fillColor?, opacity? }`. |
| `options?` | `SignedDocumentOptions` | `{ invalidateSignatures? }`. |

Returns `Promise<void>`

Throws:

- `INVALID_ARGUMENT` — an id no annotation has, a text box's color, `fillColor` on anything but a square, circle or polygon, a `null` color, or a value the API does not take.
- `PAGE_ERROR` — the change could not be written (the color cannot be written).
- `FEATURE_NOT_LICENSED` — the license lacks `annotations` (or `forms`, for a form field's widget).
- `DOCUMENT_CLOSED` — the document has been closed.
- `INVALID_STATE` — a certified document whose certification forbids it, unless `options.invalidateSignatures`; or a progressive document still downloading.

```ts
await doc.annotations.update(id, { contents: 'Checked — fine', color: '#12B76A' });
```

Part of [AnnotationsApi](https://kernstra.com/docs/web-sdk/api/doc-annotations) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/doc-annotations/update
