Label PDF (thermal printer) API
Thermal printer labels as PDF: shipping labels with COD, Code 128 and QR, price tags with EAN-13, Vietnamese import stickers, custom; batch to multi-page.
Choose a template and a size (100x150, 100x100, 76x130, 75x50, 50x30, a6 or any WIDTHxHEIGHT in mm) and send one label as fields or many as labels (one page each, copies per label, up to 500 pages). Templates: shipping (self-delivery waybill: shop / carrier, date, order code as Code 128, receiver in large type, sender, COD amount with the amount in Vietnamese words, weight, contents, note and a QR code), price (product name, price in VND, optional crossed-out old price and unit, EAN-13 when the barcode has 12–13 digits, else Code 128), aux (Vietnamese auxiliary label of imported goods from the same fields as vn-label-rules, with missing mandatory fields reported in x-warnings) and custom (title, lines, barcode, QR).
Text is set in Be Vietnam Pro (full Vietnamese, embedded as a subset) and shrinks to fit the label; barcodes and QR codes are vector shapes, so they print sharp at 203 or 300 dpi. The EAN-13 check digit is verified (12 digits: it is added). The response is application/pdf, or JSON with the PDF in base64 with format=json. Print at 100 % scale (no "fit to page") on the matching label stock.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
template | body | string | no | shipping | shipping, price, aux or custom (also per label). |
size | body | string | no | 100x150 | 100x150, 100x100, 76x130, 75x50, 50x30, a6 or WIDTHxHEIGHT in mm. |
labels | body | array | no | Labels (one page each). Shipping: sender, receiver {name, phone, address}, order_code, cod, weight (g), items / content, note, shop, date, qr. Price: name, price, old_price, unit, barcode. Aux: group + label fields of vn-label-rules. Custom: title, lines, barcode, qr. copies per label. | |
rotate | body | boolean | no | false | Swap width and height (landscape). |
format | body | string | no | pdf | pdf or json (base64). |
Example
curl -X POST "https://apibox.io.vn/v1/label-pdf" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template":"shipping","size":"100x150","labels":[{"shop":"Shop Hoa Mai","date":"11/11/2026","order_code":"DH20261111-001","sender":{"name":"Shop Hoa Mai","phone":"0901234567","address":"12 Nguyễn Huệ, Phường Sài Gòn, TP. Hồ Chí Minh"},"receiver":{"name":"Nguyễn Thị Lan","phone":"0912345678","address":"Số 5 ngõ 12 Phố Huế, Phường Hai Bà Trưng, Hà Nội"},"cod":350000,"weight":1200,"items":[{"name":"Áo thun","quantity":2}],"note":"Cho xem hàng"}]}' \
-o outputconst res = await fetch('https://apibox.io.vn/v1/label-pdf', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"template": "shipping",
"size": "100x150",
"labels": [
{
"shop": "Shop Hoa Mai",
"date": "11/11/2026",
"order_code": "DH20261111-001",
"sender": {
"name": "Shop Hoa Mai",
"phone": "0901234567",
"address": "12 Nguyễn Huệ, Phường Sài Gòn, TP. Hồ Chí Minh"
},
"receiver": {
"name": "Nguyễn Thị Lan",
"phone": "0912345678",
"address": "Số 5 ngõ 12 Phố Huế, Phường Hai Bà Trưng, Hà Nội"
},
"cod": 350000,
"weight": 1200,
"items": [
{
"name": "Áo thun",
"quantity": 2
}
],
"note": "Cho xem hàng"
}
]
}),
});
const blob = await res.blob();import requests
res = requests.post(
"https://apibox.io.vn/v1/label-pdf",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"template": "shipping", "size": "100x150", "labels": [{"shop": "Shop Hoa Mai", "date": "11/11/2026", "order_code": "DH20261111-001", "sender": {"name": "Shop Hoa Mai", "phone": "0901234567", "address": "12 Nguyễn Huệ, Phường Sài Gòn, TP. Hồ Chí Minh"}, "receiver": {"name": "Nguyễn Thị Lan", "phone": "0912345678", "address": "Số 5 ngõ 12 Phố Huế, Phường Hai Bà Trưng, Hà Nội"}, "cod": 350000, "weight": 1200, "items": [{"name": "Áo thun", "quantity": 2}], "note": "Cho xem hàng"}]},
timeout=30,
)
open("output", "wb").write(res.content)<?php
$ch = curl_init('https://apibox.io.vn/v1/label-pdf');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"template":"shipping","size":"100x150","labels":[{"shop":"Shop Hoa Mai","date":"11/11/2026","order_code":"DH20261111-001","sender":{"name":"Shop Hoa Mai","phone":"0901234567","address":"12 Nguyễn Huệ, Phường Sài Gòn, TP. Hồ Chí Minh"},"receiver":{"name":"Nguyễn Thị Lan","phone":"0912345678","address":"Số 5 ngõ 12 Phố Huế, Phường Hai Bà Trưng, Hà Nội"},"cod":350000,"weight":1200,"items":[{"name":"Áo thun","quantity":2}],"note":"Cho xem hàng"}]}',
]);
$response = curl_exec($ch);
file_put_contents('output', $response);Response
binary application/pdf
Use cases
- Print waybills for orders a shop delivers itself
- Make shelf price tags with barcodes for a small store
- Print Vietnamese stickers for imported goods
- Batch-print warehouse location labels with QR codes
FAQ
Which printers work?
Any printer that prints PDF on label stock: thermal printers (Xprinter, HPRT, Zebra…) at 203 or 300 dpi, or A4 label sheets when you choose a custom size. Print at 100 % scale.
Can I print many labels at once?
Yes: send "labels" as an array (up to 500 pages, "copies" per label). Each label is one page of the PDF.
Which barcodes are supported?
Code 128 (order codes, SKUs) and EAN-13 (product barcodes, check digit verified), plus QR codes.
Related APIs
Image Metadata & EXIF
Read image dimensions, format, EXIF camera data, capture settings and GPS location from JPEG, PNG, WebP, HEIC, AVIF, GIF and more – upload or URL.
PDFPDF Metadata
Read PDF metadata: page count, title, author, creator, producer, dates, PDF version, encryption, form fields and the size of each page (A4, Letter…).
PDF₫Quote & Receipt PDF
Generate clean PDF quotations, receipts, orders and simple invoices from JSON, with Vietnamese text, VAT, totals in words and a VietQR code for payment.