generate_document
ChatGPTCreate an immutable generated document from a template: the saved version with
values applied. Each KEY of values must be a placeholder KEY exactly as get_template returns it in placeholders[].key, never the value currently filled in, and never a name read out of the document text. So for a placeholder keyed "client_name" (labelled "Client name") holding "Acme Ltd", to change it to "Globex" you send {"client_name": "Globex"}. A placeholder used more than once in the document is filled everywhere. Keys you omit keep the template’s default values. A placeholder’s description (from get_template) is the template author’s help text about the expected value. Omit placeholders marked auto: true (today’s date, auto-numbers): PaperClerk fills them and ignores anything sent. Typed placeholders constrain their values: a "select" placeholder accepts exactly one of its options, and a "number" placeholder accepts a numeric string like "1234.56" (rewritten server-side into the template’s declared format). A "date" placeholder is NOT rewritten: send the date already written in its format (e.g. "01/05/2027" for format "08/27/2026"). Any placeholder accepts "" to clear it. A REPEATING GROUP (get_template → groups) takes an ARRAY of instance objects keyed by the group’s field keys: its template row is cloned once per array entry, so {"line_items": [{"item": "Widget", "quantity": "2"}, {"item": "Gadget"}]} produces two rows. An omitted group keeps the template’s single authored row; an empty array [] removes the section entirely; field types validate exactly like top-level placeholders. Returns the new document with url (its page in PaperClerk) and pdf_download_url (downloads the PDF with no sign-in, valid until pdf_download_expires_at, about an hour; the PDF is rendered on first use if it is not ready yet). Both links are meant for the user. An identical request (same template, values and title) within ten minutes answers the same document again with replayed: true instead of generating a second copy; to make another copy on purpose, change the title.





