QR Code API Documentation
Generate QR codes with a simple REST API. Free, no API key required, and CORS-enabled for browser use. Up to 100 requests per hour.
Base URL
https://nofolo.com/api/qr/generateAuthentication (Optional)
The API works without authentication at 100 requests/hour per IP. For higher limits (1,000 req/hr), create a free API key from your dashboard.
# With API key (1,000 req/hr) curl "https://nofolo.com/api/qr/generate?data=hello" \ -H "Authorization: Bearer nf_live_your_key_here" # Without API key (100 req/hr) — no header needed curl "https://nofolo.com/api/qr/generate?data=hello"
| Tier | Rate Limit | Auth Required |
|---|---|---|
| Free (no key) | 100 requests/hour per IP | No |
| API Key | 1,000 requests/hour | Authorization: Bearer nf_live_... |
GETGenerate QR Code
Generate a QR code image by passing parameters as query strings. Returns a PNG image by default, or SVG if specified.
GET /api/qr/generate?data=https://example.com&size=300&color=%231F4E79
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| data* | string | — | Required. The text or URL to encode in the QR code. Max 4,296 characters. |
| format | string | png | Output format: png or svg. |
| size | number | 300 | Image width/height in pixels. Range: 50–2000. |
| margin | number | 4 | Quiet zone margin in modules. Range: 0–20. |
| color | string | #1F4E79 | Foreground color (hex). e.g. %231F4E79 or 1F4E79. |
| bgColor | string | #FFFFFF | Background color (hex). |
| ec | string | M | Error correction level: L (7%), M (15%), Q (25%), H (30%). |
| output | string | — | Set to json to return a JSON object with a data URL instead of raw image. |
POSTGenerate QR Code (JSON)
Send a JSON body for more complex data. Always returns a JSON response with a base64 data URL.
POST /api/qr/generate
Content-Type: application/json
{
"data": "https://example.com",
"format": "png",
"size": 400,
"color": "#1F4E79",
"bgColor": "#FFFFFF",
"ec": "H"
}Response
{
"data": "data:image/png;base64,iVBORw0KGgo...",
"format": "png",
"size": 400,
"ec": "H"
}Code Examples
cURL
# Download as PNG
curl -o qr-code.png "https://nofolo.com/api/qr/generate?data=https://example.com&size=400"
# Get as SVG
curl -o qr-code.svg "https://nofolo.com/api/qr/generate?data=https://example.com&format=svg"
# POST with JSON body
curl -X POST https://nofolo.com/api/qr/generate \
-H "Content-Type: application/json" \
-d '{"data":"https://example.com","size":400,"color":"#1F4E79","ec":"H"}'JavaScript
// Display QR code as an image
const img = document.createElement('img');
img.src = 'https://nofolo.com/api/qr/generate?data=https://example.com&size=300';
document.body.appendChild(img);
// Or fetch as JSON with data URL
const res = await fetch('https://nofolo.com/api/qr/generate?data=https://example.com&output=json');
const { data } = await res.json();
console.log(data); // "data:image/png;base64,..."
// POST request
const response = await fetch('https://nofolo.com/api/qr/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
data: 'WIFI:T:WPA;S:MyNetwork;P:MyPassword;;',
size: 400,
color: '#1F4E79',
ec: 'H',
}),
});
const result = await response.json();Python
import requests
# Download PNG
response = requests.get(
"https://nofolo.com/api/qr/generate",
params={"data": "https://example.com", "size": 400}
)
with open("qr-code.png", "wb") as f:
f.write(response.content)
# POST with JSON
response = requests.post(
"https://nofolo.com/api/qr/generate",
json={
"data": "https://example.com",
"size": 400,
"color": "#1F4E79",
"ec": "H",
}
)
data_url = response.json()["data"]HTML (Inline)
<!-- Embed directly in an img tag --> <img src="https://nofolo.com/api/qr/generate?data=https://example.com&size=200" alt="QR Code" width="200" height="200" />
Try It Out
Test the API live. Enter your data and see the generated QR code instantly.
https://nofolo.com/api/qr/generate?data=https%3A%2F%2Fexample.com&size=300&color=%231F4E79&bgColor=%23FFFFFF&format=png&ec=MEmbeddable Widget
Add a full QR code generator to any website with a single script tag. The widget runs in an iframe and includes input fields, color pickers, and a download button.
<!-- Drop-in widget -->
<script src="https://nofolo.com/embed.js" data-type="url"></script>
Widget Options (data attributes)
| Attribute | Default | Description |
|---|---|---|
| data-type | url | QR type: url, text, wifi, email, phone, sms |
| data-color | 1F4E79 | Foreground color (hex without #) |
| data-bg | FFFFFF | Background color (hex without #) |
| data-width | 400 | Widget width in pixels |
| data-height | 520 | Widget height in pixels |
Rate Limits
100 requests/hour (no key) or 1,000 requests/hour (with API key)
The API uses a sliding window rate limiter. Check the X-RateLimit-Remaining response header to monitor your usage. If you exceed the limit, you will receive a 429 status code with a Retry-After header. Create a free API key for 10x higher limits.
Error Responses
| Status | Meaning |
|---|---|
| 400 | Bad request — missing data parameter, invalid color, or data too long |
| 429 | Rate limit exceeded — wait and retry (check Retry-After header) |
| 500 | Server error — QR generation failed |
Supported QR Data Formats
Pass any of these string formats as the data parameter to generate specialized QR codes:
URL
https://example.comPlain Text
Hello, world!WiFi
WIFI:T:WPA;S:MyNetwork;P:MyPass;;mailto:hi@example.com?subject=HiPhone
tel:+1234567890SMS
sms:+1234567890?body=HelloLocation
geo:40.7829,-73.9654vCard
BEGIN:VCARD\nVERSION:3.0\n...https://wa.me/1234567890Crypto
bitcoin:1A1zP1...?amount=0.01Frequently Asked Questions
Do I need an API key?
No. The API works without authentication at 100 requests per hour. For higher limits (1,000 req/hr), create a free API key from your Nofolo dashboard.
Can I use this in production?
Yes. The API is CORS-enabled and works from any domain. Without a key it is rate-limited to 100 requests per hour per IP. With an API key you get 1,000 requests per hour.
What is the maximum data length?
QR codes can encode up to 4,296 alphanumeric characters. The API enforces this limit and returns a 400 error if exceeded.
Can I generate QR codes with a logo?
The REST API generates standard QR codes without logos. For custom logos, shapes, and frames, use our visual generator or the qr-code-styling JavaScript library.
Are the generated QR codes static or dynamic?
Static. The API generates the QR code directly from the data you provide — no tracking, no redirect URLs. For dynamic QR codes with scan tracking, use the full Nofolo dashboard.
What error correction level should I use?
M (15%) is the default and works well for most uses. Use H (30%) if the code will be printed small or on textured surfaces. Use L (7%) to maximize data capacity.
Try the Visual QR Code Generator
Not a developer? Use our visual generator — no code required.
Create QR Code