APIリファレンス
Code 128およびGS1バーコードをプログラムで生成できます。JSONレスポンスと画像のダウンロードに対応したシンプルなREST APIです。
Free: 100 req/日
Business: 50,000 req/月
クイックスタート
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)
);