Generate a QR code from text or a URL

POST/v1/generate
RapidAPI ● LiveApyHub ○ Pending

Create one QR code from raw text or a URL. For Wi-Fi, contacts, events, payments and other structured content, use the dedicated typed endpoints so RapidAPI can validate and document every field.

The default response is JSON with a data_uri you can drop straight into an <img>. Set options.format to png, svg, jpeg, webp or pdf to get the image bytes instead. Add style for shapes, gradients, a logo, a frame or a caption; styled codes are decoded before they are returned and the response says verified: true|false with warnings that tell you what to change.

Free tier: data and all options except format: pdf. style and PDF are on PRO and above (a free-tier request that uses them returns 403 plan_excludes_feature and is not billed).

More examples and contract notes

More examples

PNG at 600 px

{
  "data": "https://example.com",
  "options": {
    "format": "png",
    "size": 600
  }
}

Styled with logo (PRO+)

{
  "data": "https://example.com",
  "options": {
    "format": "png",
    "size": 600,
    "error": "H"
  },
  "style": {
    "module": "rounded",
    "eye": "rounded",
    "gradient": {
      "type": "linear",
      "colors": [
        "#1d4ed8",
        "#9333ea"
      ],
      "angle": 45
    },
    "logo": {
      "base64": "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABK0lEQVR42u2aTRKCMAyFyRuuoVs5jZ5VTqNbOYiu2DjVAnlJU0qX0Gm+l7bTn1fpiOV0fbyX1JvGQVgxxQvaSoyUgGaKQRT4rW1LBHBNbyAi/JqYiAi/Jjaiwi9lQGT4JSyIDp9jQg3w/9jQVV5QS/Z/MaIm+BRrbxHgdb8kv59vT3qs3gP8+z9TCFjDJwe/tW5uGMEj81YiKAI0IAwRohk+rCxq5sS+FrIS2de21W4PHAIOAa0LYO5n2l4HNHeTjF7QtDGNg6AkACMBKDWGWXMIrPv6NUAM+JmZeiKbwao9UlqCZucA0/bpHK/eYeVdefkG+9tKRO6FFBusbVBrywkeXq6lXwYvQ9rK7IOnq27hVML7aQDbZpVIRveWZMH7bQO77TYfe0R6bvMBF8uc8cPjEvkAAAAASUVORK5CYII=",
      "size": 0.22
    }
  }
}

Print-ready PDF (PRO+)

{
  "data": "https://example.com",
  "options": {
    "format": "pdf",
    "size": 1200
  }
}

Style options (PRO and above):

  • style.module: square, rounded, dot, diamond, classy, leaf, vertical, horizontal, connected, star, hexagon, edge_cut
  • style.eye: square, rounded, circle, leaf, leaf_right, edge_cut
  • style.eye_ball: square, rounded, dot, diamond, edge_cut, leaf, star
  • style.gradient: {type: linear|radial, colors: [2–4 colours], angle}
  • style.logo: {url | base64, size: 0.1–0.3, shape: square|circle, padding, clean}
  • style.frame: {style: label|ribbon, text, color, text_color}; style.caption: {text, color, font_size}
  • style.background: {url | base64, opacity} — a photo behind the code

Body parameters

application/json
datastringREQUIRED

Raw text or URL to encode (1–4096 characters).

max length 4096
optionsobject

How a code is encoded and rendered. Defaults to a JSON data URI.

6 child fields
formatjson · png · svg · jpeg · webp · pdf

Output format. `json` returns a data URI plus metadata and is the default; png/svg/jpeg/webp/pdf return the image bytes.

default "json"
sizeinteger

Exact width in pixels; defaults to 8 px per module.

min 32max 2048
darkstring

Module colour: hex, rgb() or a CSS name.

default "#000000"
lightstring

Background colour; `transparent` or null for none.

default "#ffffff"
errorL · M · Q · H

Error correction: L 7%, M 15%, Q 25%, H 30%.

default "M"
verifyboolean

Decode the rendered code before returning it and report the result in `verified`. Default: on for styled codes, off for plain ones.

styleobject
11 child fields
modulesquare · rounded · dot · diamond · classy · leaf · vertical · horizontal · connected · star · hexagon · edge_cut
default "square"
eyesquare · rounded · circle · leaf · leaf_right · edge_cut
default "square"
eye_ballsquare · rounded · dot · diamond · edge_cut · leaf · star
default "square"
eye_colorstring | string[]

One colour, or three (top-left, top-right, bottom-left)

eye_ball_colorstring | string[]
gradientobject
3 child fields
typelinear · radial
default "linear"
colorsstring[]REQUIRED
anglenumber

Linear only; 0 = left→right, 90 = top→bottom

default 0min 0max 360
gradient_on_eyesboolean
default false
logoobject
6 child fields
urlstring

Public http(s) URL of a PNG/JPEG/WebP/GIF; max 2 MB

max length 2048
base64string

Inline image, base64 (optionally a data: URI); max 2 MB decoded

max length 2900000
sizenumber

Fraction of the symbol width

default 0.2min 0.05max 0.35
paddingnumber

Cleared margin around the logo, as a fraction of the symbol width

default 0.05min 0max 0.2
shapesquare · circle
default "square"
cleanboolean

Knock out the modules behind the logo

default true
backgroundobject

A photo or artwork behind the code (QRCode Monkey's 'transparent QR'). The image is scaled to cover the symbol; only dark modules are drawn on top, so pick `dark` with enough contrast — `verify` will tell you.

3 child fields
urlstring

Public http(s) URL of a PNG/JPEG/WebP/GIF; max 2 MB

max length 2048
base64string

Inline image, base64 (optionally a data: URI); max 2 MB decoded

max length 2900000
opacitynumber

Fade the image towards `light` (white by default) for contrast

default 1min 0.05max 1
captionobject
3 child fields
textstringREQUIRED
max length 80
font_sizeinteger

Pixels; default scales with the image

min 6max 200
colorstring
default "#000000"
frameobject
4 child fields
stylelabel · ribbon
default "label"
textstring
default "SCAN ME"max length 40
colorstring

Frame / label background

default "#000000"
text_colorstring
default "#ffffff"

Responses

The rendered code

application/json
formatjson

Echoes the requested output format.

image_formatstring

Encoding of the image inside data_uri.

media_typestring
widthinteger
heightinteger
data_uristring
warningsstring[]
verifiedboolean
contentstring
versioninteger
errorstring
image/png

Binary response body.

image/svg+xml

Binary response body.

image/jpeg

Binary response body.

image/webp

Binary response body.

application/pdf

Binary response body.