Quickstart
Generate your first PDF in under five minutes.
1. Create a template
In the dashboard, create a template from a starter (Invoice or Receipt) or describe one with AI. Open it and copy its template id from the URL.
2. Create an API key
Go to API Keysand create a key. Copy it immediately: it's shown only once and looks like dl_live_….
3. Generate a PDF
The fastest way is our official SDK (npm install @doclinth/sdk): typed, with automatic retries and idempotency.
import { Doclinth } from "@doclinth/sdk";
const doclinth = new Doclinth({
apiKey: process.env.DOCLINTH_API_KEY,
baseUrl: "https://doclinth.com",
});
const pdf = await doclinth.generate({
templateId: "YOUR_TEMPLATE_ID",
data: { invoice_number: "INV-1042", total: 2592 },
});
// → Uint8Array; write to disk, email it, or stream to your userPrefer raw HTTP? Send your data straight to the generate endpoint:
curl -X POST https://doclinth.com/v1/generate \
-H "Authorization: Bearer dl_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": "YOUR_TEMPLATE_ID",
"data": {
"invoice_number": "INV-1042",
"currency": "USD",
"customer": { "name": "Acme Corp", "email": "ap@acme.com" },
"items": [
{ "description": "Design retainer", "quantity": 1, "unit_price": 2400, "amount": 2400 }
],
"subtotal": 2400, "tax_rate": 8, "tax": 192, "total": 2592
}
}' \
--output invoice.pdfNode.js
const res = await fetch("https://doclinth.com/v1/generate", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DOCLINTH_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ template_id: "YOUR_TEMPLATE_ID", data }),
});
const pdf = Buffer.from(await res.arrayBuffer());
// → write to disk, email it, or stream to your userPython
import os, requests
res = requests.post(
"https://doclinth.com/v1/generate",
headers={"Authorization": f"Bearer {os.environ['DOCLINTH_API_KEY']}"},
json={"template_id": "YOUR_TEMPLATE_ID", "data": data},
)
res.raise_for_status()
with open("invoice.pdf", "wb") as f:
f.write(res.content)PHP (Laravel)
use Illuminate\Support\Facades\Http;
$res = Http::withToken(env('DOCLINTH_API_KEY'))
->post("https://doclinth.com/v1/generate", [
'template_id' => 'YOUR_TEMPLATE_ID',
'data' => $data,
])
->throw();
file_put_contents('invoice.pdf', $res->body());Ruby
require "net/http"
require "json"
uri = URI("https://doclinth.com/v1/generate")
res = Net::HTTP.post(
uri,
{ template_id: "YOUR_TEMPLATE_ID", data: data }.to_json,
"Authorization" => "Bearer #{ENV.fetch('DOCLINTH_API_KEY')}",
"Content-Type" => "application/json",
)
File.binwrite("invoice.pdf", res.body)That's it. See Generate a PDF for all options and Template syntax for placeholders and helpers.