ไม่จำกัด ไม่มีลายน้ำ ไม่ต้องลงทะเบียน ลองใช้เลย

เอกสารอ้างอิง API

สร้างบาร์โค้ด Code 128 และ GS1 ผ่าน REST API ที่ใช้งานง่าย ตอบกลับเป็น JSON และดาวน์โหลดรูปภาพได้

Free: 100 คำขอ/วัน Business: 50,000 คำขอ/เดือน

เริ่มต้นอย่างรวดเร็ว

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

เอนด์พอยต์

GET /api/barcode/render ดาวน์โหลดรูปภาพบาร์โค้ด
พารามิเตอร์ชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
valuestring—จำเป็น. ข้อมูลบาร์โค้ดที่ต้องการเข้ารหัส
symbologystringCode128AutoCode128Auto, Code128A, Code128B, Code128C, GS1_128, GS1_DataMatrix, GS1_QR
formatstringPNGPNG, SVG, PDF, EPS
resolutionint300DPI: 150, 300, 600, 1200
xDimensiondecimal0.33ความกว้างโมดูลบาร์ (mm)
barHeightdecimal25.4ความสูงของแท่ง (mm)
showTextbooltrueแสดงข้อความที่อ่านได้ใต้บาร์โค้ด
foregroundColorstring#000000สีของแท่ง (hex)
backgroundColorstring#FFFFFFสีพื้นหลัง (hex)
barWidthReductiondecimal0การลดความกว้างแท่งเพื่อชดเชย (mm)
POST /api/barcode/batch สร้างบาร์โค้ดหลายรายการเป็น ZIP

ส่งเนื้อหา JSON ที่มีอาร์เรย์ของค่า ระบบจะส่งคืนไฟล์ ZIP ซึ่งมีบาร์โค้ดหนึ่งรายการต่อหนึ่งค่า

{
  "values": ["SKU-001", "SKU-002", "SKU-003"],
  "symbology": "Code128Auto",
  "format": "PNG",
  "resolution": 300
}
POST /api/gs1/render สร้างบาร์โค้ด GS1 จากข้อมูลที่มีโครงสร้าง

ส่งฟิลด์ Application Identifier ของ GS1 โดย API จะจัดการการเข้ารหัส ตัวคั่น FNC1 และเลขตรวจสอบให้โดยอัตโนมัติ

{
  "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 ตรวจสอบปริมาณการใช้งานปัจจุบัน
{ "usedToday": 3, "dailyLimit": 5, "remaining": 2, "tier": "Free" }

สนามทดสอบ

ทดลองใช้ API ได้ทันที — ไม่ต้องลงทะเบียน


                

ตัวอย่างโค้ด

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)
);