OPENQR API
Create static and dynamic QR codes by API
Render static QR codes without an account, or use API keys for dynamic QR codes with editable short links and scan tracking.
Authentication
Static QR rendering does not require authentication. Dynamic QR creation requires a bearer API key because it creates saved, editable links on your account.
Authorization: Bearer oqr_your_api_key_here
Create a static QR code
Static QR codes encode the final content directly inside the QR image. No account or API key is required.
curl -X POST "https://openqr.bernardchoong.com/api/v1/static-qr.php?format=svg" \
-H "Content-Type: application/json" \
-d '{
"type": "text",
"data": {
"text": "Visit booth A12"
},
"style": {
"pattern": "square",
"foreground": "#111827",
"background": "#ffffff"
}
}' \
--output openqr.svg
Create a dynamic QR code
Dynamic QR codes create a reusable short link. You can edit the destination later and scan tracking works through the redirect link. API key required.
curl -X POST "https://openqr.bernardchoong.com/api/v1/qr-codes.php" \
-H "Authorization: Bearer oqr_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"mode": "dynamic",
"type": "url",
"title": "Summer campaign",
"data": {
"url": "https://example.com/summer"
},
"style": {
"pattern": "square",
"foreground": "#111827",
"background": "#ffffff",
"qr_border": {
"enabled": true,
"style": "rounded"
}
}
}'
Dynamic response
{
"ok": true,
"id": 123,
"mode": "dynamic",
"type": "url",
"title": "Summer campaign",
"target_value": "https://example.com/summer",
"short_link": "https://openqr.bernardchoong.com/r/abc12345",
"preview_svg_url": "https://openqr.bernardchoong.com/api/v1/qr-image.php?id=123&format=svg",
"download_png_url": "https://openqr.bernardchoong.com/api/v1/qr-image.php?id=123&format=png&download=1",
"download_svg_url": "https://openqr.bernardchoong.com/api/v1/qr-image.php?id=123&format=svg&download=1"
}
Download a dynamic image
Image URLs returned by the dynamic API also require the bearer header.
curl "https://openqr.bernardchoong.com/api/v1/qr-image.php?id=123&format=png&download=1" \
-H "Authorization: Bearer oqr_your_api_key_here" \
--output openqr.png
Supported fields
| Type | Required data fields | Optional data fields |
|---|---|---|
url | url | |
text | text | |
email | email | subject, body |
phone | phone | |
wifi | ssid | password, encryption, hidden |
vcard | name | organization, phone, email, website |
Style options
All style options are optional.
{
"style": {
"error_correction": "M",
"pattern": "square",
"foreground": "#111827",
"background": "#ffffff",
"qr_border": {
"enabled": true,
"style": "rounded"
}
}
}
Supported patterns: square, rounded, dots, dotted, dot_matrix, round_dots, bubble. QR border style supports square or rounded.
Error format
{
"ok": false,
"error": {
"code": "validation_error",
"message": "Enter a valid link."
}
}