Không giới hạn. Không hình mờ. Không cần đăng ký. Miễn phí cho tất cả mọi người đến ngày 22 tháng 4. Dùng thử ngay

Tài liệu API

Generate Code 128 and GS1 barcodes programmatically. Simple REST API with JSON responses and image downloads.

Free: 100 req/day Business: 50,000 req/month

Bắt đầu nhanh

curl "https://www.barcode-code128.com/api/barcode/render?value=HELLO-WORLD&format=PNG&resolution=300" --output barcode.png

Điểm cuối

GET /api/barcode/render Download a barcode image
ParameterTypeDefaultDescription
valuestringRequired. The barcode content to encode.
symbologystringCode128AutoCode128Auto, Code128A, Code128B, Code128C, GS1_128, GS1_DataMatrix, GS1_QR
formatstringPNGPNG, SVG, PDF, EPS
resolutionint300DPI: 150, 300, 600, 1200
xDimensiondecimal0.33Bar module width in mm
barHeightdecimal25.4Bar height in mm
showTextbooltrueShow human-readable text below barcode
foregroundColorstring#000000Bar color (hex)
backgroundColorstring#FFFFFFBackground color (hex)
barWidthReductiondecimal0Print correction in mm
POST /api/barcode/batch Generate multiple barcodes as ZIP

Send a JSON body with an array of values. Returns a ZIP file containing one barcode per value.

{
  "values": ["SKU-001", "SKU-002", "SKU-003"],
  "symbology": "Code128Auto",
  "format": "PNG",
  "resolution": 300
}
POST /api/gs1/render Generate a GS1 barcode from structured data

Send GS1 Application Identifier fields. The API handles encoding, FNC1 separators, and check digits.

{
  "fields": [
    { "ai": "01", "value": "05412345000013" },
    { "ai": "10", "value": "LOT-A23" },
    { "ai": "17", "value": "260731" }
  ],
  "symbology": "GS1_128",
  "format": "PNG",
  "resolution": 300
}
GET /api/barcode/quota Check your current usage
{ "usedToday": 3, "dailyLimit": 5, "remaining": 2, "tier": "Free" }

Sân thử nghiệm

Try the API live — no signup required.


                

Ví dụ mã nguồn

cURL
curl "https://www.barcode-code128.com\
/api/barcode/render\
?value=SKU-4711\
&format=PNG\
&resolution=300" \
  --output barcode.png
Python
import requests

resp = requests.get(
    "https://www.barcode-code128.com"
    "/api/barcode/render",
    params={
        "value": "SKU-4711",
        "format": "PNG",
        "resolution": 300
    }
)

with open("barcode.png", "wb") as f:
    f.write(resp.content)
Node.js
const fs = require('fs');

const url = new URL(
  "https://www.barcode-code128.com"
  + "/api/barcode/render"
);
url.searchParams.set("value", "SKU-4711");
url.searchParams.set("format", "PNG");
url.searchParams.set("resolution", "300");

const resp = await fetch(url);
const buf = await resp.arrayBuffer();
fs.writeFileSync(
  "barcode.png",
  Buffer.from(buf)
);