curl -X POST https://api.postbuddy.nl/v1/templates/tpl_01J9Y2K8QF4T6W8Z0B2D4F6H8K/versions/tv_01J9Y2K8QF4T6W8Z0B2D4F6H8K/previews \
-H "Authorization: Bearer $POSTBUDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": {
"first_name": "Sanne"
},
"recipient": {
"name": "Sanne de Vries",
"addressLine1": "Oudegracht 112",
"postalCode": "3511 AX",
"city": "Utrecht",
"country": "NL"
},
"side": "first_name",
"dpi": 36,
"qrShortUrl": "https://example.com/r/Fq3ZtR8w"
}'
import { PostBuddyClient } from '@postbuddy/sdk';
const client = new PostBuddyClient({ apiKey: process.env.POSTBUDDY_API_KEY! });
const result = await client.renders.preview('tpl_01J9Y2K8QF4T6W8Z0B2D4F6H8K', 'tv_01J9Y2K8QF4T6W8Z0B2D4F6H8K', {
body: {
variables: {
first_name: 'Sanne',
},
recipient: {
name: 'Sanne de Vries',
addressLine1: 'Oudegracht 112',
postalCode: '3511 AX',
city: 'Utrecht',
country: 'NL',
},
side: 'first_name',
dpi: 36,
qrShortUrl: 'https://example.com/r/Fq3ZtR8w',
},
});
import os
from postbuddy import Client
client = Client(os.environ["POSTBUDDY_API_KEY"])
result = client.renders.preview("tpl_01J9Y2K8QF4T6W8Z0B2D4F6H8K", "tv_01J9Y2K8QF4T6W8Z0B2D4F6H8K", {
"variables": {
"first_name": "Sanne",
},
"recipient": {
"name": "Sanne de Vries",
"addressLine1": "Oudegracht 112",
"postalCode": "3511 AX",
"city": "Utrecht",
"country": "NL",
},
"side": "first_name",
"dpi": 36,
"qrShortUrl": "https://example.com/r/Fq3ZtR8w",
})
{
"id": "obj_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"kind": "preview",
"templateId": "tpl_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"templateVersionId": "tv_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"status": "READY",
"params": {
"variables": {
"first_name": "Sanne"
},
"recipient": {
"name": "Sanne de Vries",
"addressLine1": "Oudegracht 112",
"addressLine2": "2nd floor",
"postalCode": "3511 AX",
"city": "Utrecht",
"country": "NL"
},
"side": "Example",
"dpi": 1,
"qrShortUrl": "https://example.com/r/Fq3ZtR8w"
},
"urls": {
"key": "https://example.com/r/Fq3ZtR8w"
},
"issues": [
{
"code": "validation_failed",
"severity": "error",
"message": "The postal code is not valid",
"elementId": "el_01J9Y2K8QF4T6W8Z0B2D4F6H8K"
}
],
"error": "Example",
"createdAt": "2026-10-16T09:14:02.000Z",
"finishedAt": "2026-10-16T09:14:02.000Z"
}
{
"id": "obj_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"kind": "preview",
"templateId": "tpl_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"templateVersionId": "tv_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"status": "READY",
"params": {
"variables": {
"first_name": "Sanne"
},
"recipient": {
"name": "Sanne de Vries",
"addressLine1": "Oudegracht 112",
"addressLine2": "2nd floor",
"postalCode": "3511 AX",
"city": "Utrecht",
"country": "NL"
},
"side": "Example",
"dpi": 1,
"qrShortUrl": "https://example.com/r/Fq3ZtR8w"
},
"urls": {
"key": "https://example.com/r/Fq3ZtR8w"
},
"issues": [
{
"code": "validation_failed",
"severity": "error",
"message": "The postal code is not valid",
"elementId": "el_01J9Y2K8QF4T6W8Z0B2D4F6H8K"
}
],
"error": "Example",
"createdAt": "2026-10-16T09:14:02.000Z",
"finishedAt": "2026-10-16T09:14:02.000Z"
}
{
"type": "https://docs.postbuddy.nl/errors/not_found",
"title": "Not found",
"status": 404,
"code": "not_found",
"detail": "Not found",
"requestId": "req_01J9Y2K8QF4T6W8Z0B2D4F6H8K"
}
{
"type": "https://docs.postbuddy.nl/errors/validation_failed",
"title": "Validation failed",
"status": 422,
"code": "validation_failed",
"detail": "Validation failed",
"requestId": "req_01J9Y2K8QF4T6W8Z0B2D4F6H8K",
"errors": [
{
"field": "recipient.postalCode",
"code": "invalid_string",
"message": "Invalid postal code"
}
]
}