Riferimento API
Generazione programmatica di codici a barre Code 128 e GS1. Una semplice API REST con risposte JSON e download di immagini.
Free: 100 req/giorno
Business: 50.000 req/mese
Avvio rapido
curl"https://www.barcode-code128.com/api/barcode/render?value=HELLO-WORLD&format=PNG&resolution=300"--outputbarcode.png
Endpoint
GET
/api/barcode/render
Scaricare un'immagine di codice a barre
| Parametro | Tipo | Predefinito | Descrizione |
|---|---|---|---|
| value | string | — | Obbligatorio. Contenuto del codice a barre da codificare. |
| 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 | Larghezza del modulo in mm |
| barHeight | decimal | 25.4 | Altezza delle barre in mm |
| showText | bool | true | Visualizzazione del testo leggibile sotto il codice a barre |
| foregroundColor | string | #000000 | Colore delle barre (hex) |
| backgroundColor | string | #FFFFFF | Colore di sfondo (hex) |
| barWidthReduction | decimal | 0 | Correzione di stampa in mm |
POST
/api/barcode/batch
Generazione di più codici a barre in un file ZIP
Invii un corpo JSON con un array di valori. Restituisce un file ZIP contenente un codice a barre per valore.
{
"values": ["SKU-001", "SKU-002", "SKU-003"],
"symbology": "Code128Auto",
"format": "PNG",
"resolution": 300
}
POST
/api/gs1/render
Generare un codice GS1 da dati strutturati
Invii i campi degli identificatori di applicazione GS1. L'API gestisce la codifica, i separatori FNC1 e le cifre di controllo.
{
"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
Verificare l'utilizzo attuale
{ "usedToday": 3, "dailyLimit": 5, "remaining": 2, "tier": "Free" }
Area di test
Provi l'API dal vivo — senza necessità di registrazione.
progress_activity
api
Invii una richiesta per visualizzare qui il risultato.
Esempi di codice
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)
);