Skip to main content
Render a document, page or table to a file and fetch it through a short-lived URL.

export_document

Scope: documents:read (step-up) · Kind: read-only · Annotations: readOnlyHint: true, destructiveHint: false, openWorldHint: false
Render a document (markdown, pdf), page (html), or table (csv, json, markdown) to a file and get a short-lived download URL (~15 minutes; fetch it promptly). The file is a snapshot of the version it names — re-export after editing. Exporting never changes the artifact and never fetches remote content: document media blocks become placeholders; page html keeps its remote references as written (scripts removed).

Parameters

string
required
The artifact id of a document, page or table.
'markdown' | 'html' | 'pdf' | 'csv' | 'json'
required
Which formats apply depends on the artifact kind:

Returns

string
A capability URL on the server’s /files/ route. Valid for 15 minutes; access is re-checked at download time.
number
Milliseconds since epoch.
string
Derived from the title slug and format, for example q3-launch-plan.pdf.
string
number
number
The artifact version the file captures.
number
PDF only.
string[]
Renderer warning codes, if any.
Text: Exported "<title>" as <filename> (<media type>, <bytes> bytes). Download within 15 minutes: <url>

Permissions and side effects

  • Needs documents:read and any role on the artifact.
  • Uses the same renderer and cache as the app’s Export menu, so a second export of an unchanged version is served from cache.
  • Never changes the artifact. Recorded in the agent activity history.
  • Exports are not delivered into a session as attachments; the URL is the only output.

Network / remote content

Rendering makes no outbound requests. URLs in a document — image blocks, markdown image syntax, raw <img> or <link> markup — are never resolved server-side: image, video, audio and file blocks become a [image omitted: …] placeholder line with an image_dropped warning, and inline markup is kept as literal text. PDF output embeds no fonts, stylesheets or images; page (html) exports are returned as written with scripts removed, and any remote references they contain are resolved only by whoever opens the file. Theme assets are inlined from the workspace’s own storage, never fetched from a URL.

Errors

Example

Request
Response (structuredContent)
The exact shape of the download URL is an implementation detail and may differ from the example; treat it as opaque and fetch it as-is.