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().
| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | str | Yes | The document to version |
content | str or dict | Yes | JSON string or dict with title and blocks |
VersionResult
push_version_raw()
Push a new version with explicit parameters.| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | str | Yes | The document to version |
title | str | Yes | Document title |
blocks | list[dict] | Yes | List of content blocks |
metadata | dict | No | Document-level metadata |
VersionResult
list_versions()
List all versions of a document.| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | str | Yes | The document ID |
list[VersionSummary]
get_version()
Get a specific version with its full content and blocks.| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | str | Yes | The document ID |
version | int | Yes | Version number to retrieve |
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.| Parameter | Type | Required | Description |
|---|---|---|---|
document_id | str | Yes | The document ID |
version | int | Yes | Version number to restore |
VersionResult
Raises: VersionNotFoundError if the version doesn’t exist.
VersionResult
Returned bypush_version(), push_version_raw(), and restore_version():
VersionSummary
Returned bylist_versions():