Get started
Quickstart
Render your first PDF in three steps. You need nothing installed except an HTTP client.
#1. Get an API key
Sign up with your email. There is no password and no credit card. Open API keys in the dashboard, create a key, and copy it. It starts with dp_live_ and is shown once.
Keep it in an environment variable:
export DEVILPDF_API_KEY="dp_live_..."#2. Render the built-in invoice
Every account can use seven starter templates: invoice, quote, receipt, statement, report, packing-slip and certificate. Send a template id and your data to POST /v1/render.
curl https://devilpdf.com/v1/render \
-H "Authorization: Bearer $DEVILPDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "invoice",
"data": {
"number": "INV-1001",
"issue_date": "2026-03-14",
"due_date": "2026-04-13",
"company": { "name": "Northwind Studio", "address": "410 Bay Street\nToronto, ON M5H 2Y4" },
"customer": { "name": "Acme Robotics Inc.", "address": "2200 Mission Street\nSan Francisco, CA 94110" },
"items": [
{ "name": "Brand identity system", "quantity": 1, "unit_price": 4800 },
{ "name": "Front-end development", "description": "Billed hourly", "quantity": 46, "unit_price": 135 }
],
"tax_rate": 13,
"tax_label": "HST"
}
}'const res = await fetch("https://devilpdf.com/v1/render", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DEVILPDF_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
template: "invoice",
data: {
number: "INV-1001",
issue_date: "2026-03-14",
due_date: "2026-04-13",
company: { name: "Northwind Studio", address: "410 Bay Street\nToronto, ON M5H 2Y4" },
customer: { name: "Acme Robotics Inc.", address: "2200 Mission Street\nSan Francisco, CA 94110" },
items: [
{ name: "Brand identity system", quantity: 1, unit_price: 4800 },
{ name: "Front-end development", description: "Billed hourly", quantity: 46, unit_price: 135 },
],
tax_rate: 13,
tax_label: "HST",
},
}),
});
const doc = await res.json();
if (!res.ok) throw new Error(doc.error.message);
console.log(doc.url);import os
import requests
res = requests.post(
"https://devilpdf.com/v1/render",
headers={"Authorization": f"Bearer {os.environ['DEVILPDF_API_KEY']}"},
json={
"template": "invoice",
"data": {
"number": "INV-1001",
"issue_date": "2026-03-14",
"due_date": "2026-04-13",
"company": {"name": "Northwind Studio", "address": "410 Bay Street\nToronto, ON M5H 2Y4"},
"customer": {"name": "Acme Robotics Inc.", "address": "2200 Mission Street\nSan Francisco, CA 94110"},
"items": [
{"name": "Brand identity system", "quantity": 1, "unit_price": 4800},
{"name": "Front-end development", "description": "Billed hourly", "quantity": 46, "unit_price": 135},
],
"tax_rate": 13,
"tax_label": "HST",
},
},
)
doc = res.json()
res.raise_for_status()
print(doc["url"])<?php
$payload = [
"template" => "invoice",
"data" => [
"number" => "INV-1001",
"issue_date" => "2026-03-14",
"due_date" => "2026-04-13",
"company" => ["name" => "Northwind Studio", "address" => "410 Bay Street\nToronto, ON M5H 2Y4"],
"customer" => ["name" => "Acme Robotics Inc.", "address" => "2200 Mission Street\nSan Francisco, CA 94110"],
"items" => [
["name" => "Brand identity system", "quantity" => 1, "unit_price" => 4800],
["name" => "Front-end development", "description" => "Billed hourly", "quantity" => 46, "unit_price" => 135],
],
"tax_rate" => 13,
"tax_label" => "HST",
],
];
$ch = curl_init("https://devilpdf.com/v1/render");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("DEVILPDF_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$doc = json_decode(curl_exec($ch), true);
echo $doc["url"];package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
payload := map[string]any{
"template": "invoice",
"data": map[string]any{
"number": "INV-1001",
"issue_date": "2026-03-14",
"due_date": "2026-04-13",
"company": map[string]any{"name": "Northwind Studio", "address": "410 Bay Street\nToronto, ON M5H 2Y4"},
"customer": map[string]any{"name": "Acme Robotics Inc.", "address": "2200 Mission Street\nSan Francisco, CA 94110"},
"items": []map[string]any{
{"name": "Brand identity system", "quantity": 1, "unit_price": 4800},
{"name": "Front-end development", "description": "Billed hourly", "quantity": 46, "unit_price": 135},
},
"tax_rate": 13,
"tax_label": "HST",
},
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://devilpdf.com/v1/render", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("DEVILPDF_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
var doc map[string]any
json.NewDecoder(res.Body).Decode(&doc)
fmt.Println(doc["url"])
}require "net/http"
require "json"
uri = URI("https://devilpdf.com/v1/render")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV['DEVILPDF_API_KEY']}"
req["Content-Type"] = "application/json"
req.body = {
template: "invoice",
data: {
number: "INV-1001",
issue_date: "2026-03-14",
due_date: "2026-04-13",
company: { name: "Northwind Studio", address: "410 Bay Street\nToronto, ON M5H 2Y4" },
customer: { name: "Acme Robotics Inc.", address: "2200 Mission Street\nSan Francisco, CA 94110" },
items: [
{ name: "Brand identity system", quantity: 1, unit_price: 4800 },
{ name: "Front-end development", description: "Billed hourly", quantity: 46, unit_price: 135 }
],
tax_rate: 13,
tax_label: "HST"
}
}.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
doc = JSON.parse(res.body)
puts doc["url"]You get a document object back. Open url to see the PDF.
{
"object": "document",
"id": "doc_nWWGc4ehhC44vpOsHFGn",
"status": "succeeded",
"format": "pdf",
"url": "https://devilpdf.com/f/doc_nWWGc4ehhC44vpOsHFGn/invoice.pdf?exp=1773532800&sig=8fe4b5c6330ae0d9427ba7e78b54a66c",
"filename": "invoice.pdf",
"pages": 1,
"bytes": 29384,
"duration_ms": 412,
"template": "invoice",
"source": "template",
"batch": null,
"metadata": null,
"error": null,
"expires_at": "2026-03-15T14:02:11.000Z",
"created_at": "2026-03-14T14:02:10.588Z",
"completed_at": "2026-03-14T14:02:11.000Z"
}The invoice template works out the subtotal, tax and total from items, so you never send totals yourself. The full list of fields it accepts is the template's sample_data: fetch it with GET /v1/templates/invoice.
#3. Get the file itself
By default you get JSON with a download link. To get the PDF bytes in the response instead, set "output": "file".
curl https://devilpdf.com/v1/render \
-H "Authorization: Bearer $DEVILPDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "template": "invoice", "data": { "number": "INV-1001" }, "output": "file" }' \
-o invoice.pdfWith "output": "file" nothing is stored on our side. The document still appears in your log, without a link.
#Next steps
- Make your own template: describe it in plain English, or write it in HTML.
- Render raw HTML or a web page without a template.
- Read the full render reference.
- Generating many documents at once? Use async and batch.