Developers

QR code embed API reference

The embed API is two GET endpoints, /qr.svg and /qr.png. Pass the content as query parameters, such as url, text or ssid, plus optional style settings like fg, bg and pattern. Each response is an image with CORS open to every site and a one-year cache header. Requests need no key.

Endpoints

EndpointReturnsContent-Type
GET https://qrcodesforever.com/qr.svgVector imageimage/svg+xml; charset=utf-8
GET https://qrcodesforever.com/qr.pngSquare PNG, 512 px by defaultimage/png

Both take the same parameters. Only the PNG endpoint uses size.

How the kind of code is chosen

Set type to one of url, text, wifi, email, phone, upi, whatsapp, vcard, sms, location, event, pix, epc or crypto. If you leave type out, the kind is inferred from which content parameters are present, checked in this order: upi, pix, iban, crypto, whatsapp, sms, first/last/org, start, lat+lng or q, ssid, email, phone, text, url.

Guessing is fine for simple cases like ?url= or ?ssid=. For anything that shares fields (a vCard with an email, a WhatsApp link set with phone), add type= so there's no doubt.

Parameter names are case-insensitive, so URL, Url and url all work, aliases included. If a name appears twice, the first one wins. Values are a different matter: security must be exactly WPA, WEP or nopass, and pattern and corners must be lowercase. A value in the wrong case is ignored like any other invalid value. ?type=wifi&ssid=Cafe&security=wpa produces WIFI:T:WPA;S:Cafe;P:;;, which only looks right because WPA is the default.

Style parameters (every kind)

ParameterValuesDefault
fgSix-digit hex, with or without # (send # as %23)0a0a0a
bgSix-digit hexffffff
transparent1, true or yes to drop the backgroundoff
pattern (alias dots)square, rounded, dotsrounded
cornerssquare, rounded, circlerounded
sizePNG only: 512, 1024, 2048, 4096; other values give 1024512

An invalid style value, like fg=blue, is dropped and the default used. The size rule catches people out: size=300 returns a 1024-pixel PNG, not a 300-pixel one. To show a code smaller, set width and height where you display it.

Fixed for now: error correction level M, a 2-module quiet zone, and UTF-8 text. The QR standard asks for a 4-module quiet zone, so add white space around the image in print. There's no parameter for the error correction level; the error correction guide explains what M recovers. The SVG has a viewBox but no width or height, so set the size where you display it.

Content parameters by kind

ParameterNotes
url (alias link)Up to 2,000 characters. https:// is added when there's no scheme. Needs a real host name with a dot, like example.com.

Payload: the link itself. Example: ?url=example.com encodes https://example.com.

Plain text (text)

ParameterNotes
textUp to 2,000 characters, encoded exactly as given.

Wi-Fi (wifi)

ParameterNotes
ssid (alias wifi)Network name, up to 64 characters. Required.
passwordUp to 128 characters.
securityWPA (default), WEP or nopass. Case-sensitive.
hidden1 for a hidden network.

Payload: WIFI:T:WPA;S:<ssid>;P:<password>;; with ; , : " \ escaped. More in the Wi-Fi QR code guide.

Email (email), phone (phone), SMS (sms)

ParameterNotes
email (alias to), subject, bodyPayload: mailto:<email>?subject=…&body=…
phone (alias tel)Payload: tel:+<digits>. Send + as %2B.
sms, message (alias msg)Payload: SMSTO:<number>:<message>. With type=sms, phone works for the number.

WhatsApp (whatsapp)

ParameterNotes
whatsapp (alias wa)Number with country code, like 919876543210. With type=whatsapp, phone works too.
message (alias msg)Pre-filled message, up to 1,000 characters.

Payload: https://wa.me/<digits>?text=<message>. With only a message, the person picks who to send it to.

Contact card (vcard)

first (alias firstname), last (lastname), org (company, organization), jobtitle, phone (mobile), workphone, email, website (site), street, city, region (state), zip (postcode, postalcode), country. Needs a first name, last name or company. Payload: vCard 3.0, with CRLF line endings.

?type=vcard&first=Ada&last=Lovelace&phone=%2B441234567890&email=ada@example.com encodes:

BEGIN:VCARD
VERSION:3.0
N:Lovelace;Ada;;;
FN:Ada Lovelace
TEL;TYPE=CELL:+441234567890
EMAIL;TYPE=INTERNET:ada@example.com
END:VCARD

That's 137 bytes and a version 8 code (49×49 modules), against version 2 for a short link. Each field you add makes the squares smaller at the same printed size, so leave out the ones nobody will use.

Location (location)

ParameterNotes
q (aliases query, address)An address or place name.
lat + lng (aliases latitude, lon, long, longitude)Coordinates.
mapgoogle (default), apple or geo. geo only works with coordinates.

Payload: a Google Maps or Apple Maps link, or geo:<lat>,<lng>.

Calendar event (event)

ParameterNotes
title (alias summary)Required.
start, endYYYY-MM-DDTHH:mm, or YYYY-MM-DD for all day. Times ending in Z or +05:30 are converted to UTC.
allday1 for an all-day event.
tz (alias timezone)IANA zone like Europe/Berlin. Leave out for floating local time.
location, descriptionOptional.

Payload: a BEGIN:VEVENT block. With no end, timed events last one hour. With tz, times are converted to UTC in the code: ?type=event&title=Launch%20party&start=2027-03-14T18:00&end=2027-03-14T21:00&tz=Europe/Berlin encodes DTSTART:20270314T170000Z and DTEND:20270314T200000Z, because Berlin is one hour ahead of UTC that day.

Payments: UPI, Pix, SEPA (EPC) and crypto

KindParametersPayload
upiupi (aliases pa, vpa), amount (am)upi://pay?pa=…&am=…&cu=INR
pixpix (pixkey), name (≤25 chars), city (≤15), amount, txid, messagePix "copia e cola" (EMV) with CRC
epciban, name, bic, amount (EUR), reference (remittance), purposeEPC069-12 "GiroCode" text
cryptocrypto (btc), coin (network): bitcoin, ethereum, lightning; amount, label, message (Bitcoin only)bitcoin:, ethereum: or lightning: URI

Pix needs a key, name and city. EPC needs a name and a valid IBAN. Checksums (IBAN, CPF, CNPJ, Bitcoin addresses) are checked, and a failed check gives a 400. UPI has no payee-name parameter yet, so the code carries only the UPI ID, the amount (written with two decimals, so 250 becomes am=250.00) and cu=INR.

An EPC request such as ?type=epc&name=Max%20Mustermann&iban=DE89370400440532013000&amount=25.00&reference=Invoice%20123 encodes these lines (empty lines are fields left blank, as the format requires):

BCD
002
1
SCT

Max Mustermann
DE89370400440532013000
EUR25.00


Invoice 123

Limits and errors

StatusWhenBody
200Image returnedSVG or PNG
400No content, or content that isn't validPlain-text hint
413Too much data for one QR codePlain-text message

The 400 body is always the same hint: Missing or invalid content. Try ?url=example.com, ?upi=name@bank or ?type=wifi&ssid=MyWifi. A parameter longer than its limit is ignored rather than cut, so a 2,001-character text gets that 400 too. Error responses are cached for 5 minutes, so a fix shows up quickly.

Caching, CORS and headers

Successful responses send Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable, so browsers and CDNs can keep them for a year. They also send Access-Control-Allow-Origin: *, so fetch() and canvas drawing work from any website, plus X-Content-Type-Options: nosniff and a strict Content-Security-Policy that blocks scripts inside the SVG.

The same parameters always produce the same image. We won't remove or rename the parameters on this page, though new ones may be added. To change a code, change the URL.

For copy-paste snippets, start with QR codes in HTML or the API overview.

Written by Last updated