# Barcode Generator - 15 Symbologies, Real Check Digits (`eliai/barcode-generator`) Actor

Barcode PNGs by API: QR, Code128, EAN-13/8, UPC-A/E, ITF-14, DataMatrix, PDF417, Aztec + more (bwip-js engine). Retail check digits VALIDATED — a wrong EAN check digit is rejected free, not rendered broken (release-tested). $0.0015 per barcode vs $0.002-$0.004 measured incumbents. 50 per run.

- **URL**: https://apify.com/eliai/barcode-generator.md
- **Developed by:** [Broke to Built](https://apify.com/eliai) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 generated barcodes

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Barcode Generator — 15 Symbologies, Check Digits Actually Validated

Generate barcode PNGs by API across 15 symbologies: **QR, Code 128, EAN-13, EAN-8, UPC-A, UPC-E, Code 39, Code 93, ITF-14, Interleaved 2-of-5, MSI, Codabar, Data Matrix, PDF417, Aztec.** Built on bwip-js (pinned 4.7.0), the reference barcode engine — which means retail codes get **real check-digit validation**: an EAN-13 with a wrong check digit is rejected with an error, not rendered into a barcode that scanners will reject at the till. Up to 50 per run, PNGs delivered as hosted URLs. Online, by API, or as an agent tool via Apify MCP.

### Which symbologies validate vs just encode — stated plainly

- **Validated (structure + check digit enforced by the engine):** EAN-13, EAN-8, UPC-A, UPC-E, ITF-14 — wrong length or wrong check digit = rejected free. Our release test proves it: `4006381333931` renders, `…930` (corrupted check digit) is refused.
- **Encoded with internal checksums the engine computes for you:** Code 128, Code 93, PDF417, QR, Data Matrix, Aztec (their checksums/ECC are part of the format — you can't get them wrong).
- **Rendered as given (no check digit in the standard, or optional):** Code 39, Codabar, MSI, Interleaved 2-of-5 (non-ITF14). These encode what you send.

### What you get

- **pngUrl** — a hosted PNG per barcode (signed URL from the run's key-value store) + `bytes`
- Options: `scale` (1-10), `height` (linear codes), `includeText` (human-readable line)
- Mixed batches: per-item `type` overrides the run default
- **Fail-soft**: invalid data for a symbology never fails the run — `{ok: false, error}` with the engine's exact reason, **never charged**.

### Input

```json
{ "items": [
  { "text": "4006381333931", "type": "ean13" },
  { "text": "https://yoursite.com/p/123", "type": "qr" },
  { "text": "PKG-2024-00042", "type": "code128" }
] }
```

### Output (real run)

```json
{
  "text": "4006381333931",
  "ok": true,
  "type": "ean13",
  "pngUrl": "https://api.apify.com/v2/key-value-stores/.../records/barcode-1-ean13-4006381333931.png?signature=...",
  "bytes": 2748
}
```

### Pricing

**$0.0015 per barcode rendered.** Invalid data and wrong check digits are never charged.

Measured against store incumbents (2026-08-07): scrapemint/bulk-barcode-generator charges $0.002 per barcode, toolsnmoreapi $0.001 start + $0.003 per item. A 50-label batch here costs $0.075.

### Honest limits

- PNG output only (no SVG/EPS yet).
- PNG URLs are signed store links tied to your run's storage retention — download them into your own storage for long-term use.
- GS1 application-identifier composition (GS1-128 with AIs) is not assembled for you — send the full encoded string.

### FAQ

**What happens if I send 12 digits for EAN-13?**
bwip-js computes the check digit for you and renders a valid 13-digit code. Send 13 and the last digit is verified — mismatch = rejection, not a broken label.

**Can I mix symbologies in one batch?**
Yes — per-item `type`; the run-level `type` is just the default.

**Are the QR codes scannable at print size?**
Use `scale` 3+ for print (each module ≥3px); the default is print-safe. Error correction is the engine's standard level.

**Which type should I use for internal SKUs?**
Code 128 — full ASCII, compact, and its checksum is computed automatically.

**Why did some rows come back `ok: false`?**
The data was invalid for that symbology (wrong length, wrong charset, wrong check digit) — the error is the engine's exact reason. Never charged.

### Use from code or AI agents

```bash
curl -s "https://api.apify.com/v2/acts/EliAI~barcode-generator/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -X POST -H 'Content-Type: application/json' \
  -d '{"items": [{"text": "4006381333931", "type": "ean13"}]}'
```

Agents: connect [Apify MCP](https://mcp.apify.com) and call the `EliAI/barcode-generator` tool.

- **Capability:** render barcode PNGs across 15 symbologies with engine-level validation (check digits enforced on retail codes)
- **Required input:** `text` (string) or `items` (array); optional `type` (default code128), `scale`, `height`, `includeText`
- **Returns:** one record per barcode; `pngUrl` is the deliverable
- **Bounded:** 50 barcodes per run; failures isolate per item
- **Side effects:** PNGs written to your run's own key-value store only

# Actor input Schema

## `text` (type: `string`):

The data to encode into the barcode (e.g. a product code, URL, or number). Required unless you provide "items".

## `type` (type: `string`):

Barcode type. Supported: code128, ean13, ean8, upca, upce, code39, code93, itf14, interleaved2of5, msi, qrcode, datamatrix, pdf417, azteccode, codabar.

## `scale` (type: `integer`):

Pixel scale factor (1-10). Higher = larger image.

## `height` (type: `integer`):

Height of the bars in millimeters for linear barcodes (ignored for 2D codes like QR/DataMatrix).

## `includeText` (type: `boolean`):

Render the encoded value as a text label under the barcode.

## `items` (type: `array`):

Generate many barcodes at once. Each item is either a string (uses the defaults above) or an object like {"text":"...","type":"qrcode"}. Capped at 50 per run.

## Actor input object example

```json
{
  "text": "ELI-0001-2026",
  "type": "code128",
  "scale": 3,
  "height": 10,
  "includeText": true,
  "items": []
}
```

# Actor output Schema

## `results` (type: `string`):

Every item this run produced, as JSON.

## `resultsCsv` (type: `string`):

The same items as a spreadsheet-ready CSV.

## `files` (type: `string`):

Files this run produced (images, screenshots, reports).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "text": "ELI-0001-2026"
};

// Run the Actor and wait for it to finish
const run = await client.actor("eliai/barcode-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "text": "ELI-0001-2026" }

# Run the Actor and wait for it to finish
run = client.actor("eliai/barcode-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "text": "ELI-0001-2026"
}' |
apify call eliai/barcode-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,eliai/barcode-generator"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/31wpSFheRPs5kHYmH/builds/tdeZHxcr8IHcSQaWd/openapi.json
