---
title: "Blok Saver API — save() and OutputData"
description: "Serialize the editor to JSON, what save() returns, and when the promise it hands back resolves."
source: https://blokeditor.com/docs/saver-api/
lastmod: 2026-09-07
---

Framework JavaScript

Core Saver

On this page saver.save()

# Saver API: serialize the editor to JSON

Save and export editor content.

[Edit this page on GitHub](https://github.com/JackUait/blok/blob/main/docs/src/components/api/api-data.ts)

### Reaching the editor instance

The methods below run on the editor you created with new Blok(). They are available once editor.isReady resolves.

TypeScript

```
// You already hold the instance returned by the constructor.
const editor = new Blok({ holder: 'editor' });
await editor.isReady;

// Call any API method on it.
editor.caret.setToLastBlock('end');
```

## Methods

### saver.save()

Promise<OutputData>

Alias for the main save() method. **Rejects while read-only mode is enabled** — it warns and throws `Error("Blok's content can not be saved in read-only mode")` before reaching the Saver. Guard the call with `editor.readOnly.isEnabled`, or call `await editor.readOnly.set(false)` first.

When to use

Identical to `editor.save()`; provided for code that works through the `saver` module. Both await the full block tree.

Errors

- Read-only mode is enabled (`editor.readOnly.isEnabled === true`). Blok's content can not be saved in read-only mode Disable read-only with `readOnly.set(false)` before saving, or gate the call on `readOnly.isEnabled`.
- Collecting the data failed (a tool's save() threw). Blok's content can not be saved because collecting data failed Inspect the rejected error: it is the tool's own error whenever the Saver recorded one.

TypeScript

```
if (!editor.readOnly.isEnabled) {
  const data = await editor.saver.save();
  // Returns: { version, time, blocks }
}
```
