ChartQuery

QR Code

Generate a styled QR code via GET. Output: SVG (default), PNG, WebP or JPEG. Supports dot styles, gradients, custom corners and all QR versions.

Credit cost: 3 credits per call

GET
/v1/qrcode

Query Parameters

data*string

Data to encode in the QR code. Examples:

URL: https://chartquery.com Email: mailto:[email protected] Phone: tel:+1234567890 SMS: SMSTO:+1234567890:Hello! WiFi: WIFI:T:WPA;S:MyNetwork;P:secret123;; Geo: geo:48.8566,2.3522 Plain text: Hello from ChartQuery! vCard: BEGIN:VCARD VERSION:3.0 FN:John Doe EMAIL:[email protected] END:VCARD

size?number

Output size in pixels (width = height). Default: 200. Examples: ?size=200 (thumbnail), ?size=300 (standard), ?size=400 (large), ?size=600 (poster). For print, use the unit param with mm/cm instead.

ec_level?string

Error correction level. Default: M. Higher levels allow more damage/obscuring before the code becomes unreadable.

  • L (7%) — smallest size, minimal redundancy, best for clean environments
  • M (15%) — balanced, good for most use cases
  • Q (25%) — for outdoor or rough surfaces
  • H (30%) — required when adding a logo or image overlay

Example: ?ec_level=H

Default"M"
Value in"L" | "M" | "Q" | "H"
dot_type?string

Module (dot) shape. Default: square. Controls the visual style of each QR code module.

  • square — classic, maximum compatibility
  • rounded — softer edges, clean modern look
  • dots — fully circular modules, artistic
  • diamond — angular style
  • classy — elegant angular corners
  • classy-rounded — classy with rounded tips
  • extra-rounded — large pill-shaped modules
  • small-square / tiny-square — spaced square modules
  • vertical-line / horizontal-line — striped effect

Example: ?dot_type=rounded

Default"square"
Value in"square" | "rounded" | "dots" | "diamond" | "classy" | "classy-rounded" | "extra-rounded" | "vertical-line" | "horizontal-line" | "small-square" | "tiny-square"
color?string

Module color as CSS hex. Default: #000. Examples: ?color=%236366f1 (indigo), ?color=%23dc2626 (red), ?color=%23059669 (green), ?color=%230891b2 (teal). Use %23 to URL-encode #. For gradient objects, use POST instead.

shape?string

Overall QR code shape. Default: square. Use circle to clip the entire QR into a circle — great for profile/avatar-style codes. Example: ?shape=circle&dot_type=dots

Default"square"
Value in"square" | "circle"
dot_size?number

Module size ratio between 0.1 and 1. Default: 1 (full). Values below 1 add spacing between modules for a lighter look. Example: ?dot_size=0.85

background?string

Background color. Default: #fff. Set to transparent for no background. Example: ?background=%230f172a for dark background. Use %23 to encode #.

margin?number

Quiet zone width in modules around the QR code. Default: 4. Minimum recommended by the QR standard: 4. Example: ?margin=2 (compact) or ?margin=6 (extra padding).

version?number

QR version from 1 to 40 (determines grid size and data capacity). Leave unset for auto-selection based on data length and ec_level. Example: ?version=5

mode?string

Encoding mode. Default: auto (best mode selected for the data). Use numeric for digits-only, alphanumeric for uppercase + digits, byte for arbitrary text/UTF-8. Example: ?mode=numeric

Default"auto"
Value in"auto" | "numeric" | "alphanumeric" | "byte"
mask?number

Mask pattern from 0 to 7. Default: auto (best mask selected to minimize visual patterns). Only set manually if you need a deterministic output. Example: ?mask=3

unit?string

Measurement unit for the size param. Default: px. Use mm, in or cm with the size param for print-ready output. Example: ?size=50&unit=mm

Default"px"
Value in"px" | "mm" | "in" | "cm"
xml_declaration?boolean

Prepend an XML declaration () to the SVG output. Useful when the SVG will be used as a standalone XML file. Default: false. Example: ?xml_declaration=true

aria_label?string

Accessible label added as aria-label on the SVG element. Example: ?aria_label=QR+code+linking+to+chartquery.com

title?string

SVG element shown as a browser tooltip and used by screen readers. Example: ?title=ChartQuery+Website

desc?string

SVG element for extended accessibility description. Example: ?desc=Scan+to+visit+https://chartquery.com

format?string

Output format. Default: svg. Use png, webp or jpeg to get a raster image. SVG is lossless and scalable; PNG/WebP/JPEG are pixel-based and suitable for email, PDF or messaging. Example: ?format=png

Default"svg"
Value in"svg" | "png" | "webp" | "jpeg"
share?boolean

Set share=true to persist the config and receive JSON instead of an image: { id, render_url, view_url, embed_url, expires_in }. Free plan: 3-day expiry with watermark. Paid plan: 6-month expiry, no branding.

Default"false"
Value in"false" | "true"

Response Body

application/json

application/json

curl -X GET "https://api.chartquery.com/v1/qrcode?data=string"
Empty
{
  "error": "Bad Request"
}
{
  "error": "Internal Error"
}