QrCode icon

QrCode

Create a QR Code image

Overview

This n8n node generates a QR code image from a provided value (text or data). It allows customization of the QR code's appearance and encoding options, such as size, error correction level, colors, and more. The generated QR code is returned both as a data URL in the JSON output and as a binary file attachment, making it suitable for workflows that need to create, store, or share QR codes dynamically.

Common scenarios:

  • Generating QR codes for URLs, contact information, or event details.
  • Automating the creation of QR codes for marketing materials or tickets.
  • Integrating QR code generation into document automation or notification workflows.

Example use cases:

  • Creating a QR code for a payment link and attaching it to an email.
  • Generating QR codes for Wi-Fi credentials to be printed or shared.
  • Producing QR codes for product packaging with custom branding colors.

Properties

Display Name Type Description
Value string The value to encode as a QR code (e.g., text, URL, etc.).
Width number The width of the generated QR code image in pixels.
Options fixedCollection Additional QR code configuration options (see below).

Options (fixedCollection):

  • QR Code Symbol Version (1 - 40)
    • Symbol Version (number): Specifies the QR code version (complexity/size), range 0–10.
  • Scale Factor
    • Scale (number): Scale factor for the QR code; 1 means 1px per module (dot).
  • QR Code Error Correction Level
    • Error Correction Level (options: L, M, Q, H): Sets the error correction capability.
  • Mask Pattern (0 - 7)
    • Mask Pattern (number): Selects the mask pattern used in the QR code.
  • QR Code Colors
    • Dark Color (color): Color for the dark modules (default: #000000).
    • Light Color (color): Color for the light modules (default: #ffffff).
  • Attachment Name
    • Attachment Name (string): Name for the binary file attachment (default: "qrcode").

Output

The node outputs an array with one item containing:

  • json.data:
    A string containing the QR code image as a Data URL (base64-encoded PNG).

    {
      "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
    }
    
  • binary:
    An object with a single property whose key is the specified Attachment Name (or "qrcode" by default). The value is the binary representation of the QR code image, suitable for downstream nodes that handle files.

    Example:

    {
      "qrcode": { /* binary data reference */ }
    }
    

Dependencies

  • External Libraries:

    • Uses the qrcode npm package for QR code generation.
  • n8n Requirements:

    • No special API keys or environment variables required.
    • The node must have access to the bundled dependencies.

Troubleshooting

Common issues:

  • Invalid input value: If the "Value" field is empty or contains unsupported characters, QR code generation may fail.
  • Incorrect option values: Setting out-of-range values for symbol version, scale, or mask pattern can cause errors.
  • Large data: Encoding very large strings may result in unreadable or oversized QR codes.

Error messages and resolutions:

  • "Failed to generate QR code" or similar: Check that all required fields are filled and option values are within allowed ranges.
  • "Cannot read property '...' of undefined": Ensure all nested options in the "Options" collection are properly set.

Links and References

Discussion