Base Snapshot

IBaseSnapshot

IBaseSnapshot is the persistence format used by Univer Bases. It describes one Base unit, including tables, table order, schema version, timestamps, and optional revision metadata.

Properties

PropertyTypeDescription
idstringUnique id of the Base unit.
namestringBase name.
schemaVersionnumberSnapshot schema version.
tablesRecord\<string, ITableSnapshot\>Tables keyed by table id.
tableOrderstring[]Ordered list of table ids.
createdAtnumberCreation timestamp.
updatedAtnumberUpdate timestamp.
createdBy?stringCreator id.
rev?numberOptional revision value used by persistence or collaboration layers.

Minimal snapshot

TypeScript
const baseSnapshot = {  id: 'base-1',  name: 'Product tracker',  schemaVersion: 1,  tableOrder: ['tasks'],  tables: {    tasks: {      id: 'tasks',      name: 'Tasks',      primaryFieldId: 'title',      fieldOrder: ['title', 'status'],      fields: {        title: { id: 'title', name: 'Title', type: 'text', config: {} },        status: { id: 'status', name: 'Status', type: 'singleSelect', config: {} },      },      recordOrder: ['rec-1'],      records: {        'rec-1': {          id: 'rec-1',          values: { title: 'Write docs', status: 'In progress' },          orderKey: 'a0',          createdAt: Date.now(),          updatedAt: Date.now(),        },      },      views: {},      viewOrder: [],    },  },  createdAt: Date.now(),  updatedAt: Date.now(),}

Usage

IBaseSnapshot is mainly used to:

  1. Create a UniverInstanceType.UNIVER_BASE unit.
  2. Persist and restore structured data.
  3. Prepare data for server-side processing.
  4. Transfer data between collaboration and import/export services.

Snapshot objects are persistence data. After a Base is running, prefer Facade APIs instead of mutating the snapshot object directly.

Save and restore

Use Facade save() to include registered plugin resources, such as dashboards and local comments. saveToBackend below is your application's persistence function:

TypeScript
const base = univerAPI.getActiveBase()if (!base) throw new Error('Open a Base first')await saveToBackend(base.save())

In a new editor instance, register the same plugins before restoring with univerAPI.createBase(savedSnapshot). Do not save only tables or mutate the live model snapshot directly.

How is this guide?

© 2026 DreamNum Co., Ltd.