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 likesave().
Returns:
VersionResult
push_version_raw()
Push a new version with explicit parameters.
Returns:
VersionResult
list_versions()
List all versions of a document.
Returns:
list[VersionSummary]
get_version()
Get a specific version with its full content and blocks.
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.
Returns:
VersionResult
Raises: VersionNotFoundError if the version doesn’t exist.
VersionResult
Returned bypush_version(), push_version_raw(), and restore_version():
VersionSummary
Returned bylist_versions():