Choose the right endpoint when you already have self-contained HTML, a DOCX file, or an XML document and stylesheet. These operations require CAN.RENDER and use the workspace’s document allowance.
Choose an endpoint
- HTML to PDF. POST to
/api/v1/pdf/htmlwith JSON containinghtmland optionalname. The response is JSON withcontentBase64andcontentType. - DOCX to PDF. POST to
/api/v1/pdf/with a multipart upload in thedocx/docx/pdf filefield. The response is a binaryapplication/pdffile. - XML/XSLT transform. POST to
/api/v1/xmlwith JSON containingxmlandxsl. The response is JSON with the transformed text inresult.
Generate a PDF from HTML
Use self-contained HTML with plain markup and inline or embedded CSS. The HTML input limit is 10 MiB. The endpoint rejects external references and active content such as scripts, links, images, and forms. For output based on a stored report template or fillable PDF, use the PDF document and PDF form endpoints.
Set FERA_RENDER_INSTANCE and FERA_AUTH_TOKEN as shown in Render Your First Document. This Bash example uses curl, jq, and Node.js.
curl --fail-with-body --silent --show-error \
'https://api.render.feradel.com/api/v1/pdf/html' \
--header "instance: $FERA_RENDER_INSTANCE" \
--header "x-auth-token: $FERA_AUTH_TOKEN" \
--header 'content-type: application/json' \
--data-binary '{"html":"<!doctype html><html><body><h1>Sample report</h1></body></html>","name":"example.pdf"}' \
--output html-response.json && \
jq -er 'select(.success == true and .contentType == "application/pdf") | .contentBase64' html-response.json > example.b64 && \
node -e 'const fs = require("node:fs"); fs.writeFileSync("example.pdf", Buffer.from(fs.readFileSync("example.b64", "utf8"), "base64"));'
Convert DOCX or transform XML
For DOCX conversion, pass file=@document.docx to curl’s --form option and let curl set the multipart boundary. The upload limit for this route is 50 MiB. Check the status and Content-Type before treating the response as a PDF. See Convert DOCX to PDF for a complete upload example.
For XML, put the source XML and XSLT in the xml and xsl JSON properties. Read the returned result as text. Test with representative input and a stylesheet that uses self-contained data. See the XSLT security restrictions and live OpenAPI examples.