---
title: Generate QR Code as SVG/PNG API
slug: generate-qr-code-svg-png
url: https://apyhub.com/frolic/service/generate-qr-code-svg-png
provider: Hakimi Labs
categories: [Output Kit]
tags: [qr-codes, barcode-generation, wifi-sharing, vcard, totp, svg]
auth: api_key
version: 1.0
service_type: sync
endpoints: 1
atoms: 5
mcp: true
---

# Generate QR Code as SVG/PNG API

Generate QR codes for text, URLs, Wi‑Fi, vCards, and TOTP secrets. Returns a binary PNG or SVG with configurable colors, size, margin, and error correction.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/frolic/generate-qr-code-svg-png` | What it does Generates a QR code from the provided input data and returns it as a binary file. The… | 5 |

## Endpoint reference

### Generate QR Code

`POST https://api.eu.apyhub.com/frolic/generate-qr-code-svg-png` · 5 atoms · accepts `application/x-www-form-urlencoded` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `bg` | body | string | no | Background colour, hex such as FFFFFF Default: `FFFFFF`. |
| `fg` | body | string | no | Foreground colour, hex such as 000000 Default: `000000`. |
| `ecc` | body | string | no | Error correction: L, M (default), Q or H. Higher survives more damage but holds less data One of: L, M, Q, H. Default: `M`. |
| `data` | body | string | no | Text or URL to encode, for type text or url Example: `https://example.com`. |
| `size` | body | integer (int32) | no | Width and height in pixels (64-2000) Default: `512`. |
| `type` | body | string | no | text (default), url, wifi, vcard or otpauth One of: text, url, wifi, vcard, otpauth. Example: `url`. |
| `format` | body | string | no | png or svg One of: png, svg. Default: `png`. |
| `margin` | body | integer (int32) | no | Quiet zone around the code, in modules (0-20) Default: `4`. |
| `vcard_org` | body | string | no | Company, for type vcard |
| `vcard_url` | body | string | no | Website, for type vcard |
| `wifi_ssid` | body | string | no | Network name, for type wifi |
| `otp_issuer` | body | string | no | Service name shown in the authenticator app, for type otpauth |
| `otp_secret` | body | string | no | Base32 TOTP secret, for type otpauth |
| `vcard_name` | body | string | no | Full name, for type vcard |
| `otp_account` | body | string | no | Account name such as an email address, for type otpauth |
| `vcard_email` | body | string | no | Email address, for type vcard |
| `vcard_phone` | body | string | no | Phone number, for type vcard |
| `wifi_hidden` | body | boolean | no | The network doesn't broadcast its name, for type wifi |
| `wifi_password` | body | string | no | Network password, for type wifi |
| `wifi_encryption` | body | string | no | WPA (default), WEP or nopass, for type wifi One of: WPA, WEP, nopass. |

#### Quickstart

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

```bash
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.

## About

## 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.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/frolic/service/generate-qr-code-svg-png
