QR code generator API

Change the content, colors, rounded corners, shape, logo, size and PNG/SVG format to get a matching QR code image URL you can embed directly in web pages and emails.

GEThttps://api.imgrender.com/v1/qrcodeNo API key · URLs never expire

QR code generator

Content type

When scanned: Opens the link or shows the text

Shape

Live preview

PNG · 150×150

Generating preview…

Current parameters

Format
png
Size
150
Margin
4
Error correction
M
Foreground
#000000
Background
#FFFFFF
Shape
Square
Center image
Not set

What problem does the QR code generator API solve?

When a web page, email or document needs a QR code, the usual flow is to make one in a generator, download it and upload it before you can use it.

The QR code generator API skips all that: a GET request to a URL returns the image, so the URL itself is the QR code. Put it in an <img src> or an email and it shows up, with no downloading, uploading or rendering on your side.

What do I need before I start?

Just the content to encode (a URL or text). URL parameters control the style: format, size, quiet zone, error-correction level, colors, module shape and center logo.

data must be URL-encoded; colors are hex only, with # written as %23. For Wi-Fi, vCard, mailto and the like, build the standard string yourself and pass it in; see the API docs below.

QR code generator API reference

01

Request

A GET request with query parameters that returns the image on success. You can open it directly in a browser.

https://api.imgrender.com/v1/qrcode?data=https%3A%2F%2Fwww.imgrender.com

More parameters below.

02

Parameters

All parameters go in the query string. data is required; the rest are optional. String enums are case-insensitive. See below for the values and formats of data, frontcolor / backcolor and shape.

Parameter
Type
Default
Description
data
string
Required
Content to encode, URL-encoded; an empty string is invalid. See content types below
format
string
png
png / svg / base64 (base64 always returns a PNG data URI)
size
integer
150
Output side length in pixels, 1–4096
margin
integer
4
Quiet zone in modules, 0–100
ecLevel
string
M
L / M / Q / H; use H with a center image
frontcolor
string
000000
Module color in hex, # optional; see the color notes below
backcolor
string
FFFFFF
Background color; 8 digits with alpha 00 makes it transparent. See the color notes below
shape
string
square
square / rounded-square / circle / diamond / horizontal / vertical; see below
centerImage
string
—
Center logo: a public http(s) image URL or a data URI (base64 only)
centerImageSizeRatio
number
0.3
Share of the code taken by the center image, 0–1; only with centerImage

Unknown parameters are ignored.

03

data content types

data accepts URLs, plain text and standard strings you build yourself, such as Wi-Fi, vCard and mailto. What happens on scan depends on the format; common types are below.

Content type
Format / example
When scanned
URL / plain text
https://www.imgrender.com
Opens the link or shows the text
Wi-Fi network
WIFI:T:WPA;S:SSID;P:pwd;H:false;;
Joins the Wi-Fi network
Contact card (vCard)
BEGIN:VCARD ... END:VCARD
Imports the contact
Email (mailto)
mailto:addr?subject=...&body=...
Opens the mail app with a prefilled message
Text message (SMS)
smsto:+15550000000:message
Opens the messaging app with a prefilled text
Calendar event
BEGIN:VCALENDAR ... END:VCALENDAR
Adds it to the calendar
Location
geo:37.77,-122.42
Opens the location in maps
Payment
bitcoin:address?amount=... / payment links
Opens the payment app
App store
App Store / Google Play link
Opens the app download page
04

frontcolor / backcolor colors

frontcolor and backcolor are hex only (3, 6 or 8 digits). The # is optional; if you include it, write it as %23. Eight digits with alpha 00 gives a transparent background. Color names and rgb() are not accepted:

  • 3 digits: f00
  • 6 digits: ff0000
  • 8 digits, transparent: FFFFFF00
05

shape: module shapes

shape accepts these module shapes:

square

Square

rounded-square

Rounded square

circle

Circle

diamond

Diamond

horizontal

Horizontal bars

vertical

Vertical bars

06

Success response

The body depends on the format parameter. Image URLs never expire and the same parameters always give the same result. Success responses include Cache-Control: public, max-age=86400 and Access-Control-Allow-Origin: *.

format
Content-Type
Body
png
image/png
PNG bytes (display directly)
svg
image/svg+xml
SVG text (display directly)
base64
text/plain
data:image/png;base64,… (always PNG)
07

Error response

Errors use the HTTP status code, with the reason as plain text.

Status
Typical cause
400
Missing or empty data; invalid or out-of-range parameter; invalid color; data over capacity; invalid centerImage or one pointing at this API
502
Failed to download centerImage
500
Internal rendering error; contact us if you see this
08

Known limits and best practices

  • 1A QR code from this API can't be the centerImage of another one (no nesting).
  • 2Keep the center image at 30% or less with ecLevel=H, and test scanning on a real device; transparent areas of the image may show modules through.
  • 3For print, use a large size, keep enough quiet zone and use ecLevel=H.
09

Sample code

Default PNG

GET https://api.imgrender.com/v1/qrcode?data=https%3A%2F%2Fwww.imgrender.com

Transparent + circles + SVG

GET https://api.imgrender.com/v1/qrcode?data=hello&format=svg&shape=circle&frontcolor=%23f00&backcolor=%23FFFFFF00

With a center image

GET https://api.imgrender.com/v1/qrcode?data=https%3A%2F%2Fexample.com&ecLevel=H&centerImage=https%3A%2F%2Fexample.com%2Flogo.png&centerImageSizeRatio=0.3

HTML (embed in a page)

<img
  src="https://api.imgrender.com/v1/qrcode?data=https%3A%2F%2Fexample.com"
  width="180"
  height="180"
  alt="QR code image"
/>

curl (download a PNG)

curl -o qr.png "https://api.imgrender.com/v1/qrcode?data=https%3A%2F%2Fexample.com&size=512&ecLevel=H&shape=rounded-square&frontcolor=%23007bff"

JavaScript

const qr = document.getElementById('qr');
qr.src = 'https://api.imgrender.com/v1/qrcode?data=' + encodeURIComponent('https://www.imgrender.com') + '&size=256';

Python

import requests
url = "https://api.imgrender.com/v1/qrcode?data=" + requests.utils.quote("https://www.imgrender.com")
open("qr.png", "wb").write(requests.get(url).content)

Wi-Fi sharing (data is an encoded WIFI string)

GET https://api.imgrender.com/v1/qrcode?data=WIFI%3AT%3AWPA%3BS%3Amywifi%3BP%3Apass123%3B%3B

Examples

These three images were generated by the QR code generator API; change the URL parameters to reproduce them.

Keeping codes scannable

  • Low contrast: light modules on a dark background, or a background close to the module color, are hard for scanners to read.
  • Oversized center logo: keep the center image to about 30% or less, use ecLevel=H, and test on a real device.
  • Over capacity: a data value that's too long returns 400; shorten or split long text.
  • Heavy styling: scanners rely on contrast and finder patterns, so the bolder the style, the more you need to test.

How it compares with other QR code generators and APIs

  • Online QR code generators: you download the image and upload it again. Here you just copy the URL and use it.
  • Dynamic QR code platforms: the content lives on their server and can be edited later. This API makes static codes: the content is baked into the image and never expires; generate a new URL to change it.
  • QR code APIs on API marketplaces: usually require sign-up and payment, return JSON you have to process, and image URLs often expire. This API needs no sign-in or key; the URL is the image and never expires.
  • Front-end JS libraries (qrcode.js and others): draw codes in the browser with no server, but you write rendering code everywhere. Here any language just builds a URL to get the image.
  • imgrender template render API: this API outputs just the code. For a full image with the QR code plus a brand background, title or product shot, design a template in the template editor and call the template render API.

FAQ

No. There's no sign-in and no key; just call it.