# QR Code & Barcode Reader and Generator - Bulk, From Image Links (`northbell/qr-barcode`) Actor

Read QR codes and barcodes (EAN, UPC, Code128, DataMatrix, PDF417) from image links or a scraper's dataset in bulk, or generate QR codes and barcodes as PNG or SVG files with public links. For n8n, Make and AI agents.

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

## Pricing

from $0.80 / 1,000 images

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/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 Reader and Generator - Bulk, From Image Links

**Read the QR codes and barcodes in a pile of image links, or turn texts and URLs into QR codes and barcodes.** One bad item never fails the run: it becomes a row with a plain error message, and the rest carry on. No browser, so a run is fast. Built for n8n, Make, Zapier and AI-agent pipelines, and to run right after a product or shop scraper.

**Try it now — the input is already filled in.** Press **Start**. It makes a QR code for each of two web links and stores them as PNG files with public links, so the first run needs no outside images. In our own local run with this input: **2 QR codes (495 x 495 px, about 3.5 KB each), about 2.5 seconds** from start to finish. That is 2 codes: **$0.001** (plus $0.00005 for the run start). Then switch **Operation** to `read`, paste those file links and you get the text back.

### What you pay

| Event | Price | When |
| --- | --- | --- |
| `image` | $0.001 | per image in which at least one code was found and read (operation `read`) |
| `code` | $0.0005 | per code file generated and stored (operation `generate`) |
| `apify-actor-start` | $0.00005 | once per run |

- **Images with no code are free.** So are errors (a 404, a web page instead of an image, a file over your size limit, a wrong EAN check digit).
- You are charged for an item only after its row is saved. Set "Maximum total charge" on the run as your cap. The Actor checks the charge limit before it saves each charged item and stops cleanly when the next one does not fit.

### What it does

| Operation | Input | Result per item |
| --- | --- | --- |
| `read` | image links, or a dataset's image field | `status`, `codeCount`, `codes` (each with `format`, `text`, `position`), image size |
| `generate` | texts or URLs | a PNG or SVG file in the key-value store, `fileUrl` (public link), size in pixels |

#### Read

- **Codes found:** QR, EAN-13, EAN-8, UPC-A, UPC-E, Code128, Code39, ITF, DataMatrix and PDF417. With the `formats` filter you can also ask for Aztec, Codabar, Code93, DataBar and Micro QR.
- **One row per image.** `codes` lists every code in the image, top to bottom, each with its `format`, its `text` and a `position` (`x`, `y`, `width`, `height` of the box around it, plus the four `corners`, in the pixels of the image as shown). `format` and `text` at the top of the row are the first code's, so a one-code image needs no digging. `status` is `ok` when a code was read, `no_code` when the image is fine but has no code (free), `error` when the image could not be fetched or opened.
- **Tilted, upside-down and inverted codes** are found (white on black too). When nothing is found at first, the image is tried again smaller, larger, sharpened and as a hard black-and-white copy before the Actor says "no code". Huge images are scaled down before reading (2400 px on the long side).
- **Photos, not only clean files.** Blur, noise and a tilt are fine up to a point; a very small code or one hidden by glare will not read. That image comes back as `no_code`, and it is free.
- **Bounded and fast.** 4 images at a time. Downloads give up after 20 seconds without data or 60 seconds in total, and are retried twice on a 429, a 5xx or a dropped connection. Images up to `maxFileMb` (20 MB by default, 100 MB at most) and 100 megapixels.

#### Generate

- **QR code** (`codeType: qr`): `errorCorrection` L, M, Q or H; any text up to 2000 characters, Japanese and other Unicode included.
- **EAN-13** (`ean13`): give 12 digits and the check digit is added (`checksumAdded: true`), or 13 digits and the check digit is validated. A wrong one is an error row that names the right digit, for example `Wrong EAN-13 check digit: the last digit is 8, it should be 7 (5901234123457).`
- **Code128** (`code128`, ASCII text) and **DataMatrix** (`datamatrix`).
- **PNG or SVG.** `size` is the target width; the real size is the largest whole number of pixels per module that fits, so edges stay sharp, and `width` and `height` come back in the row. `margin` is the quiet zone in modules (4 is the QR standard). `foreground` and `background` take hex colours; keep the contrast high or scanners will fail.
- Each file is stored in the run's key-value store; `fileUrl` is its public link. Files stay as long as your Apify storage retention keeps the run.

### Use it from n8n, Make or an AI agent

Call the Actor synchronously and get the rows back in the same HTTP response. Use your API token and your username:

```
POST https://api.apify.com/v2/acts/YOUR_USERNAME~qr-barcode/run-sync-get-dataset-items?token=YOUR_API_TOKEN
Content-Type: application/json
```

Read the codes in two images:

```json
{
  "operation": "read",
  "imageUrls": ["https://example.com/label.jpg", "https://example.com/poster.png"]
}
```

One object per image comes back:

```json
{
  "index": 0,
  "operation": "read",
  "status": "ok",
  "error": null,
  "imageUrl": "https://example.com/label.jpg",
  "width": 1200,
  "height": 800,
  "codeCount": 1,
  "format": "EAN-13",
  "text": "4006381333931",
  "codes": [
    {
      "format": "EAN-13",
      "text": "4006381333931",
      "position": { "x": 412, "y": 300, "width": 380, "height": 190, "corners": [[412, 300], [792, 300], [792, 490], [412, 490]] }
    }
  ]
}
```

Make a batch of Code128 barcodes as SVG:

```json
{
  "operation": "generate",
  "codeType": "code128",
  "fileType": "svg",
  "texts": ["SKU-0042", "SKU-0043"]
}
```

Notes for automations:

- `run-sync-get-dataset-items` waits for the run, and Apify ends a synchronous call after 5 minutes. For big batches, start a normal run and read the dataset when it finishes.
- Rows keep the order of your input in `index`, so you can match results to your items even when some fail.
- Check `status` per row. The HTTP call succeeds even when some items fail.

### Run it after your scraper

If another Actor collects product or listing images (a shop scraper, a marketplace scraper, a real-estate scraper), this Actor can read the codes in them automatically after every run of it:

1. In Apify Console, open that Actor and go to **Integrations**.
2. Add **Run Actor** (on "Run succeeded") and pick this Actor.
3. Use an input like this, with the name of the field that holds the image link or links:

```json
{
  "operation": "read",
  "datasetId": "{{resource.defaultDatasetId}}",
  "urlField": "images",
  "onlyNew": true
}
```

Each run of the first Actor then hands over its dataset, and every image link in it is read. The field can hold one link or a list of links; a dotted path such as `media.images` reaches into nested fields, and a list of objects with a `url` field works too. Each output row keeps a small `sourceItem` (the field name, the link and the row's `id` if it has one) so you can match results to the original rows. If the dataset has no links, nothing runs and nothing is charged.

**Only new images.** With `onlyNew` on, the Actor remembers every image link it has read in the key-value store `qr-barcode-seen` (in your account) and skips those next time, so a daily scraper does not make you pay for the same photos again. An image that failed is not remembered, so the next run tries it again. If that store cannot be opened, the run stops before charging anything.

### Options

| Input | Default | What it does |
| --- | --- | --- |
| `operation` | `generate` | `generate` or `read` |
| `texts` | two example links | texts or URLs to turn into codes (generate) |
| `imageUrls` | - | direct links to images (read) |
| `datasetId`, `urlField` | - , `url` | read image links from a dataset (read); dotted paths and lists allowed |
| `formats` | all ten | only these code types, for example `qr`, `ean13` (read) |
| `codeType` | `qr` | `qr`, `ean13`, `code128`, `datamatrix` (generate) |
| `fileType` | `png` | `png` or `svg` (generate) |
| `size`, `margin` | 512, 4 | target width in pixels, quiet zone in modules (generate) |
| `errorCorrection` | `M` | `L`, `M`, `Q`, `H` (QR) |
| `foreground`, `background` | `#000000`, `#ffffff` | colours (generate) |
| `onlyNew` | off | skip images read in an earlier run (read) |
| `maxFileMb` | 20 | largest image in MB (hard cap 100) |
| `maxItems` | 1000 | items per run; the rest are left untouched |

Only the fields that belong to the chosen operation are used, so the prefilled sample texts do no harm when you switch to `read`.

### Limits

- Direct image links only. Links to private or local network addresses are rejected. The image must be reachable without a login. PDFs are not read, only images.
- Animated images are read from their first frame.
- A code that reads in a phone camera can still fail here when it is tiny, blurred beyond recognition or cut off at the edge of the picture.
- Your images are processed only inside this Actor's run on Apify; nothing is sent to other services.

### 日本語

画像リンク(またはスクレイパーのデータセットの画像欄)から QR コードとバーコード(EAN-13/8、UPC、Code128、Code39、ITF、DataMatrix、PDF417)を一括で読み取り、または文字列・URL から QR コード/バーコードを PNG・SVG で作って公開リンクを返します。傾き・反転・ぼけにも対応。EAN-13 はチェックディジットを検証(12桁なら自動付与)。コードが見つかった画像だけ課金(1枚 $0.001)、見つからない画像とエラーは無料。生成は1件 $0.0005。「新しい画像のみ」で毎日の実行でも同じ画像に二重課金しません。n8n・Make・AI エージェントから同期実行できます。

# Actor input Schema

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

generate makes code files from the texts below. read finds the codes in the images below. Only the fields of the chosen operation are used.

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

One code per line. A QR code can hold a web link, plain text, a Wi-Fi login or a vCard. EAN-13 needs 12 or 13 digits (the check digit is added or checked). Code128 takes ASCII text.

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

Direct links to images (PNG, JPG, WebP, GIF, TIFF, AVIF). Or leave empty and give a Dataset ID.

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

Read image links from this Apify dataset, for example the dataset of a product scraper run. Use {{resource.defaultDatasetId}} when you connect this Actor as an integration after another Actor.

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

Name of the field that holds the image link. A dotted path works (media.images). The field may hold one link or a list of links.

## `formats` (type: `array`):

Optional filter, for example qr, ean13, code128. Empty means all of: qr, ean13, ean8, upca, upce, code128, code39, itf, datamatrix, pdf417. Also available: aztec, codabar, code93, databar, microqr.

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

The kind of code to make for every text.

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

Each code is stored as a file with a public link.

## `size` (type: `integer`):

Target width. The real width is the largest whole number of pixels per module that fits (so modules stay sharp), and is returned in the row.

## `margin` (type: `integer`):

Empty border around the code, counted in code modules. 4 is the standard for QR; scanners need it.

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

Higher levels survive more damage but make a denser code.

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

Hex colour of the dark modules, for example #000000. Keep strong contrast with the background or scanners fail.

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

Hex colour of the background, for example #ffffff.

## `onlyNew` (type: `boolean`):

Skip images that an earlier run already read. The Actor remembers the links in the key-value store qr-barcode-seen. Useful after a scraper that runs every day.

## `maxFileMb` (type: `integer`):

Larger images come back as errors, free. Hard cap 100.

## `maxItems` (type: `integer`):

Cap on images or texts per run. Items over the cap are left for the next run.

## Actor input object example

```json
{
  "operation": "generate",
  "texts": [
    "https://apify.com",
    "https://example.com/menu"
  ],
  "urlField": "url",
  "codeType": "qr",
  "fileType": "png",
  "size": 512,
  "margin": 4,
  "errorCorrection": "M",
  "foreground": "#000000",
  "background": "#ffffff",
  "onlyNew": false,
  "maxFileMb": 20,
  "maxItems": 1000
}
```

# Actor output Schema

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

Status, codes with format, text and position per image, or the generated file link per text.

# 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 = {
    "operation": "generate",
    "texts": [
        "https://apify.com",
        "https://example.com/menu"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("northbell/qr-barcode").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 = {
    "operation": "generate",
    "texts": [
        "https://apify.com",
        "https://example.com/menu",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("northbell/qr-barcode").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 '{
  "operation": "generate",
  "texts": [
    "https://apify.com",
    "https://example.com/menu"
  ]
}' |
apify call northbell/qr-barcode --silent --output-dataset

```

## MCP server setup

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

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/PePicoJBExJsQCsTs/builds/aRyBQbGtGkx6bYfzZ/openapi.json
