---
title: "Auto save PDF annotations using JavaScript | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/web/annotations/annotation-saving-mechanism/"
md_url: "https://www.nutrient.io/guides/web/annotations/annotation-saving-mechanism.md"
last_updated: "2026-06-09T10:19:57.961Z"
description: "Nutrient Web SDK supports auto saving the changes that occur to annotations. Auto-save behavior is dependent on the operational mode used."
---

# Auto saving annotations

Nutrient Web SDK supports auto saving the changes that occur to annotations. Auto-save behavior is dependent on the [operational mode](https://www.nutrient.io/guides/web/about/operational-modes.md) used and the configuration of [`Configuration#autoSaveMode`](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#autoSaveMode).

## Standalone

In [standalone mode](https://www.nutrient.io/guides/web/about/operational-modes.md) of Nutrient Web SDK, changes will be stored in memory until they’re exported. The same persisting steps are traversed, which means we still differentiate between saved and unsaved changes, and exported Instant JSON will only contain changes that were saved. See the guide on [importing and exporting](https://www.nutrient.io/guides/web/importing-exporting/instant-json.md) for more information.

## Server-backed

When using the Nutrient Web SDK server-backed [operational mode](https://www.nutrient.io/guides/web/about/operational-modes.md), local changes are always synced to the Document Engine backend by default. This means you can always use the [backend API](https://www.nutrient.io/api/reference/document-engine/upstream/) to interact with these objects. This auto-save behavior can be set by the [`Configuration#autoSaveMode`](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#autoSaveMode) configuration option.

Before the change is sent to Document Engine, we assign a stable ID ([ULID](https://github.com/alizain/ulid/)). This ID is also used by Document Engine, and it allows you to track updates that happen before Document Engine responds. If you’d like to ensure a local change has been saved by Document Engine, you can use the [`Instance#ensureChangesSaved`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#ensureChangesSaved) method:

```js

NutrientViewer.load(configuration).then(async (instance) => {
	const createdAnnotations = await instance.create(newAnnotation);
	const [savedAnnotation] = await instance.ensureChangesSaved(
		createdAnnotations
	);
	console.log(savedAnnotation.id);
});

```

## Configuration#autoSaveMode

If nothing else is configured, Nutrient Web SDK will have auto save enabled. This means that local changes are automatically synced. You can use [`Configuration#autoSaveMode`](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#autoSaveMode) to configure exactly when saving occurs.

| Save mode                                     | Use case                                                                                                                                                                                   |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| _default_                                     | If [`Configuration#instant`](https://www.nutrient.io/api/web/NutrientViewer.Configuration.html#instant) is `true`, `autoSaveMode` defaults to [`NutrientViewer.AutoSaveMode.IMMEDIATE`](https://www.nutrient.io/api/web/NutrientViewer.html#.AutoSaveMode). Otherwise, it defaults to [`NutrientViewer.AutoSaveMode.INTELLIGENT`](https://www.nutrient.io/api/web/NutrientViewer.html#.AutoSaveMode). |

| [`NutrientViewer.AutoSaveMode.IMMEDIATE`](https://www.nutrient.io/api/web/NutrientViewer.html#.AutoSaveMode)   | Changes are saved whenever something changes, as long as they’re in a valid state. This is useful for real-time updates but increases server load.                                         |
| [`NutrientViewer.AutoSaveMode.INTELLIGENT`](https://www.nutrient.io/api/web/NutrientViewer.html#.AutoSaveMode) | Changes are saved whenever we detect a complete operation. This merges multiple operations into one server request and saves, for example, on deselect.                                    |
| [`NutrientViewer.AutoSaveMode.DISABLED`](https://www.nutrient.io/api/web/NutrientViewer.html#.AutoSaveMode)    | Changes aren’t saved by default. You can use [`Instance#save`](https://www.nutrient.io/api/web/NutrientViewer.Instance.html#save) to trigger a save manually whenever you want.                                                                             |

Here’s an example of how to set the `autoSaveMode` in the configuration object passed to [`NutrientViewer.load()`]:

```js

NutrientViewer.load({ autoSaveMode: NutrientViewer.AutoSaveMode.INTELLIGENT });

```
---

## Related pages

- [Embedding annotations in a PDF](/guides/web/annotations/save/embed-into-pdf.md)
- [Saving PDF annotations](/guides/web/annotations/save/overview.md)
- [Save annotations to external storage](/guides/web/annotations/save/to-external-storage.md)

