Templates
Generate PDF
Generate custom PDFs with text, barcodes (Code128), QR codes, DataMatrix codes, and lines using explicit x,y positioning. This endpoint is useful for creating shipping labels, asset tags, inventory bin labels, and other custom documents.
Authentication
This endpoint requires authentication with an API key that has the templates:write scope.
Performance
PDF generation runs in a dedicated worker thread, ensuring non-blocking operation even for complex documents with many elements. The generated PDF is uploaded to cloud storage and a public URL is returned.
Request Body
Page Sizes
Note: 72 points = 1 inch. Coordinates use top-left origin with Y increasing downward.
Element Types
Text Element
Code128 Barcode
QR Code
DataMatrix Code
Line
Font Families
Use mono for tracking numbers, SKUs, and other codes where character alignment matters.
Text Alignment
Note: When using center or right alignment, the x coordinate becomes the anchor point for alignment rather than the text starting position.
Example Request - Shipping Label
Example Request - Asset Tag with Font Families
Response
Partial Success Response
If some elements fail to render but the PDF is still generated:
Error Responses
Empty Raw Array (400)
Custom Size Missing Dimensions (400)
Invalid Color Format (400)
Invalid Font Family (400)
Too Many Elements (400)
Example Request - Inventory Bin Label
Example Request - Text Alignment
Example Request - Rotated Label Elements
Best Practices
Coordinate System
- All coordinates are in points (72 points = 1 inch)
- The origin (0, 0) is at the top-left corner
- X increases to the right, Y increases downward
- Elements are positioned by their top-left corner
Element Ordering
Elements are rendered in the order they appear in the raw array. Later elements will appear on top of earlier ones if they overlap.
Font Selection
- Use
inter(default) for general text - it has excellent readability at all sizes - Use
mono(Fira Mono) for tracking numbers, SKUs, and codes where character alignment is important
Barcode Best Practices
- Ensure barcode values contain only valid characters for the barcode type
- Code128 supports alphanumeric characters
- QR codes can encode URLs, text, or binary data
- DataMatrix codes are ideal for small spaces with high data density
Performance Tips
- Keep the number of elements under 100 for optimal performance
- Use the smallest appropriate page size for your use case
- Pre-validate barcode values before sending to avoid partial success responses