Referensi API
Hasilkan barcode Code 128 dan GS1 secara terprogram. REST API sederhana dengan respons JSON dan unduhan gambar.
Free: 100 req/hari
Business: 50.000 req/bulan
Mulai Cepat
curl"https://www.barcode-code128.com/api/barcode/render?value=HELLO-WORLD&format=PNG&resolution=300"--outputbarcode.png
Endpoint
GET
/api/barcode/render
Unduh gambar barcode
| Parameter | Tipe | Default | Deskripsi |
|---|---|---|---|
| value | string | — | Wajib. Konten barcode yang akan dikodekan. |
| symbology | string | Code128Auto | Code128Auto, Code128A, Code128B, Code128C, GS1_128, GS1_DataMatrix, GS1_QR |
| format | string | PNG | PNG, SVG, PDF, EPS |
| resolution | int | 300 | DPI: 150, 300, 600, 1200 |
| xDimension | decimal | 0.33 | Lebar modul batang dalam mm |
| barHeight | decimal | 25.4 | Tinggi batang dalam mm |
| showText | bool | true | Tampilkan teks yang dapat dibaca manusia di bawah barcode |
| foregroundColor | string | #000000 | Warna batang (hex) |
| backgroundColor | string | #FFFFFF | Warna latar belakang (hex) |
| barWidthReduction | decimal | 0 | Koreksi cetak dalam mm |
POST
/api/barcode/batch
Buat beberapa barcode sebagai ZIP
Kirim body JSON dengan larik nilai. Mengembalikan file ZIP berisi satu barcode per nilai.
{
"values": ["SKU-001", "SKU-002", "SKU-003"],
"symbology": "Code128Auto",
"format": "PNG",
"resolution": 300
}
POST
/api/gs1/render
Buat barcode GS1 dari data terstruktur
Kirim bidang Application Identifier GS1. API menangani pengodean, pemisah FNC1, dan digit cek.
{
"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
Periksa penggunaan Anda saat ini
{ "usedToday": 3, "dailyLimit": 5, "remaining": 2, "tier": "Free" }
Playground
Coba API langsung — tanpa perlu mendaftar.
progress_activity
api
Kirim permintaan untuk melihat hasilnya di sini.
Contoh Kode
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)
);