Formfeed
v0.3.35Render PDFs and images from templates, validate data and convert Office files to PDF.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_templates List templates
Lists the templates of the workspace this server works in (the one chosen at sign-in, or the API key's), most recently changed first: id, slug, name, kind (pdf, image, docx for Word, pptx for PowerPoint), engine, tags and published_version. Call it first to find the slug that get_template_schema, validate_template and render take; skip it when the user already named the template. Returns every match in one answer, without archived templates, and an empty list when nothing matches. A template whose published_version is null has never been published, so render cannot use it yet. Read-only and fr…
| Parameter | Type | Description |
|---|---|---|
engine | string | Only templates written in this template language |
kind | string | Only templates that produce this kind of document |
q | string | Text to find in the name or slug, case-insensitive (e.g. invoice) |
tag | string | Only templates with this tag; exact match, tags are lowercase with dashes (e.g. billing) |
get_template_schema Get the data schema of a template
Returns the JSON Schema of the `data` object a template expects and the sample data it was designed with, from its published version, else its latest draft. Call it after list_templates and before render or validate_template, to build data that fits; ad-hoc html has no stored schema to read. When the template stores no schema, one is inferred from the sample data: treat that as a guide, not a contract. Read-only and free; an unknown slug returns an error.
| Parameter | Type | Description |
|---|---|---|
template * | string | Slug (e.g. invoice) or tpl_ id, as list_templates returns them |
get_template_source Read the source of a template
Returns what a template version is made of: the body markup (html), css, head, settings (paper, margins, header, footer, fonts), sample data, data sets, data schema, translations and partials, with the version's checksum. Call it before save_template to change a template the user named, and save what you edited with that checksum as base_checksum. Reads the latest version by default, the newest draft a change builds on; published reads what renders use. Word and PowerPoint templates are documents: for them it returns the settings and data, not the document. Read-only and free.
| Parameter | Type | Description |
|---|---|---|
template * | string | Slug (e.g. invoice) or tpl_ id, as list_templates returns them |
version | latest (default), published, a version number or a channel name |
validate_template Validate a template with data
Checks a template and its data without rendering: free, no units, nothing stored, no document produced. Call it before render when you assembled the data yourself, or after writing ad-hoc html. With template, the API checks the published version (else the latest, or the version you name) as a render would: syntax, header and footer, errors only this data triggers, and the data against the stored JSON Schema (a wrong type or a missing required field is an error). With html and engine it compiles offline and reports syntax errors, unknown filters and variables missing from data. Returns ok and d…
| Parameter | Type | Description |
|---|---|---|
data | object | The data the document will be rendered with, shaped as get_template_schema describes. Left out, a stored template is checked with its sample data |
engine | string | Template language of html; required with html |
html | string | Template source to check offline, when there is no stored template; pass this or template |
template | string | Slug or tpl_ id of a stored template; pass this or html |
version | With template: the version to check, such as latest for the newest draft or a number; left out, the published one, else the latest |
save_template Save a template as a draft
Saves a template as a draft, never published: renders keep using the published version until a person publishes the draft in Formfeed. With template and base_checksum it saves a new version of that template: read it with get_template_source first, change what the user asked for, and pass only the parts you changed (the others are kept from the version you read). With new_template and html it creates a template whose version 1 is the draft. change_note says what changed; the person reads it before publishing. Returns the saved version, the check of the draft with its sample data (fix every erro…
| Parameter | Type | Description |
|---|---|---|
change_note * | string | What the draft changes, in one sentence, shown in the version history |
base_checksum | string | With template: the checksum get_template_source returned. When someone saved a newer version since, nothing is saved: read the source again and redo the change on it |
css | string | The stylesheet; up to 1 MB |
data_schema | JSON Schema of data; null removes the stored one | |
data_sets | object | Named sample data sets besides sample_data (name → data) |
head | string | Extra markup for <head>, such as font links |
html | string | The body markup in the template language, without <html>, <head> or <body>; up to 2 MB |
i18n | Translations: locale → key → text, read by the t helper | |
new_template | object | Creates a template whose version 1 is this draft; pass this and html, or template |
partials | object | Partials the template includes (name → source) |
sample_data | object | The data the editor previews with and the draft is checked with; never used by a render |
settings | object | Paper, margins, header, footer, fonts and the other settings, as get_template_source returns them; replaces the stored settings as a whole |
template | string | Slug or tpl_ id of the template to save a new draft of; pass this or new_template |
check_invoice Check an e-invoice
Checks the _invoice block of an e-invoice offline, as the API does before it renders one: the fields EN 16931 asks for, the totals to the cent, VAT categories and code lists, and France's rules for an invoice between two French businesses. Free, no units, nothing sent. Returns ok and problems, each with the field, the rule (BR-…) where one applies and a message. Nothing is computed for you: change the values a problem names, check again, then call render with einvoice and the block as data._invoice. The validator that runs during the render holds the file to the full rule set and to PDF/A-3b…
| Parameter | Type | Description |
|---|---|---|
invoice * | object | The _invoice block as it goes into data._invoice: number, issue_date, currency, seller, buyer, lines, tax.breakdown, totals and payment, as https://docs.formfeed.dev/templates/e-invoices#invoice-block… |
profile | string | The profile the render will ask for; en16931 when left out. basic cannot carry a rounding amount and is refused between two French businesses |
validate_einvoice Validate an e-invoice
Says which rules an e-invoice passed, by which validator and release: the file is held to the rule set its specification identifier (BT-24) names, Factur-X and ZUGFeRD by Mustang, XRechnung (CII and UBL) by the KoSIT validator, and each check (syntax, schema, every named rule set) comes back with its own result and findings. Pass exactly one source: render_id, an e-invoice this workspace rendered, which is answered from the report the render keeps and costs nothing; path, an XML file on this machine; or xml_base64, the XML itself. An XML takes one of the organisation's validations of the day (…
| Parameter | Type | Description |
|---|---|---|
path | string | Absolute path of an e-invoice XML on this machine; counts one of the day’s validations |
render_id | string | rnd_ id of a render of this workspace that made an e-invoice; free |
rules | string | auto (default) takes the rule set the file's identifier names; a rule set named here judges only a file whose identifier it is for. en16931 holds a render's EN 16931 invoice to CEN's own rules, which… |
xml_base64 | string | The e-invoice XML (CII or UBL), base64 encoded, up to 4 MB; counts one of the day’s validations |
render Render a document
Creates a document by filling a stored template, or ad-hoc html, with data: a PDF or image, or DOCX, PPTX or PDF from Word and PowerPoint templates. Returns the render with status and download_url; for an image (png, jpg or webp) up to 2 MB the result also carries the picture itself, so look at what you made before handing it on (a PDF comes as its link). Use it to make a document from data; to turn an existing office file into a PDF, use convert_to_pdf, and for a Markdown document, markdown_to_pdf. Stored templates render their published version, so one whose published_version is null fails w…
| Parameter | Type | Description |
|---|---|---|
data | object | Values for the template, shaped as get_template_schema describes; leave out when it needs none |
einvoice | Makes the PDF a ZUGFeRD / Factur-X e-invoice whose XML is built from data._invoice: true for the defaults, an object to choose, false to switch off what the template declares. PDF only; live renders f… | |
engine | string | Template language of html, when it contains expressions to fill from data |
filename | string | Name of the file behind download_url, e.g. invoice-2026-0042.pdf |
html | string | A complete HTML document to render instead of a stored template, up to 5 MB |
locale | string | BCP 47 tag for helpers and translations, e.g. de-DE |
output | string | Left out, the template decides: PDF for PDF templates and html, its image format for image templates, its default output for Word and PowerPoint templates. Word templates render docx or pdf, PowerPoin… |
template | string | Slug or tpl_ id of a stored template; pass this or html |
wait | boolean | Most renders are finished when the call returns; true also waits for one that continues in the background, false returns it as it is (queued or rendering) to check later with get_render |
markdown_to_pdf Turn Markdown into a PDF
Turns a Markdown document into a PDF without a template, e.g. a report, notes or an answer you wrote, and returns the render with status and download_url. It reads GitHub Flavored Markdown (tables, task lists, strikethrough) and footnotes; a YAML front matter block gives the title, author, subject and keywords, else the first heading is the title; a line \newpage starts a new page. Raw HTML in the text is shown as text. A picture named without an address () is a file of the workspace library, uploaded in Formfeed; with path, a picture beside the file is sent along instead. The…
| Parameter | Type | Description |
|---|---|---|
css | string | A stylesheet after the theme, e.g. h1 { color: #0f766e }; the document is inside div.ff-markdown |
diagrams | boolean | Draws ```mermaid fences with Mermaid (flowcharts, sequences, pie charts and more). Set it when you wrote one, with an accTitle line as its name; left out, a fence prints as code |
filename | string | Name of the PDF behind download_url, e.g. report.pdf |
landscape | boolean | Landscape pages |
markdown | string | The document as Markdown text, up to 1 MB; pass this or path |
math | boolean | Typesets formulas with KaTeX: $…$ and $`…`$ in a line, $$…$$ on lines of their own, ```math fences. Set it when you wrote formulas; left out, a $ stays text |
outline | boolean | Bookmarks from the headings (default true); they cost nothing |
paper | string | Paper size; A4 when left out |
path | string | Absolute path of a Markdown file on this machine; pictures inside its folder are sent along |
pdf_ua | boolean | Makes the file a PDF/UA-1 document checked by veraPDF; a file that fails is not delivered and the result names the rules |
theme | string | document (default) styles the text, in the brand kit fonts and colour where the workspace has one; none leaves the styling to css |
title | string | The PDF title; left out, the front matter title or the first heading |
wait | boolean | true waits for a render that continues in the background; false returns it as it is, to check later with get_render |
convert_to_pdf Convert an office document to PDF
Converts an existing Word, Excel, PowerPoint, OpenDocument, RTF or HTML document (up to 20 MB) to a PDF as it is, without filling in data, and returns the render with status and download_url. To make a document from a template and data, use render instead. Pass exactly one source: render_id, the render of a Word or PowerPoint template (output docx or pptx); path, a file on this machine; or file_base64 with file_name. Every call is a new render that counts units like a PDF; the Free plan cannot convert (Starter and above). The document is converted and not kept.
| Parameter | Type | Description |
|---|---|---|
file_base64 | string | The document to convert, base64 encoded; needs file_name |
file_name | string | Name of the document, e.g. report.xlsx; the type is read from the content |
filename | string | Name of the PDF behind download_url, e.g. report.pdf |
landscape | boolean | Landscape for spreadsheets and documents without their own page setup |
page_ranges | string | Pages to convert, e.g. 1-3,5; all pages when left out |
path | string | Absolute path of the document on this machine |
render_id | string | rnd_ id of a render whose output is docx or pptx, to get that document as a PDF |
single_page_sheets | boolean | Each spreadsheet sheet on one page |
get_pdf_info Read a PDF's pages, properties and form
Reads a PDF without changing it: the page count and the size of every page, whether it is password-protected, its document properties, and its form, with every field by its full name, label, type, value and the options it takes. Read it before fill_pdf_form, which takes the fields by these names, and before redact_pdf or split_pdf, which work on these pages. Pass exactly one PDF: source, a render or library file of the workspace; path, a file on this machine; or file_base64. Free on every plan; it creates no render, and an uploaded PDF is read and not kept.
| Parameter | Type | Description |
|---|---|---|
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
split_pdf Split a PDF
Cuts a PDF into parts, every N pages each or one part per entry of ranges, and returns the render with download_url: a ZIP of the parts, named after the source (contract-1.pdf, contract-2.pdf and so on), or the PDF itself when there is one part. get_pdf_info gives the page count first. Pass exactly one PDF: source, a render or library file of the workspace; path, a file on this machine; or file_base64. Starter plan and above; 0.5 units on a live key. A PDF/A or a password-protected PDF is refused.
| Parameter | Type | Description |
|---|---|---|
every | integer | Pages per part; give every or ranges |
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
filename | string | Name of the file behind download_url; the source's name when left out |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
ranges | array | One part per entry, each a page selection such as 1-3,5, or 4- for page 4 to the last; give every or ranges |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
compress_pdf Compress a PDF
Makes a PDF smaller and returns the render with download_url; a PDF that cannot be made smaller comes back as it was. For a preview picture of a page instead, use pdf_to_image. Pass exactly one PDF: source, a render or library file of the workspace; path, a file on this machine; or file_base64. Starter plan and above; 0.5 units on a live key. A PDF/A or a password-protected PDF is refused.
| Parameter | Type | Description |
|---|---|---|
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
filename | string | Name of the file behind download_url; the source's name when left out |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
pdf_to_image Turn PDF pages into pictures
Draws pages of a PDF as PNG or JPEG pictures and returns the render with download_url: one page gives the picture, which this tool also hands back so you can look at it (up to 2 MB), several pages a ZIP of pictures named by page. At most 100 pages and 120 million pixels a call, about 13 A4 pages at 300 dpi. Use it to see a page before redact_pdf, or for thumbnails. Pass exactly one PDF: source, a render or library file of the workspace; path, a file on this machine; or file_base64. Starter plan and above; one unit per picture on a live key.
| Parameter | Type | Description |
|---|---|---|
dpi | integer | Resolution, 36 to 300, 150 when left out; at 72 a pixel stands for a point |
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
filename | string | Name of the file behind download_url; the source's name when left out |
format | string | png (the default) or jpg |
pages | string | The pages to draw, such as 1, 1-3,5 or 2- (page 2 to the last); every page when left out |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
quality | integer | JPEG quality, 1 to 100; ignored for PNG |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
redact_pdf Redact a PDF
Removes what lies under rectangles of the pages, and every place where a text stands, from the file itself and not just from view: text, the pixels of images under a rectangle, and links and comments it touches. The result is read again: a text that can still be found fails the call with redaction_incomplete, which names rectangles and texts by their number, and nothing is delivered. Rectangles are points from the top-left corner of the page as a viewer shows it, 72 to an inch; get_pdf_info gives the page sizes and pdf_to_image a picture of the page. A text is found whatever its spacing, ignor…
| Parameter | Type | Description |
|---|---|---|
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
filename | string | Name of the file behind download_url; the source's name when left out |
fill | Colour of the box drawn over each removed place, #000000 when left out; null draws none | |
match_case | boolean | Find a text only in the case it is written in |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
regions | array | The rectangles to remove, as a viewer shows the page; give regions, text or both |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
text | array | Texts to remove wherever they stand, such as a name or an IBAN, found whatever their spacing |
whole_words | boolean | Find a text only where a word boundary stands on each side |
fill_pdf_form Fill a PDF form
Fills the fields of a PDF form by their full names, as get_pdf_info lists them, and returns the render with download_url and form: how many fields were filled, which were left out, and which hold a calculation or display format that no viewer ran. The form stays fillable, or flatten draws the values into the pages. A name the form lacks or a value its field does not take fails the call with form_field_unknown or form_value_invalid, naming the field, unless strict is false. Pass exactly one PDF: source, a render or library file of the workspace; path, a file on this machine; or file_base64. Sta…
| Parameter | Type | Description |
|---|---|---|
fields | object | Values by the fields' full names: text for a text field, true or false for a check box, one of the field's options for a dropdown, a radio group or a check box with several on-values, a list of option… |
file_base64 | string | The PDF itself, base64 encoded, up to 20 MB; sent with the request and not kept |
file_name | string | Name of the PDF given as file_base64 or path, e.g. contract.pdf; the results are named after it |
filename | string | Name of the file behind download_url; the source's name when left out |
flatten | boolean | Draw the values into the pages and remove the fields, so the values can no longer be changed |
path | string | Absolute path of a PDF on this machine, up to 100 MB; sent with the request and not kept |
source | string | A PDF of the workspace: the rnd_ id of a PDF render, or a PDF of the file library by name (such as terms.pdf) or fil_ id |
strict | boolean | true (the default) fails on a name the form lacks or a value its field does not take; false leaves both out and lists them in form.skipped |
get_render Get a render
Returns the current state of a render: status (queued, rendering, succeeded or failed), download_url with expires_at, page_count, units and error, and the picture of a finished image render up to 2 MB. Use it to follow a render started with wait false, or to get a fresh link once the old one has expired; render, convert_to_pdf and the PDF tools already return this for the render they just made. Read-only and free; an unknown id returns an error.
| Parameter | Type | Description |
|---|---|---|
id * | string | rnd_ id of the render, as render or convert_to_pdf returned it |
get_workspace Which workspace this server works in
Returns the workspace and organisation this server acts in, the plan, the environment (live or test) and the units of the current period: included, used and the balance of prepaid units. Call it when the user asks where a document will land or how many renders are left, or when list_templates returns nothing you expected. A signed-in agent works in the workspace chosen when it was connected, which the person changes in Formfeed under Account → Connected agents; an API key works in the workspace it was made for. Read-only and free.