apyhub
Back
▣ OUTPUT KIT

Generate QR Code as SVG/PNG API

What it does

QR Code Generator creates a QR code image from text, URLs, Wi‑Fi settings, vCards, or TOTP auth data. Send your payload in the request body and get back a binary QR code you can render, download, or embed.

You control the code’s appearance with bg and fg hex colours, ecc error correction level, size in pixels, margin, and output format (png or svg). The type field selects the payload format: text, url, wifi, vcard, or otpauth.

For contact and network codes, include the matching fields such as vcard_name, vcard_email, vcard_phone, vcard_org, vcard_url, or wifi_ssid, wifi_password, wifi_encryption, and wifi_hidden. For authenticator codes, supply otp_issuer, otp_account, and otp_secret.

Use QR Code Generator when you need branded QR assets for receipts, posters, onboarding flows, login setup, or share links. It returns a binary image, so you can place the generated code directly into a page, email, or PDF workflow.

POST
Generate QR Code
https://api.eu.apyhub.com/frolic/generate-qr-code-svg-png

QUICKSTART

GUIDE

Quickstart

Generate a QR code from a URL or text and return it as a binary file.

curl -X POST "https://api.eu.apyhub.com/frolic/generate-qr-code-svg-png" \
  -H "apy-token: $APY_TOKEN" \
  --data-urlencode "type=url" \
  --data-urlencode "data=https://apyhub.com"

What you'll get back

Returns a binary response (string with format: binary) containing the generated QR code image.

TRY ITLIVE · 5 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body
Background colour, hex such as FFFFFF
Foreground colour, hex such as 000000
Error correction: L, M (default), Q or H. Higher survives more damage but holds less data

About this endpoint

What it does

Generates a QR code from the provided input data and returns it as a binary file. The QR code output can be formatted as either PNG or SVG, depending on the request body.

Request Body

ParameterTypeMandatoryDescription
bgStringNoBackground colour, hex such as FFFFFF. Default: FFFFFF.
fgStringNoForeground colour, hex such as 000000. Default: 000000.
eccENUMNoError correction level. Allowed values: L, M, Q, H. Default: M.
dataStringNoText or URL to encode. Required for encoding text or URL data.
sizeIntegerNoWidth and height in pixels. Minimum: 64, maximum: 2000. Default: 512.
typeENUMNoQR content type. Allowed values: text, url, wifi, vcard, otpauth. Default: text.
formatENUMNoOutput format. Allowed values: png, svg. Default: png.
marginIntegerNoQuiet zone around the code, in modules. Minimum: 0, maximum: 20. Default: 4.
vcard_orgStringNoCompany, for type vcard.
vcard_urlStringNoWebsite, for type vcard.
wifi_ssidStringNoNetwork name, for type wifi.
otp_issuerStringNoService name shown in the authenticator app, for type otpauth.
otp_secretStringNoBase32 TOTP secret, for type otpauth.
vcard_nameStringNoFull name, for type vcard.
otp_accountStringNoAccount name such as an email address, for type otpauth.
vcard_emailStringNoEmail address, for type vcard.
vcard_phoneStringNoPhone number, for type vcard.
wifi_hiddenBooleanNoIndicates that the network does not broadcast its name, for type wifi.
wifi_passwordStringNoNetwork password, for type wifi.
wifi_encryptionENUMNoWi-Fi encryption type. Allowed values: WPA, WEP, nopass.

Response

Returns a binary file containing the generated QR code image. The response schema is a single binary string, so the success payload is not JSON.

▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.