How to convert ZPL to PDF with the API
Converting ZPL to PDF programmatically is one POST request: send the ZPL as the request body to /api/v2/convert/zpl/to/pdf, and the response body is the PDF bytes.
curl -X POST "https://api.labelzoom.com/api/v2/convert/zpl/to/pdf?label.width=4&label.height=6&dpi=203" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: text/plain" \ --data-binary @label.zpl \ --output label.pdf--data-binary @label.zpl sends a file’s contents; use -d '<zpl>' for inline code. Get a key from your dashboard (free registration).
Handling the response
Section titled “Handling the response”- 200 — the body is the PDF. Save it or stream it onward; the
X-LZ-Request-IDheader identifies the conversion for support. - 400 — the ZPL didn’t parse; the body describes the problem. Validate suspicious input in the ZPL viewer first.
- 401 / 403 / 413 / 429 — auth, plan, size, or rate-limit issues; see Errors.
Sizing and density
Section titled “Sizing and density”Match label.width/label.height (inches) and dpi (152/203/300/600) to the label the ZPL was authored for. A 300-dpi label rendered at 203 dpi comes out visibly shrunken — the most common integration bug. Details: previewing without a printer.
Batch conversion tips
Section titled “Batch conversion tips”- Reuse HTTP connections (keep-alive / a shared client instance) — TLS setup dominates otherwise.
- Convert concurrently within your plan’s throughput; back off on
429. - Multi-page: ZPL containing multiple
^XA...^XZblocks renders as a multi-page PDF on plans that support it (Basic+). - For occasional conversions, skip the code entirely: the web converter is free.
Language-specific examples: JavaScript · Python · Java · C#.