📖 Overview
The QR Code Generator API creates QR codes for various data types including plain text, URLs, contact information (vCard), calendar events, Wi-Fi credentials, and phone numbers. Powered by goQR.me REST API for reliable, high-quality QR code generation.
📝 Multiple Data Types
Support for text, URLs, vCards, events, Wi-Fi, and phone numbers
🎨 Customizable Output
Choose size, format (PNG, GIF, JPEG, SVG), and error correction level
🔒 Error Correction
Built-in error correction (L, M, Q, H levels) for damaged codes
📦 Flexible Responses
Direct image output or base64 encoded JSON response
🌐 Base URL
🔐 Authentication
No authentication required. This is a public API that can be accessed without any API keys or tokens.
📡 API Endpoints
GET / POST / Generate QR Code
Generate a QR code for one of six content types. Parameters can be supplied via the query string or as a JSON body; the same names are used in both. The format response mode decides whether you get the image bytes directly (image/png/svg) or a JSON wrapper with a base64-encoded payload (json/data).
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type |
string | Optional | text |
One of text, vcard, event, url, wifi, phone |
format |
string | Optional | json |
Response mode: image/png/svg for raw bytes, json/data for a JSON envelope with base64 |
file_type |
string | Optional | png |
Output format passed to goQR.me: png, gif, jpeg, jpg, svg, eps. Anything else silently falls back to png. The legacy alias gformat is also accepted. |
size |
integer | Optional | 300 | Pixel size (10–1000). Values outside this range are clamped. |
ecc |
string | Optional | M |
Error correction level: L, M, Q, H. Anything else falls back to M. |
qzone |
integer | Optional | 2 | Quiet zone size (0–100, clamped). |
margin |
integer | Optional | 1 | Margin (0–50, clamped). |
charset_source |
string | Optional | UTF-8 |
Source charset: UTF-8 or ISO-8859-1 |
charset_target |
string | Optional | UTF-8 |
Target charset: UTF-8 or ISO-8859-1 |
color |
string | Optional | 0-0-0 |
Foreground colour as R-G-B with hyphen separators (e.g. 0-0-0) |
bgcolor |
string | Optional | 255-255-255 |
Background colour as R-G-B |
Type-Specific Fields
Fields other than the ones above are forwarded to the payload builder for the chosen type.
| Type | Required field(s) | Optional fields |
|---|---|---|
text |
text |
— |
url |
url (auto-prefixes https:// if missing) |
— |
phone |
phone |
— |
wifi |
ssid |
password, encryption (WPA/WEP/nopass), hidden |
event |
summary, start |
end, location, description |
vcard |
at least one of: name part, nickname, organization |
legacy fields: first_name, middle_name, last_name, prefix, suffix, nickname, organization, title, note, work_email, home_email, work_phone, home_phone, mobile, fax, website, address, city, region, postcode, country. Dynamic lists: names[][type/value], nicknames[][type/value], emails[][type/value], phones[][type/value], urls[][value], addresses[][...] |
Example Request — Text
Example Request — URL
Example Request — Wi-Fi
Example Request — Event
Example Request — Phone
Example Request — vCard (POST JSON)
Dynamic lists must be sent as query-string / form parameters, not JSON keys. Single-value fields such as type, first_name, last_name and organization are read from the JSON body, but multi-value lists — emails[][type/value], phones[][type/value], names[][type/value], nicknames[][type/value], urls[][value], addresses[][...] — are only parsed from query-string / form-encoded arrays. Include them in the URL:
📊 Response Format
JSON envelope (format=json or format=data)
The qr_url field is a fully-qualified data: URL (MIME + base64) so you can drop it straight into an <img src> tag. goqr_url is the underlying goQR.me URL for debugging.
Direct image (format=image / png / svg)
The API returns the raw image bytes with the appropriate Content-Type header (image/png, image/svg+xml, etc.) and Content-Disposition: inline; filename="qr-code.<ext>".
Error Response
All errors come back as JSON with HTTP 400 (bad request) or 500 (upstream failure).
Unsupported type
Missing required field for a type
Invalid format response mode
Upstream failure (goQR.me unreachable / non-200)
🔧 Error Correction Levels
QR codes include built-in error correction that allows them to be read even when partially damaged. Choose the appropriate level based on your use case:
| Level | Recovery Capacity | Use Case |
|---|---|---|
| L (Low) | ~7% | Clean environments, small QR codes |
| M (Medium) | ~15% | General purpose, balanced |
| Q (Quartile) | ~25% | Outdoor use, potential damage |
| H (High) | ~30% | Harsh environments, logos overlay |
💡 Common Use Cases
🔗 Marketing & URLs
Link to websites, landing pages, app downloads, or promotional content.
📇 Contact Sharing
vCard QR codes for business cards or networking events.
📅 Event Management
Embed events into calendars with summary, start, end and location.
📶 Wi-Fi Access
Share WPA/WEP/nopass credentials for guests to auto-connect.
📞 Quick Call
Encode a phone number so a scan starts a call on most phones.
📝 Plain Text
Encode arbitrary text snippets, serial numbers, or short messages.
✨ Best Practices
- Sizing: Use 300px for most web display, 600–1000px for print. Defaults are tuned for typical web use.
- Error correction: Use
Hwhen overlaying logos or printing on curved/harsh surfaces. - Colours: Always keep the background lighter than the foreground and use high contrast.
- Quiet zone: Keep
qzone≥ 2 so scanners can latch onto the code reliably. - Output type: Use
format=image(orpng/svg) when you only want the bytes; useformat=jsonwhen you need the raw payload string alongside the image. - Payload inspection: The
payloadfield in JSON responses is the raw string that was encoded — useful for debugging or generating equivalent codes yourself.
⚠️ Error Codes
The API does not return a numeric code field. Every error has the shape { "error": "<title>", "message": "<details>" } with an appropriate HTTP status:
| HTTP status | error |
When |
|---|---|---|
400 |
Bad request |
Unsupported type, or a required type-specific field is missing / malformed |
400 |
Invalid format parameter |
format is not one of image, json, svg, png, data |
500 |
Internal server error |
goQR.me call failed (non-200 response, network error, malformed payload) |
Note: an unsupported file_type (e.g. bmp) is not an error — the server silently falls back to png so old clients keep working.
🔗 Integration Examples
HTML display
Point an <img> tag straight at the endpoint with the raw image format (format=image / png / svg):
JavaScript fetch (JSON)
JavaScript fetch (raw bytes)
POST JSON body
🚦 Rate Limits
This endpoint is rate-limited per client identity (IP address, or API key when one is supplied): 30 requests per minute. When the budget is exhausted the API responds with HTTP 429 and includes X-RateLimit-* headers so clients can self-throttle. The exact policy is configured in api/includes/api_config.php.
🎯 Ready to Try?
Test the QR Code Generator API with our interactive web interface or start integrating it into your application.
Try Web Interface Test API Endpoint