Skip to content

Quickstart

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

In a new workspace, Studio’s Home page has a Get started card with the same path: pick a starter document to create a template, then Show code publishes it and shows the request that renders it, with a new API key in it. This page does it step by step, from the terminal.

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.

The examples call the hosted service at https://app.typefold.dev. If your company runs its own installation, use the address you open Studio at instead: the API answers there too.

  1. Sign in to Studio and open your workspace.
  2. Go to Developers → API keys and click 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. Click Create API key and copy the secret. It is shown only once.

In the examples below, replace YOUR_API_KEY with the secret, keeping the quotes around it. In your own application, load the key from its settings or a secret store rather than writing it in code that others can read.

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 https://app.typefold.dev/v1/renders \
-H "x-api-key: YOUR_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 Add (+) above the file list, then New entity → Template.

  2. Enter the Template name Quickstart invoice, set Start with to Code: HTML or Excel and Code template to HTML, blank page, and click Create template. The editor opens the template’s template.html. (New templates start as a visual Blank page unless you pick code.)

  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 https://app.typefold.dev/v1/reports/render \
-H "x-api-key: YOUR_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.

To get this request for any template, click Use from code in the editor’s header. Its Render it task renders the template by its name, in curl and each client, with the template’s own sample data as data.