Skip to content

Page Exports

Use export_page when a user needs a copy of the current Page or an alternate representation for another workflow.

Supported Export Types

Export type Use when
html The user wants the current Page entry file as HTML.
page_json The user needs a structured Page document representation.
secondpage_page The user needs a SecondPage-compatible Page representation.

The export result may include the main file and auxiliary files from the Page bundle. Return the useful files or summary to the user based on what they asked for.

Reading the Result

Every file in the result carries an encoding field that says how to read it.

encoding What content holds What to do
utf8 The file as text Use it directly.
base64 The file's exact bytes, base64 encoded Decode it to get the file back byte for byte.
reference Nothing. There is no content Fetch the file from url. On a Page that is not public the URL needs a signed-in viewer; an agent cannot fetch it with its key. Use an authorized viewer or ask the person for the file; do not change sharing to retrieve it.

Text files (HTML, CSS, JavaScript, JSON, XML, SVG, plain text) come back as utf8. Anything else, including images, fonts, PDFs, and video, comes back as base64 so it survives the trip intact. Never decode a base64 file as text.

A reference file also carries byte_size, sha256, and url. References appear when a Page holds more binary content than one export can reasonably inline; the export still lists every file, and the ones it could not inline tell you where to fetch them. Two summary fields say what happened: binary_inlined_bytes and binary_reference_count. When anything was referenced, the result also carries a next_action sentence.

For reference files, verify fetched bytes against sha256 and byte_size. Their published URL can advance after export; on mismatch, re-export and reapply the edit. Never use changed bytes with the earlier version identity.

For revisions, retain the export result's page_id, version_id and version_number. Use version_id as update_page base_version_id for these exported bytes. Do not combine an earlier read base with a later export. The export also returns the exact version's manifest (schema_version, entrypoint and routes). Preserve it in both signed-upload update calls. It omits file metadata so hashes and sizes come from your edited upload_files inventory.

Good Agent Behavior

  • Read the Page first if you need to confirm what is being exported.
  • Use the smallest export type that satisfies the request.
  • Do not treat export as a revision. If the user wants changes, update the Page with update_page.
  • If an export type is not supported for a Page, explain that clearly and offer the closest available option.