مرجع API
تولید بارکدهای Code 128 و GS1 با استفاده از برنامهنویسی. REST API ساده با پاسخهای JSON و دانلود تصویر.
Free: ۱۰۰ درخواست/روز
Business: ۵۰٬۰۰۰ درخواست/ماه
شروع سریع
curl"https://www.barcode-code128.com/api/barcode/render?value=HELLO-WORLD&format=PNG&resolution=300"--outputbarcode.png
نقاط پایانی
GET
/api/barcode/render
دانلود تصویر بارکد
| پارامتر | نوع | پیشفرض | توضیحات |
|---|---|---|---|
| value | string | — | الزامی. محتوای بارکد برای کدگذاری. |
| 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 | عرض ماژول بارکد به mm |
| barHeight | decimal | 25.4 | ارتفاع میله به mm |
| showText | bool | true | نمایش متن قابلخواندن زیر بارکد |
| foregroundColor | string | #000000 | رنگ میله (hex) |
| backgroundColor | string | #FFFFFF | رنگ پسزمینه (hex) |
| barWidthReduction | decimal | 0 | تصحیح چاپ به 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 از دادههای ساختاریافته
فیلدهای شناسه کاربردی 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 را همین حالا امتحان کنید — بدون نیاز به ثبتنام.
progress_activity
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)
);