Change a document by its link
update_documentWrites a new version of a document by its link — e.g. the person asks in the chat to remove something on page 2 — and prints it again: the PDF link, the same edit link (the editor open on it shows the change). The new version replaces the one before. Send the whole new html (and data, if it is a template), changed from what get_document returned, with base_revision: a document the person changed after you read it is refused, so read it again.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"document_id": "<document_id>",
"base_revision": "<base_revision>"
},
"name": "update_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | The template's new data. Alone, only for a template (kind "template"); with html, non-empty data makes the document a template. Omitted: the data stays. | |
| html | No | The whole new source. Omitted: the source stays (e.g. new data only). | |
| name | No | A new name. | |
| preview | No | Pictures (PNG) of pages come with the answer, so you can check the layout, fonts and images before giving the links. Default: true. | |
| filename | No | A new PDF file name, kept for its later prints. Default: the name it was printed with (render_pdf filename), else its <title>. | |
| document_id | Yes | The document_id (or the edit link). | |
| base_revision | Yes | The revision you read (get_document, or the last result). Required: a document the person changed after it is refused, never overwritten. | |
| preview_pages | No | Which pages to see, 1-based; -1 is the last page. Default: page 1 and the last page (a page that spilled over shows there). Up to 4, e.g. [1, 2, -1]. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The link, valid 24 hours. | |
| mark | Yes | Whether the PDF carries the ReflowPDF mark, and why. | |
| bytes | Yes | ||
| guest | Yes | Printed without an account: the pages carry the ReflowPDF mark. | |
| notes | Yes | Facts about this PDF: how long its link works, its mark, what was not fetched or filled. | |
| pages | Yes | ||
| paper | Yes | Its paper, e.g. "A4", "Letter", "210 × 99 mm"; empty when unknown. | |
| title | Yes | The document's title. | |
| pdfUrl | Yes | The PDF (the same link as url). | |
| sizeKb | Yes | The PDF's size in KB. | |
| timing | No | The engine's own parts of it, when it states them: layoutMs (styles, layout and pagination) and writeMs (writing the PDF). | |
| editUrl | No | The document in the ReflowPDF editor: the person edits it there (the link is the document; it lasts while it is used). | |
| preview | No | Which pages came with this answer as pictures (PNG), or why none did. | |
| filename | Yes | ||
| previews | Yes | Pages as pictures (PNG), kept with the PDF for its day. | |
| renderMs | No | How long the print took on the server, in milliseconds (the engine and its adapter). | |
| revision | No | Its revision: name it to update_document as base_revision. | |
| expiresAt | Yes | When the link stops working (ISO 8601). | |
| documentId | No | The document, for get_document and update_document. | |
| missingFonts | No | Font families the document named that no face answered: their text took the next family of its list. | |
| missingVariables | No | Template values the data did not have (printed empty). | |
| skippedResources | No | Images, fonts or style sheets the server could not fetch. |