# QR Code Generator (PNG and SVG) (`brightwater-tools/qr-code-generator`) Actor

Turn text or URLs, one per line, into QR codes. Each code is saved as a PNG and an SVG in the run's key-value store. Built on the pure-Python segno library. No network access, no tracking and no link shortening.

- **URL**: https://apify.com/brightwater-tools/qr-code-generator.md
- **Developed by:** [Brightwater Tools](https://apify.com/brightwater-tools) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 qr code writtens

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Generator (PNG and SVG)

Turn text or web addresses into QR codes. Paste one item per line, and get a PNG and an SVG file for each line, saved in your run's key-value store. Blank lines are skipped and repeated lines are made once.

**$0.005 per QR code written.** (UNCONFIRMED against the live Store.) Each code is charged only after its PNG and SVG files and its dataset item are saved. Codes that fail are not charged.

### What you can do with it

- Make QR codes for **product labels, price tags or packaging** by pasting a list of product URLs.
- Make a batch of **event or ticket links**, one per line, to print or place on slides.
- Put **a short message or code** on a sticker, card or sign.
- Make **QR codes for a spreadsheet of links**: copy the column and paste it in.
- Call it from the **Apify API**, like any Apify actor.

### How to use it

1. Paste your text or URLs into **Text or URLs, one per line**. Put each code on its own line.
2. Optional: pick an **error correction level** (default `M`), a **pixels per module** size (default `8`) and a **quiet zone** (default `4`).
3. Click **Start**. Each code's files are in the run's **Key-value store** tab, and each code has an item in the **Dataset**.

Example input:

```json
{
  "content": "https://example.com/product/1001\nhttps://example.com/product/1002\nHello from a QR code",
  "error_correction": "M",
  "scale": 8,
  "border": 4
}
```

Output: the run writes two files for each line, `qr-001.png` and `qr-001.svg`, `qr-002.png` and `qr-002.svg`, and so on. Each file is stored in the key-value store under that name. The dataset gets one item per code, for example:

```json
{
  "index": 1,
  "content": "https://example.com/product/1001",
  "png_key": "qr-001.png",
  "svg_key": "qr-001.svg",
  "error_correction": "M",
  "scale": 8,
  "border": 4,
  "png_bytes": 1043,
  "svg_bytes": 2318
}
```

The `index` number follows the order of the unique lines you entered, starting at 1. `png_bytes` and `svg_bytes` are the file sizes in bytes (the numbers in the example are illustrations).

### Input fields

| Field | What to enter | Default |
|---|---|---|
| `content` | Required. Text or URLs, one per line. Up to 500 lines. | none |
| `error_correction` | `L`, `M`, `Q` or `H`. `L` recovers about 7% damage, `M` about 15%, `Q` about 25% and `H` about 30%. Higher levels make bigger codes. | `M` |
| `scale` | Pixels per module (the small squares in the code), from 1 to 16. Larger values make bigger PNG files. | `8` |
| `border` | Empty margin around each code, in modules, from 0 to 10. The QR standard recommends 4. | `4` |

### Pricing

- **$0.005 per QR code written.** (UNCONFIRMED against the live Store.) A code counts as written when both its PNG and SVG files and its dataset item are saved.
- A run that writes 10 codes costs 10 × $0.005 = $0.05, plus Apify's platform usage, which Apify bills separately.
- **Failed codes are not charged.** If a run writes nothing, it is marked as failed and not charged.

### Limits

- **Text and URLs only.** Wi-Fi details and vCard contact cards are not supported.
- **Up to 500 lines per run.** Blank lines do not count, but a repeated line does.
- **Each line up to 1,000 bytes of UTF-8.** That is about 1,000 ASCII characters, fewer for accented or non-Latin text. Spaces at the start and end of a line are removed before the check.
- **Repeated lines are made once.** The second and later copies of a line are skipped. The log counts how many were skipped.
- **Blank lines are skipped.**
- **No tabs or control characters inside a line.** If a line has one, the run stops before writing anything, and the log names the line.
- **Nothing is fetched from a URL.** A web address is encoded as text. The QR code does not check whether the page exists, and the actor does not shorten links.
- **Partial results.** If one code cannot be written, the others still run and are charged. The log lists the codes that were not written.
- **Stored files.** If a code's PNG is saved and its SVG then fails, the PNG stays in the key-value store with no dataset item and no charge.
- **Privacy.** The actor's own code makes no requests to outside services and does not fetch any URL. The PNG, SVG and dataset item for each code are saved in your run's storage on Apify, under Apify's default retention unless you change it. Do not put private data into codes you plan to share.

### FAQ

**Are the QR codes permanent?** The codes are generated from your text once. They do not expire, and this actor does not host any link. If the web address you encode changes, the code still points to the old address, so check the link before you print.

**Can I make one long code instead of many short ones?** Each line is one code. To make one code from a long text, keep it on one line and under 1,000 bytes.

**Which file should I use for printing?** The SVG stays sharp at any size. Use the PNG for a quick preview or for apps that do not accept SVG. The PNG size is set by `scale` and `border`.

**What happens if my text is too long for the level I chose?** The code is not written, the run continues with the other lines, and you are not charged for that code. Try a lower error correction level or a shorter line.

**Can I call it from code?** Yes, through the Apify API or the Apify client for JavaScript or Python, like any Apify actor.

**I found a bug or need a feature.** Open an issue on this actor's Issues tab.

### Not yet verified

PNG and SVG rendering is not verified yet. The image library (segno) has not been run in a test, so the output described above is the intended output, and the rule that a code too long for its level is not written has not been run either. Until a test render passes, check the files from a test run before you rely on them.

### About this actor

Built with the help of AI coding tools. Image rendering is not yet verified; see Not yet verified above.

# Actor input Schema

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

One QR code is made for each non-blank line, up to 500 lines. Each line can be up to 1,000 bytes of UTF-8 (about 1,000 ASCII characters, fewer for non-ASCII text). Blank lines are skipped. A line that repeats an earlier line is encoded once. Tabs and other control characters are refused. Nothing is fetched from a URL; a URL is only encoded as text.

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

L recovers about 7% damage, M about 15%, Q about 25% and H about 30%. Higher levels make bigger codes. The level is kept as chosen: if the content does not fit at that level, its code is not written.

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

Size of each square module (dot) in the PNG and in the SVG viewBox units. From 1 to 16. Larger values make bigger PNG files.

## `border` (type: `integer`):

Empty margin around each code, measured in modules. The QR standard recommends 4. From 0 to 10.

## Actor input object example

```json
{
  "content": "https://example.com\nHello from a QR code",
  "error_correction": "M",
  "scale": 8,
  "border": 4
}
```

# Actor output Schema

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

One item per code written: the content, the store keys of its PNG and SVG files, and the render settings. Each item is charged once, after both files are stored.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("brightwater-tools/qr-code-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("brightwater-tools/qr-code-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 '{}' |
apify call brightwater-tools/qr-code-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,brightwater-tools/qr-code-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/O5jNZc4zujhFSfOPq/builds/j5DL49h58mnqm5YbW/openapi.json
