Barcode Generator API

Create Code 128 barcodes for labels, SKUs and shipping with a single request. SVG with human-readable text or PNG, custom height, width and colours.

GETPOSThttps://apibox.io.vn/v1/barcode
Images & Codes▶ Try it online

The Barcode API generates Code 128 barcodes, the most widely used linear barcode for shipping labels, warehouse SKUs, invoices and internal asset tags. Send GET /v1/barcode?text=ABC-12345 and receive a crisp SVG image; add format=png for a bitmap.

The encoder automatically switches between Code 128 set B (all printable ASCII characters) and set C (pairs of digits) so long numeric runs produce a compact barcode, and it calculates the check digit for you. The text can be up to 80 printable ASCII characters; accented or non-Latin characters are rejected with a clear error.

Options: height of the bars (20–600 px, default 80), module_width (1–10 px per narrow bar, default 2), foreground color and background, and show_text=false to hide the human-readable line printed under the SVG barcode (PNG output contains the bars only).

Parameters

NameInTypeRequiredDefault
textbody|querystringyesContent to encode: printable ASCII, max 80 characters.
formatbody|querystringnosvgsvg or png.
heightbody|querynumberno80Bar height in pixels (20–600).
module_widthbody|querynumberno2Width of the narrowest bar in pixels (1–10).
colorbody|querystringno000000Bar colour (hex or basic colour name).
backgroundbody|querystringnoffffffBackground colour.
show_textbody|querybooleannotruePrint the text under the barcode (SVG only).

Example

curl "https://apibox.io.vn/v1/barcode?text=ABC-12345&height=80" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -o output

Response

binary image/svg+xml (Code 128 barcode)

Use cases

  • Print shipping and warehouse labels from your order system
  • Generate SKU barcodes for products in an online shop or POS
  • Add a scannable invoice or order number to PDF documents
  • Tag equipment and inventory with internal asset IDs

FAQ

Which barcode symbology does the API produce?

Code 128 (sets B and C with automatic switching). It is read by virtually every handheld and camera scanner. EAN-13/UPC and 2D formats other than QR are not generated; use /v1/qr for QR codes.

Can I encode Vietnamese or other accented characters?

No. Code 128 only covers printable ASCII (codes 32–126), so the API returns an invalid_text error. Remove diacritics or encode an ID instead.

SVG or PNG – which is better for printing?

SVG is vector and stays sharp at any print size, and it includes the human-readable text. Use PNG when the target (some label printers or e-mail clients) cannot render SVG; pick a module_width of 2–4 for good scan quality.

Related APIs

Start with 1,000 free requests every month. Get free API key →