Developer integration

Use the arkalabel ZPL API with Node.js

Render ZPL to PNG or PDF from Node.js. Keep API keys on the server, send the ZPL as the request body, and treat the response as binary label data.

Prerequisite

Node.js 18+ (native fetch)

First render

import { writeFile } from "node:fs/promises";

const response = await fetch("https://api.arkalabel.io/v1/printers/8dpmm/labels/4x6/0/", {
  method: "POST",
  headers: { Accept: "application/pdf", "X-API-Key": process.env.ARKALABEL_KEY },
  body: "^XA^FO50,50^A0N,40,40^FDHello^FS^XZ",
});
if (!response.ok) throw new Error((await response.json()).error);
await writeFile("label.pdf", Buffer.from(await response.arrayBuffer()));

The density, label size and page are in the URL (8dpmm, 4x6, 0); the output format is the Accept header, image/png or application/pdf.

Production integration notes

Send the complete ZPL document in the request body rather than putting it in a URL. This avoids URL-length limits and reduces the chance that label contents are captured in proxy or browser history logs. Keep the API key in an environment variable or server-side secret store; browser code should call your own authenticated backend.

Choose the density that matches the target printer. A 203 dpi printer is approximately 8 dpmm, 300 dpi is approximately 12 dpmm, and 600 dpi is approximately 24 dpmm. Because ZPL coordinates are dots, changing density can affect the physical size and the appearance of bitmap fonts and embedded graphics. Test a representative label at the final density.

For resilient services, set a timeout, handle non-success responses as structured errors, and retry only transient failures with exponential backoff. Do not blindly retry validation failures or quota errors. For batch jobs, record the label index and preserve the response content type so PDF output is not accidentally saved with a PNG extension.

Next steps

Use the label API reference for request fields and limits, or test the same input in the browser playground before adding it to your application.