Everything you need to integrate the QR Code API into your application
All API requests require an API key passed in the x-api-key header.
Demo API Key
Use your API key from the endpnt.dev dashboard in the x-api-key header.
https://qr.endpnt.dev/api/v1/generatehttps://qr.endpnt.dev/api/v1/generate?data=...Both GET and POST methods are supported. For POST requests, send parameters in the request body as JSON. For GET requests, send parameters as URL query parameters.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
data | string | Yes | — | Text, URL, or any data to encode in the QR code |
format | string | No | png | Output format: "png", "jpeg", "webp", "svg" |
size | number | No | 300 | QR code size in pixels (100-2000) |
color | string | No | #000000 | QR code color in hex format (e.g., #000000) |
background | string | No | #ffffff | Background color in hex format (e.g., #ffffff) |
margin | number | No | 2 | Margin around QR code (0-10) |
error_correction | string | No | M | Error correction level: "L", "M", "Q", "H" |
logo_url | string | No | — | URL to logo image for embedding (HTTP/HTTPS only) |
logo_size | number | No | 20 | Logo size as percentage of QR code (5-30) |
{
"success": true,
"data": {
"image": "base64_encoded_image_data...",
"format": "png",
"size": 300,
"file_size_bytes": 12840,
"warnings": []
},
"meta": {
"request_id": "req_a1b2c3d4",
"processing_ms": 245,
"remaining_credits": 99
}
}{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "data field is required and must be a string"
},
"meta": {
"request_id": "req_a1b2c3d4",
"processing_ms": 12
}
}Test the API directly from this page. Enter your API key above to start testing.
curl -X POST https://qr.endpnt.dev/api/v1/generate \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": "https://example.com",
"format": "png",
"size": 300,
"color": "#000000",
"background": "#ffffff",
"error_correction": "M"
}'// Using fetch
const response = await fetch('https://qr.endpnt.dev/api/v1/generate', {
method: 'POST',
headers: {
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: 'https://example.com',
format: 'png',
size: 300,
color: '#000000',
background: '#ffffff',
logo_url: 'https://example.com/logo.png',
logo_size: 20
})
});
const result = await response.json();
if (result.success) {
// result.data.image contains base64 image data
const img = document.createElement('img');
img.src = `data:image/${result.data.format};base64,${result.data.image}`;
document.body.appendChild(img);
}// Using Node.js with axios
const axios = require('axios');
const fs = require('fs');
async function generateQR(data) {
try {
const response = await axios.post(
'https://qr.endpnt.dev/api/v1/generate',
{
data: data,
format: 'png',
size: 300,
color: '#000000',
background: '#ffffff'
},
{
headers: {
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
}
}
);
if (response.data.success) {
const imageBuffer = Buffer.from(response.data.data.image, 'base64');
fs.writeFileSync('qrcode.png', imageBuffer);
console.log('QR code generated!');
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
generateQR('https://example.com');import requests
import base64
# Make the API request
response = requests.post(
'https://qr.endpnt.dev/api/v1/generate',
headers={
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
},
json={
'data': 'https://example.com',
'format': 'png',
'size': 300,
'color': '#000000',
'background': '#ffffff',
'error_correction': 'M'
}
)
result = response.json()
if result['success']:
# Decode and save the QR code
image_data = base64.b64decode(result['data']['image'])
with open('qrcode.png', 'wb') as f:
f.write(image_data)
print(f"Saved QR code: {result['data']['size']}px")| Code | Status | Description |
|---|---|---|
AUTH_REQUIRED | 401 | Missing x-api-key header |
INVALID_API_KEY | 401 | API key does not exist or is invalid |
RATE_LIMIT_EXCEEDED | 429 | Too many requests for your tier |
INVALID_PARAMS | 400 | Parameter validation failed |
DATA_TOO_LONG | 400 | Input data exceeds maximum length |
LOGO_FETCH_FAILED | 400 | Could not fetch or process logo image |
GENERATION_FAILED | 500 | QR code generation failed |
INTERNAL_ERROR | 500 | Internal server error |
Rate limits depend on your subscription tier:
Rate Limit Headers
Check the remaining_credits field in the response to track your usage. When limits are exceeded, you'll receive a 429 status code.
Can't find what you're looking for? We're here to help.