# QR Code & Barcode Generator and Reader (EAN, Code128) (`br_data_hub/qr-barcode-toolkit`) Actor

Generate QR codes and barcodes (EAN-13, EAN-8, UPC-A, Code 128, Code 39, ITF, Data Matrix) as PNG or SVG with public links, or read them from image URLs: text, type and position. Check digits, colors, bulk. Pure calculation, no external data source.

- **URL**: https://apify.com/br_data_hub/qr-barcode-toolkit.md
- **Developed by:** [br_data_hub](https://apify.com/br_data_hub) (community)
- **Categories:** Developer tools, Automation, Business
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 1,000 codes

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## QR Code & Barcode Generator and Reader (EAN, Code128)

**Generate and read QR codes and barcodes in bulk.** Turn text into **PNG and SVG files** with a public link for each one, or give image URLs and get back the **text, the code type and the position** of every code found in them. Supported: **QR Code, EAN-13, EAN-8, UPC-A, Code 128, Code 39, ITF (Interleaved 2 of 5) and Data Matrix**.

It is pure calculation: no website is scraped and no external data source is used. Your texts and images are processed inside the run and nothing is kept outside your own storages.

### What you can do with it

- **Print-ready labels:** thousands of EAN-13 or Code 128 product barcodes from a list of SKUs, with the check digit added for you.
- **Marketing and events:** QR codes for URLs, Wi-Fi access (`WIFI:T:WPA;S:name;P:password;;`), vCards, payment links or tickets, in your brand colors.
- **Inventory and logistics:** read the codes from photos of shelves, labels and delivery notes, with the position of each code in the image.
- **Data cleaning:** check what a code really contains, and whether the barcode digits are valid.

### Input

Choose a **mode**.

| Field | Mode | Description |
|---|---|---|
| `mode` | both | `generate` (text to image files) or `decode` (images to text). |
| `texts` | generate | Texts to encode, one per line (up to 5,000 per run). They all use `barcodeType`. |
| `barcodeType` | generate | `qr` (default), `ean13`, `ean8`, `upca`, `code128`, `code39`, `itf` or `datamatrix`. |
| `codes` | generate | Optional objects `{"text": "...", "type": "..."}` to mix types in one run. |
| `imageFormats` | generate | `png`, `svg` or both (default both). |
| `errorCorrection` | generate | QR only: `L`, `M` (default), `Q` or `H`. |
| `scale` | generate | Pixels per module, 1 to 40 (default 6). |
| `foregroundColor`, `backgroundColor` | generate | Hex colors, default black on white. The Actor warns about low contrast and inverted colors. |
| `quietZone` | generate | Blank margin around the code (default on). |
| `humanReadableText` | generate | Print the digits under linear barcodes (default on). |
| `includeDataUri` | generate | Also return the PNG as a base64 data URI in each item. |
| `keyValueStoreName` | generate | Save the files in a named store, which is kept until you delete it. |
| `imageUrls` | decode | Image links (PNG, JPEG, GIF, WebP, BMP, TIFF), one per line, up to 2,000. `data:image/...;base64,` links also work. |
| `decodeFormats` | decode | Read only these types. Empty reads all of them. |
| `maxCodesPerImage` | decode | Most codes returned and charged per image (default 20). |

The default input generates four codes (two QR codes, an EAN-13 and a Code 128) and finishes in seconds. To try the reader, run the Actor once with `includeDataUri` on, or paste any public image link into `imageUrls` with `mode` set to `decode`.

**Barcode rules.** EAN-13, EAN-8 and UPC-A accept 12, 7 or 11 digits (the check digit is added) or the full 13, 8 or 12 digits, which are verified: a wrong check digit gives a clear error. ITF needs an even number of digits (a leading 0 is added to an odd one). Code 39 accepts capital letters, digits, space and `- . $ / + %` (lower case is converted). Code 128 accepts Latin-1 text.

### Output

One dataset item per code. In **generate** mode:

```json
{
  "input": "https://apify.com",
  "type": "qr",
  "status": "generated",
  "text": "https://apify.com",
  "format": "QR Code",
  "width": 198,
  "height": 198,
  "pngUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/qr-0001.png",
  "svgUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/qr-0001.svg",
  "generatedAt": "2026-11-05T15:12:27+00:00"
}
```

The files are saved in the run's key-value store as `<type>-<number>.png` and `.svg`, and the links in `pngUrl` and `svgUrl` open them directly. `status` is `generated`, `duplicate` (same text and type as an earlier item, see `duplicateOf`) or `error` (see `error`). `note` tells what the Actor changed, for example `Check digit 7 added.`, or warns about colors scanners may not read.

In **decode** mode each code found is one item:

```json
{
  "imageUrl": "https://example.com/label.png",
  "status": "decoded",
  "codeIndex": 1,
  "codesInImage": 1,
  "text": "5901234123457",
  "format": "EAN13",
  "formatLabel": "EAN-13",
  "contentType": "text",
  "valid": true,
  "position": {
    "topLeft": {"x": 24, "y": 40},
    "topRight": {"x": 310, "y": 40},
    "bottomRight": {"x": 310, "y": 118},
    "bottomLeft": {"x": 24, "y": 118}
  },
  "orientation": 0,
  "errorCorrection": null,
  "imageWidth": 640,
  "imageHeight": 480,
  "decodedAt": "2026-11-05T15:12:27+00:00"
}
```

`position` is in pixels of the original image; `orientation` is the rotation in degrees. Binary content comes with `bytesBase64`. An image with no readable code gives one item with `status: "no_code_found"`, and an image that could not be downloaded or opened gives `status: "error"`; neither is charged.

### How much does it cost?

Pay per event: **one `code` event per QR code or barcode generated, or per code read from an image** (PNG and SVG together are one charge). Errors, duplicates and images without a code are free. Set **Maximum cost per run** to cap spending; the Actor stops cleanly when it is reached.

The price, **US$ 0.0015 per code (US$ 1.50 per 1,000)**, was set below the other QR code Actors in the Store, which charge about US$ 2 to US$ 10 per 1,000 images. Compute is tiny (a QR code takes a few milliseconds and the Actor runs at 512 MB), so the price is far above the cost of running it.

**$0.0015 per code** (`code` event, pay per event). Charged once per QR code or barcode generated, or per code read from an image. Errors, duplicates and images with no code are free.

- `apify-actor-start`: $0.00005 (Charged once when a run starts (Apify synthetic event).)

| You get | Free tier | Bronze tier (10% off) | Gold tier (30% off) |
|---|---|---|---|
| 100 codes | $0.15 | $0.14 | $0.10 |
| 1,000 codes | $1.50 | $1.35 | $1.05 |
| 10,000 codes | $15.00 | $13.50 | $10.50 |

Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. No subscription to this Actor and no charge for platform usage: you pay only for results.
The Apify Free plan includes $5 of monthly credit, enough for about **3,333 codes** at the list price.
You can cap the cost of any run with **Maximum cost per run**; the Actor stops when it is reached.

### Data source and limits

There is no external data source. Codes are drawn and read with [ZXing-C++](https://github.com/zxing-cpp/zxing-cpp) (Apache 2.0, whose writer is built on [Zint](https://www.zint.org.uk/), BSD) and images are handled with Pillow. Decode mode only downloads the image links you give it.

- Up to 5,000 codes (generate) or 2,000 images (decode) per run; an image can be up to 15 MB. Larger jobs: run again with the next batch.
- QR text up to 2,900 characters, Data Matrix up to 1,500, Code 128 up to 200.
- Reading depends on image quality. Blurry, tiny, glared or cropped codes may not be found; the Actor also tries other rotations, inverted colors, a second threshold method and enlarges small images. A code that is not found is free, so you can retry with a better picture.
- Not supported: PDF417, Aztec, GS1 DataBar, Codabar and 2D codes with logos (put the logo on the SVG yourself and use error correction `H`). Check that a printed code scans with your own device before a large print run.
- Links to files in the default key-value store follow your Apify data-retention period; use `keyValueStoreName` for longer storage.

### Use it via API

Run it from any language and get the results as JSON. Replace `<YOUR_API_TOKEN>` with your [Apify API token](https://console.apify.com/settings/integrations).

```bash
curl -X POST "https://api.apify.com/v2/acts/br_data_hub~qr-barcode-toolkit/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"mode": "generate", "texts": ["https://apify.com", "WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;"], "barcodeType": "qr", "codes": [{"text": "5901234123457", "type": "ean13"}, {"text": "SKU-2026-001", "type": "code128"}], "imageFormats": ["png", "svg"], "errorCorrection": "M", "scale": 6, "foregroundColor": "#000000", "backgroundColor": "#FFFFFF", "quietZone": true, "humanReadableText": true, "maxCodesPerImage": 20}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("br_data_hub/qr-barcode-toolkit").call(run_input={'mode': 'generate',
                                      'texts': ['https://apify.com', 'WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;'],
                                      'barcodeType': 'qr',
                                      'codes': [{'text': '5901234123457', 'type': 'ean13'},
                                                {'text': 'SKU-2026-001', 'type': 'code128'}],
                                      'imageFormats': ['png', 'svg'],
                                      'errorCorrection': 'M',
                                      'scale': 6,
                                      'foregroundColor': '#000000',
                                      'backgroundColor': '#FFFFFF',
                                      'quietZone': True,
                                      'humanReadableText': True,
                                      'maxCodesPerImage': 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also schedule runs, send results to webhooks, or connect the Actor to Make, Zapier, n8n, Google Sheets and other [integrations](https://docs.apify.com/platform/integrations).

### Use it with AI agents (MCP)

This Actor is ready for AI agents: typed input and output schemas, pay-per-event pricing, limited permissions and short runs.

- **Apify MCP server:** add `https://mcp.apify.com/?tools=br_data_hub/qr-barcode-toolkit` to Claude, ChatGPT, Cursor, VS Code or any MCP client, and the agent can call this Actor as a tool.
- **Agent frameworks:** call it from LangChain, LlamaIndex, CrewAI or the OpenAI Agents SDK through the Apify integrations, or with the API call above.
- Results come as structured JSON with stable field names, documented in the **Output** tab.

### FAQ

#### Where does the data come from?

There is no external data source. Codes are drawn and read with [ZXing-C++](https://github.com/zxing-cpp/zxing-cpp) (Apache 2.0, whose writer is built on [Zint](https://www.zint.org.uk/), BSD) and images are handled with Pillow. Decode mode only downloads the image links you give it.

#### How much does it cost?

$0.0015 per code. Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. See **How much does it cost?** above for examples.

#### Do I pay for errors or empty results?

No. Charged once per QR code or barcode generated, or per code read from an image. Errors, duplicates and images with no code are free.

#### Can I run it on a schedule or connect it to other tools?

Yes. Use Apify schedules to run it daily or weekly, webhooks to get notified, and integrations such as Make, Zapier, n8n and Google Sheets. Everything also works through the API.

#### Can AI agents use it?

Yes. It works as a tool in the Apify MCP server and in agent frameworks, and AI agents can pay per event. See **Use it with AI agents (MCP)**.

#### Is it legal to use this data?

The Actor reads only public sources. You are responsible for how you use the data and for complying with the source's terms and with privacy laws such as GDPR.

#### I found a bug or need a feature. What should I do?

Open an issue in the **Issues** tab. We answer within 14 days, usually much sooner.

### More Actors from BR Data Hub

| Actor | What it does |
|---|---|
| [Email Validator Bulk: MX, Disposable, Typo, No SMTP](https://apify.com/br_data_hub/email-validator-bulk) | Bulk validate e-mail addresses with DNS only: RFC syntax, domain and MX records, disposable domains, role acco |
| [Website Tech Stack Detector (CMS, Analytics, CDN)](https://apify.com/br_data_hub/website-tech-stack-detector) | Find out what a website is built with: CMS, JavaScript frameworks, e-commerce platform, analytics, tag manager |
| [Sitemap URL Extractor: Nested, Gzip, robots.txt, Filters](https://apify.com/br_data_hub/sitemap-url-extractor) | Extract every URL from a website's sitemaps: robots.txt discovery, nested indexes, .xml.gz, lastmod, priority, |
| [Brazil CNPJ Lookup API (Consulta CNPJ)](https://apify.com/br_data_hub/br-cnpj-lookup) | Look up Brazilian companies by CNPJ: registration status, partners (masked CPF), activities, tax regime and sc |

See all our Actors at [apify.com/br_data_hub](https://apify.com/br_data_hub).

### Usar em português

Gere **QR codes e códigos de barras** (EAN-13, EAN-8, UPC-A, Code 128, Code 39, ITF e Data Matrix) em PNG e SVG, em lote, a partir de uma lista de textos, ou **leia** os códigos de imagens enviadas por URL e receba o texto, o tipo e a posição de cada um. Para EAN e UPC o dígito verificador é calculado ou conferido. Cobra-se só o código gerado ou lido (US$ 0,0015); erros, repetidos e imagens sem código são grátis. Não usa fonte externa de dados: é só cálculo.

**Quanto custa:** $0.0015 por resultado (`code`); 1.000 resultados saem por $1.50. Desconto pelo nível da assinatura Apify: Bronze 10%, Silver 20%, Gold ou acima 30%. Erros e consultas sem resultado não são cobrados. Use também pela API ou por agentes de IA no servidor MCP da Apify (`https://mcp.apify.com/?tools=br_data_hub/qr-barcode-toolkit`).

# Actor input Schema

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

Choose generate to turn text into QR codes or barcodes saved as PNG/SVG files, or decode to read the codes inside images given by URL.

## `texts` (type: `array`):

Generate mode: one text per line, up to 5,000 per run, e.g. a URL, a Wi-Fi string or a product number. Each one becomes a code of the type chosen below. Identical texts are generated once.

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

Type used for every line in Texts to encode. EAN-13, EAN-8 and UPC-A take digits only and get their check digit added when it is missing.

## `codes` (type: `array`):

Generate mode, optional: a list of objects like {"text": "5901234123457", "type": "ean13"} to mix types in one run. Types: qr, ean13, ean8, upca, code128, code39, itf, datamatrix.

## `imageFormats` (type: `array`):

Generate mode: files saved in the key-value store for each code. PNG suits web and print at a fixed size, SVG scales without loss. One code is one charge, whatever the formats.

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

QR codes only. Higher levels survive more damage or a logo on top but make the code denser: L 7%, M 15%, Q 25%, H 30%.

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

Generate mode: how many pixels each square (or bar unit) takes, from 1 to 40, e.g. 6. A typical QR code is 25 to 45 modules wide.

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

Hex color of the dark modules, e.g. #000000. Keep strong contrast with the background so scanners can read it.

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

Hex color of the background, e.g. #FFFFFF. Light backgrounds with dark modules scan best.

## `quietZone` (type: `boolean`):

Keep on to add the blank margin that scanners need around the code. Turn off only if your layout already provides it.

## `humanReadableText` (type: `boolean`):

Linear barcodes only (EAN, UPC, Code 128, Code 39, ITF): print the encoded digits under the bars.

## `includeDataUri` (type: `boolean`):

Add the PNG as a base64 data URI in every dataset item, handy for small images in a web page or API. Makes items bigger.

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

Optional name of a named key-value store for the PNG and SVG files, e.g. my-qr-codes. Named stores are kept until you delete them; the default store of a run is deleted after your data-retention period.

## `imageUrls` (type: `array`):

Decode mode: public links to PNG, JPEG, GIF, WebP, BMP or TIFF images, one per line, up to 2,000 per run. data:image base64 links also work. Each image can hold several codes.

## `decodeFormats` (type: `array`):

Decode mode: restrict reading to some code types, which is faster and avoids false hits. Leave empty to read all of them.

## `maxCodesPerImage` (type: `integer`):

Decode mode: the most codes returned (and charged) for one image, e.g. 20. Useful for photos of shelves or sheets of labels.

## Actor input object example

```json
{
  "mode": "generate",
  "texts": [
    "https://apify.com",
    "WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;"
  ],
  "barcodeType": "qr",
  "codes": [
    {
      "text": "5901234123457",
      "type": "ean13"
    },
    {
      "text": "SKU-2026-001",
      "type": "code128"
    }
  ],
  "imageFormats": [
    "png",
    "svg"
  ],
  "errorCorrection": "M",
  "scale": 6,
  "foregroundColor": "#000000",
  "backgroundColor": "#FFFFFF",
  "quietZone": true,
  "humanReadableText": true,
  "includeDataUri": false,
  "maxCodesPerImage": 20
}
```

# Actor output Schema

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

Dataset with all results

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

Key-value store with the files and the OUTPUT summary of the run

# 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 = {
    "mode": "generate",
    "texts": [
        "https://apify.com",
        "WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;"
    ],
    "barcodeType": "qr",
    "codes": [
        {
            "text": "5901234123457",
            "type": "ean13"
        },
        {
            "text": "SKU-2026-001",
            "type": "code128"
        }
    ],
    "imageFormats": [
        "png",
        "svg"
    ],
    "errorCorrection": "M",
    "scale": 6,
    "foregroundColor": "#000000",
    "backgroundColor": "#FFFFFF",
    "quietZone": true,
    "humanReadableText": true,
    "maxCodesPerImage": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("br_data_hub/qr-barcode-toolkit").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 = {
    "mode": "generate",
    "texts": [
        "https://apify.com",
        "WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;",
    ],
    "barcodeType": "qr",
    "codes": [
        {
            "text": "5901234123457",
            "type": "ean13",
        },
        {
            "text": "SKU-2026-001",
            "type": "code128",
        },
    ],
    "imageFormats": [
        "png",
        "svg",
    ],
    "errorCorrection": "M",
    "scale": 6,
    "foregroundColor": "#000000",
    "backgroundColor": "#FFFFFF",
    "quietZone": True,
    "humanReadableText": True,
    "maxCodesPerImage": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("br_data_hub/qr-barcode-toolkit").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 '{
  "mode": "generate",
  "texts": [
    "https://apify.com",
    "WIFI:T:WPA;S:OfficeGuest;P:welcome2026;;"
  ],
  "barcodeType": "qr",
  "codes": [
    {
      "text": "5901234123457",
      "type": "ean13"
    },
    {
      "text": "SKU-2026-001",
      "type": "code128"
    }
  ],
  "imageFormats": [
    "png",
    "svg"
  ],
  "errorCorrection": "M",
  "scale": 6,
  "foregroundColor": "#000000",
  "backgroundColor": "#FFFFFF",
  "quietZone": true,
  "humanReadableText": true,
  "maxCodesPerImage": 20
}' |
apify call br_data_hub/qr-barcode-toolkit --silent --output-dataset

```

## MCP server setup

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

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/wNEDRRTHrzd41Zlj5/builds/EVhV8AMh2LDslviLP/openapi.json
