LinkoPDF Template API

Retrieve a saved template as JSON for use in your own application. The current /api/generate endpoint returns template data. PDF, PNG, and JPG export runs in the LinkoPDF editor.

Getting started

API key and template ID

Open your account settings in the editor to manage your API key. Use the identifier of a template saved to the same account. Template access is restricted to its owner.

Authentication

Send the key from your backend in the Authorization header. Keep it out of public frontend code.

Authorization: Bearer YOUR_API_KEY

Retrieve template data

POST /api/generate

Send a JSON body with templateId. The endpoint looks up the template for the authenticated account and returns its saved template_data.

POST https://linkopdf.com/api/generate
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{"templateId": "YOUR_TEMPLATE_ID"}

Successful response

{
  "success": true,
  "template": { }
}

The template value above is abbreviated; the actual response contains your saved template data. The endpoint does not return PDF bytes or a hosted download URL, and it does not merge a supplied data object into the template.

Errors

Errors return a JSON object with an error string.

{"error": "Missing templateId in request body."}
StatusMeaning
400Missing templateId.
401Missing authorization value.
403Invalid API key.
404Template not found or not owned by this account.
405Unsupported HTTP method.
500Unexpected server error.

Integration examples

Node.js

const response = await fetch('https://linkopdf.com/api/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${process.env.LINKOPDF_API_KEY}`
  },
  body: JSON.stringify({ templateId: process.env.LINKOPDF_TEMPLATE_ID })
});
const result = await response.json();
if (!response.ok) throw new Error(result.error);
const template = result.template;

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    'https://linkopdf.com/api/generate',
    data=json.dumps({'templateId': os.environ['LINKOPDF_TEMPLATE_ID']}).encode(),
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer ' + os.environ['LINKOPDF_API_KEY'],
    },
    method='POST',
)
with urllib.request.urlopen(request, timeout=30) as response:
    template = json.load(response)['template']

To generate invoices from spreadsheet rows, use the visual template builder and its export controls.