QR Code API Documentation

Welcome to the QR Code API documentation. This API allows you to generate QR codes with various data types and customization options.

The API supports multiple data formats including text, URLs, bank transfers, email addresses, SMS messages, vCards, WiFi network information, and custom data structures.

You can also customize the appearance of the QR codes with options for colors, size, error correction level, and more.

Getting Started

To use the QR Code API, you need to make HTTP requests to the API endpoints. The API supports both GET and POST methods.

Basic Usage

The simplest way to generate a QR code is to make a GET request to the /encode endpoint with the required parameters:

Basic Example
/encode?data[text]=Hello%20World&output=png
This will generate a PNG QR code containing the text "Hello World".

Authentication

The API does not require authentication for basic usage.

API Endpoints

Generate QR Code

Endpoint: /encode/{dataType}

Methods: GET, POST

This endpoint generates a QR code based on the provided data and options.

Path Parameters

Parameter Type Description
dataType string The type of data to encode. Valid values: text, url, bank, email, sms, vcard, wifi, custom

Query Parameters

Parameter Type Required Description
data object Yes The data to encode. The structure depends on the dataType.
options object No Options for customizing the QR code.

Response

The response will be the generated QR code in the requested format. If the Accept header is set to application/json, the response will be a JSON object containing the QR code as a base64-encoded string.

Data Types

The QR Code API supports various data types that can be encoded in QR codes. Each data type has its own structure and requirements.

Text

The text data type allows you to encode plain text in a QR code.

Data Structure

Field Type Required Description
text string Yes The text to encode in the QR code.

Example

Text Example
/encode/text?data[text]=Hello%20World&output=png

URL

The URL data type allows you to encode a web address in a QR code.

Data Structure

Field Type Required Description
url string Yes The URL to encode in the QR code.

Example

URL Example
/encode/url?data[url]=https%3A%2F%2Fexample.com&output=png

Bank Transfer

The bank data type allows you to encode bank transfer information in a QR code.

Data Structure

Field Type Required Description
name string Yes Recipient's name
iban string Yes IBAN (International Bank Account Number)
currency string Yes Currency code (e.g., EUR, USD)
amount string Yes Transfer amount
description string Yes Payment description/reference

Example

Bank Transfer Example
/encode/bank?data[name]=John%20Doe&data[iban]=DE89370400440532013000&data[currency]=EUR&data[amount]=100.00&data[description]=Invoice%20123&output=png

Email

The email data type allows you to encode an email address in a QR code.

Data Structure

Field Type Required Description
email string Yes Email address
subject string No Email subject
body string No Email body

Example

Email Example
/encode/email?data[email]=example%40example.com&data[subject]=Hello&data[body]=This%20is%20a%20test%20email&output=png

SMS

The SMS data type allows you to encode a text message in a QR code.

Data Structure

Field Type Required Description
phone string Yes Phone number
message string No SMS message

Example

SMS Example
/encode/sms?data[phone]=+1234567890&data[message]=Hello%20World&output=png

vCard

The vCard data type allows you to encode contact information in a QR code.

Data Structure

Field Type Required Description
name string Yes Full name
company string No Company name
title string No Job title
phone string No Phone number
email string No Email address
address string No Physical address
website string No Website URL

Example

vCard Example
/encode/vcard?data[name]=John%20Doe&data[company]=Example%20Inc&data[title]=CEO&data[phone]=+1234567890&data[email]=john%40example.com&data[address]=123%20Main%20St%2C%20Anytown%2C%20USA&data[website]=https%3A%2F%2Fexample.com&output=png

WiFi

The WiFi data type allows you to encode WiFi network information in a QR code.

Data Structure

Field Type Required Description
ssid string Yes Network name (SSID)
password string No Network password
encryption string No Encryption type (WEP, WPA, WPA2, none)
hidden boolean No Whether the network is hidden

Example

WiFi Example
/encode/wifi?data[ssid]=MyNetwork&data[password]=MyPassword&data[encryption]=WPA&data[hidden]=false&output=png

Custom

The custom data type allows you to encode any custom data in a QR code.

Data Structure

The structure is flexible and depends on your specific needs.

Example

Custom Example
/encode/custom?data[custom]=Your%20custom%20data%20here&output=png

Output Formats

The QR Code API supports various output formats for the generated QR codes.

Available Formats

Format Description
png PNG image format (default)
jpg, jpeg JPEG image format
gif GIF image format
bmp BMP image format
webp WebP image format
svg SVG vector format
eps EPS vector format
pdf PDF document format
txt Text representation
html HTML representation
json JSON representation

Specifying the Output Format

You can specify the output format using the output parameter in the request:

/encode/text?data[text]=Hello%20World&output=svg

Alternatively, you can use the Accept header in the request:

Accept: image/svg+xml

QR Code Options

The QR Code API provides various options for customizing the appearance and behavior of the generated QR codes.

Output Options

Option Type Default Description
output string png Output format (png, jpg, gif, bmp, webp, svg, eps, pdf, txt, html, json)
outputBase64 boolean false Whether to return the QR code as a base64-encoded string
quality integer -1 Image quality for JPEG format (0-100)
gdImageUseUpscale boolean true Whether to use upscaling for GD image output
imagickFormat string png32 ImageMagick format for image output

Error Correction Options

Option Type Default Description
eccLevel string M Error correction level (L: 7%, M: 15%, Q: 25%, H: 30%)
version integer -1 QR code version (1-40, -1 for auto)
versionMin integer 1 Minimum QR code version
versionMax integer 40 Maximum QR code version
maskPattern integer -1 Mask pattern (0-7, -1 for auto)

Geometry Options

Option Type Default Description
scale integer 4 Scale factor for the QR code
quietZone integer 4 Size of the quiet zone around the QR code
circleRadius float 0 Radius for circular modules (0 for square modules)
keepAsSquare array [] Module types to keep as squares when using circular modules

Color Options

Option Type Default Description
colors.color string #000 Default color for dark modules
colors.background string #fff Background color
invertMatrix boolean false Whether to invert the QR code colors
transparencyColor string Color to make transparent in the output image

You can also specify colors for specific module types:

Vector Options

Option Type Default Description
connectPaths boolean false Whether to connect paths in vector output
excludeFromConnect array [] Module types to exclude from path connection
cssClass string qrcode CSS class for SVG output
svgAddXmlHeader boolean true Whether to add XML header to SVG output
svgDefs string SVG definitions to include in the output
svgPreserveAspectRatio string xMidYMid SVG preserveAspectRatio attribute
svgUseFillAttributes boolean true Whether to use fill attributes in SVG output

Examples

Basic Text QR Code

/encode/text?data[text]=Hello%20World&output=png

URL QR Code with Custom Colors

/encode/url?data[url]=https%3A%2F%2Fexample.com&output=png&colors[color]=%236079FF&colors[background]=%23FFFFFF

Bank Transfer QR Code with High Error Correction

/encode/bank?data[name]=John%20Doe&data[iban]=DE89370400440532013000&data[currency]=EUR&data[amount]=100.00&data[description]=Invoice%20123&output=png&eccLevel=H

WiFi QR Code as SVG

/encode/wifi?data[ssid]=MyNetwork&data[password]=MyPassword&data[encryption]=WPA&output=svg

vCard QR Code with Circular Modules

/encode/vcard?data[name]=John%20Doe&data[company]=Example%20Inc&data[phone]=+1234567890&data[email]=john%40example.com&output=png&circleRadius=0.45

Try It

QR Code Generator