For a render that does not hold the connection open, use
POST /v1/render/:slug/async.
Each successful render is one operation.
Render raw HTML
POST /v1/render/html
Renders an HTML document with @formepdf/html. No saved template is needed.
Request body
Options
options is passed to the HTML engine. These are the main fields; see HTML Input for what each one does.
Response
200 OK, Content-Type: application/pdf. The body is the PDF. Engine warnings are in the X-Forme-Warnings header.
With s3: 200 OK with JSON. The warnings are in the body:
renderTimeMs and input: "html".
Render a saved template
POST /v1/render/:slug
Renders a saved template (JSX or HTML + Liquid) with data.
Path params: slug — the template’s slug.
Body: the request body is the template data. Every key goes to the template, except four reserved keys:
The reserved keys are removed before the data goes to the template. Do not use them as data field names.
Response
200 OK, Content-Type: application/pdf. The body is the PDF. For an HTML template, engine warnings are in the X-Forme-Warnings header.
With s3: 200 OK with { "url": "..." }.
A template that is not found returns 404: {"error": "Template \"invoice\" not found"}.
For a JSX template, the data (without the reserved keys) is embedded in the PDF. Read it back with POST /v1/extract. HTML templates and /v1/render/html do not embed data.
The saved document’s metadata includes renderTimeMs and templateSlug.
Warnings
The HTML engine reports everything outside the supported subset as a warning. When a render returns PDF bytes, the warnings are in theX-Forme-Warnings response header, as a JSON array of strings:
- The header is present only when there is at least one warning.
- The header value is cut at 2,000 characters, so a long list can be incomplete and is then not valid JSON. To see every warning, render the same HTML locally with
@formepdf/html, or preview the template in the Dashboard. - JSX templates do not produce warnings here.
S3 upload
Pass ans3 object to upload the PDF to your S3-compatible bucket. The response is JSON with the object URL instead of the PDF bytes. This works on /v1/render/html and /v1/render/:slug. It does not work on the async endpoint.
The returned
url is https://{bucket}.s3.{region}.amazonaws.com/{key}, or {endpoint}/{bucket}/{key} with endpoint. The URL is not signed. Whether it is readable depends on your bucket’s access settings.
Forme uses the
s3 credentials for this one upload. They are not stored.Metadata
Tag a saved document with your own key-value pairs. Available on paid plans. On the Free plan, a request withmetadata returns 403.
save: false, nothing is saved, so the metadata is only validated.
Find documents by metadata with
GET /v1/documents?metadata.customerId=cust_123. See Resources.