Update a template
curl --request PATCH \
--url https://api.pdfbase.dev/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"html": "<string>",
"css": "<string>",
"schema": {},
"defaults": {},
"sample_data": {},
"description": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/templates/{id}"
payload = {
"name": "<string>",
"html": "<string>",
"css": "<string>",
"schema": {},
"defaults": {},
"sample_data": {},
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
html: '<string>',
css: '<string>',
schema: {},
defaults: {},
sample_data: {},
description: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/templates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'html' => '<string>',
'css' => '<string>',
'schema' => [
],
'defaults' => [
],
'sample_data' => [
],
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/templates/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.pdfbase.dev/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyTemplates
Update a template
Update a template’s HTML, CSS, schema, or defaults. Increments the version number.
PATCH
/
v1
/
templates
/
{id}
Update a template
curl --request PATCH \
--url https://api.pdfbase.dev/v1/templates/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"html": "<string>",
"css": "<string>",
"schema": {},
"defaults": {},
"sample_data": {},
"description": "<string>"
}
'import requests
url = "https://api.pdfbase.dev/v1/templates/{id}"
payload = {
"name": "<string>",
"html": "<string>",
"css": "<string>",
"schema": {},
"defaults": {},
"sample_data": {},
"description": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
html: '<string>',
css: '<string>',
schema: {},
defaults: {},
sample_data: {},
description: '<string>'
})
};
fetch('https://api.pdfbase.dev/v1/templates/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pdfbase.dev/v1/templates/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'html' => '<string>',
'css' => '<string>',
'schema' => [
],
'defaults' => [
],
'sample_data' => [
],
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pdfbase.dev/v1/templates/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.pdfbase.dev/v1/templates/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdfbase.dev/v1/templates/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"html\": \"<string>\",\n \"css\": \"<string>\",\n \"schema\": {},\n \"defaults\": {},\n \"sample_data\": {},\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPhase
Phase 1 (Launch)Path parameters
string
required
Template ID, e.g.,
tpl_abc123.Request
All fields are optional. Only include the fields you want to change.string
Updated name.
string
Updated HTML content.
string
Updated CSS.
object
Updated schema. Existing PDFs generated with the old schema are unaffected.
object
Updated default rendering options.
object
Updated sample data.
string
Updated description.
Response
Returns the full updated template. Theversion field is incremented.
{
"id": "tpl_abc123",
"object": "template",
"name": "invoice",
"version": 4,
"updated_at": "2026-05-23T09:15:00Z",
...
}
Template updates are not retroactive. PDFs already generated from the old version are unaffected. The
template.version field on each PDF records which version was used.Example
curl -X PATCH https://api.pdfbase.dev/v1/templates/tpl_abc123 \
-H "Authorization: Bearer pk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Updated Invoice #{{number}}</h1>...",
"defaults": { "compress": "high" }
}'