Skip to main content

Versioning

SurfaceDocs supports document versioning — push new versions to the same document, view history, and restore previous versions. This is ideal for recurring reports, living documents, and any pipeline that updates the same document over time.

push_version()

Push a new version from LLM output. Accepts a JSON string or dict, just like save().
Parameters: Returns: VersionResult

push_version_raw()

Push a new version with explicit parameters.
Parameters: Returns: VersionResult

list_versions()

List all versions of a document.
Parameters: Returns: list[VersionSummary]

get_version()

Get a specific version with its full content and blocks.
Parameters: Returns: Document — the document at that version Raises: VersionNotFoundError if the version doesn’t exist.

restore_version()

Restore a previous version as the new latest. This creates a new version with the content from the specified version.
Parameters: Returns: VersionResult Raises: VersionNotFoundError if the version doesn’t exist.

VersionResult

Returned by push_version(), push_version_raw(), and restore_version():

VersionSummary

Returned by list_versions():

Examples

Daily report pipeline

A pipeline that updates the same document every day:

Checking version history

Restoring a previous version