Skip to content

Quickstart

Create an API key, render a PDF from a line of HTML, then render a template by its name.

You need two things:

  1. A Studio sign-in as a workspace owner or admin. Studio is on the hosted service or on an installation your company runs. Only owners and admins can create API keys; if you are a member, ask one for a key with the permissions in step 1.
  2. curl or a client library. The curl examples are for bash or zsh. To use the .NET, TypeScript and JavaScript or Python client instead, install it as its page shows and pick its tab.

Save the address you open Studio at in PDF_URL. The API answers at the same address:

Terminal window
export PDF_URL='https://pdf.example.com'
  1. Sign in to Studio and open your workspace.
  2. Go to Manage → API keys and select Create API key.
  3. Enter a Key name, such as Quickstart. Under Permissions, keep render:create and render:read ticked and also tick template:read.
  4. Select Create API key and copy the secret. It is shown only once.

Keep the secret in an environment variable for the next steps:

Terminal window
export API_KEY='paste-the-secret-here'

What each permission allows is listed in API keys, scopes and roles.

Send a line of HTML with A4 paper size and 15 mm margins, and save the PDF as invoice.pdf:

waitMs asks the API to wait up to 10 seconds for the PDF:

Terminal window
curl $PDF_URL/v1/renders \
-H "x-api-key: $API_KEY" \
-H "content-type: application/json" \
-d '{
"document": {
"kind": "html",
"html": "<h1>Invoice 42</h1><p>Thank you for your order.</p>"
},
"settings": {
"pageSize": { "widthMm": 210, "heightMm": 297 },
"margins": { "topMm": 15, "rightMm": 15, "bottomMm": 15, "leftMm": 15 }
},
"waitMs": 10000
}'

The response is the render. When its state is succeeded, download the PDF from result.downloadUrl, which works without the API key for five minutes. If it is still queued or processing, see get the finished file.

Terminal window
curl -o invoice.pdf "PASTE-THE-downloadUrl-HERE"

Open invoice.pdf: you should see a one-page A4 document with the heading “Invoice 42”.

Most applications keep the layout in a template, a reusable document stored in Studio, and send only data. First create and publish the template:

  1. In the sidebar, open Workspace → Editor. The editor opens in a new browser tab. Click +, then New entity → Template.

  2. Enter the Template name Quickstart invoice, leave Start with on Blank template and click Create template. The editor opens the template’s template.html.

  3. Replace its contents with:

    <h1>Invoice {{number}}</h1>
    <p>Bill to {{customer}}</p>
    <table>
    {{#each lines}}
    <tr><td>{{item}}</td><td>{{amount}}</td></tr>
    {{/each}}
    </table>

    The placeholders use Handlebars syntax.

  4. Click Save, then Publish. Publishing makes the template available to the API.

Now render it by name with the Reports API. It returns the PDF itself, saved here as quickstart-invoice.pdf:

Terminal window
curl $PDF_URL/v1/reports/render \
-H "x-api-key: $API_KEY" \
-H "content-type: application/json" \
-d '{
"format": "pdf",
"template": { "name": "Quickstart invoice" },
"data": {
"number": "2026-0042",
"customer": "Acme Ltd",
"lines": [
{ "item": "Consulting", "amount": "1,200.00" },
{ "item": "Travel", "amount": "180.00" }
]
}
}' \
-o quickstart-invoice.pdf

Open quickstart-invoice.pdf. You should see “Invoice 2026-0042”, “Bill to Acme Ltd” and a two-row table.