Barcode
Barcode is an API that generates a PNG image of a barcode (not QR: see QR code for that) from a text or number: for product labels, inventory, tickets, or anything you scan with a reader.
How it works
You send the data (data) and the barcode type (type), and get back a ready PNG. Defaults to Code128, the most flexible one (letters, numbers and symbols).
Available types
| Type | Typical use |
|---|---|
code128 | The most flexible: letters, numbers and symbols. Default. |
code39 | Classic, uppercase letters and numbers. |
ean13 / ean8 | Retail products (the barcode you see at a supermarket). |
upca / upce | Like EAN, the usual US standard. |
itf14 | Boxes and logistics packaging. |
datamatrix | Small, dense 2D code (parts, electronic components). |
pdf417 | High-capacity 2D code (ID cards, boarding passes). |
aztec | 2D code widely used on train tickets. |
Each type requires the data to fit its format (e.g. EAN-13 needs 12 or 13 digits): if it doesn't fit, the API replies with a clear error about what's wrong, not a generic 500.
All you need
- Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
How to use it in n8n (step by step)
In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/barcode - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/json - Send Body: on → Body Content Type: JSON →
{ "data": "5901234123457", "type": "ean13" } - In Options → Response → Response Format: choose File
In Make: same method and URL, same JSON in the Body, treat the response as a binary file.
Options (inside the JSON)
| Option | Default | What it does |
|---|---|---|
data | - | Required. The text or number to encode. |
type | code128 | One from the table above. |
scale | 3 | 1 to 10: how large the image comes out. |
include_text | true | Show the readable number/text below the barcode. |
API overview
- Endpoint:
POST https://api.cofferdock.com/barcode - Auth: header
x-api-key: YOUR_KEY. - Input: JSON, or the raw data with
Content-Type: text/plain(options as query params). - Engine: bwip-js, pure JS (no native binaries or external service).
- Output: always PNG.
- Limits: 30 requests/min per IP. Up to 500 characters of data. 1 call = 1 credit.
Examples
curl:
curl -X POST "https://api.cofferdock.com/barcode" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"data":"5901234123457","type":"ean13"}' \
--output barcode.png
JavaScript (Node 18+):
const r = await fetch('https://api.cofferdock.com/barcode', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ data: '5901234123457', type: 'ean13', output: 'image' }),
});
const buffer = Buffer.from(await r.arrayBuffer());
Response
{ "success": true, "image": "iVBORw0KGgo...", "mime_type": "image/png",
"meta": { "type": "ean13", "size_bytes": 2588, "used": 12, "remaining": 488 } }
What you get back
By default (JSON): image as base64. Add output=image for the raw binary, or output=url for a temporary link (valid 15 minutes).