Appearance
Batch Generation
Generate multiple QR codes in a single API request. Returns a ZIP archive containing all generated images.
Pro Feature
Batch generation is available on Pro and Enterprise plans.
Endpoint
POST /api/batchRequest Body
json
{
"items": [
{
"data": "https://example.com/product/1",
"filename": "product-1.png"
},
{
"data": "https://example.com/product/2",
"filename": "product-2.png",
"size": 500,
"color": "4F46E5"
},
{
"data": "https://example.com/product/3",
"filename": "product-3.png"
}
],
"defaults": {
"size": 300,
"format": "png",
"color": "000000",
"background": "ffffff",
"errorCorrection": "M"
}
}Request Fields
| Field | Type | Required | Description |
|---|---|---|---|
items | array | ✅ | Array of QR codes to generate (max 100) |
defaults | object | - | Default settings for all items |
Item Fields
| Field | Type | Required | Description |
|---|---|---|---|
data | string | ✅ | Content to encode |
filename | string | - | Output filename (auto-generated if not provided) |
size | number | - | Override default size |
format | string | - | Override default format |
color | string | - | Override default color |
background | string | - | Override default background |
errorCorrection | string | - | Override default error correction |
Response
Returns a ZIP file containing all generated QR codes.
Content-Type: application/zip
Content-Disposition: attachment; filename="qrcodes.zip"Examples
Basic Batch Generation
bash
curl -X POST "https://www.qrcodeapi.io/api/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{"data": "https://example.com/1"},
{"data": "https://example.com/2"},
{"data": "https://example.com/3"}
]
}' \
-o qrcodes.zipWith Custom Settings
bash
curl -X POST "https://www.qrcodeapi.io/api/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"items": [
{"data": "Product A", "filename": "product-a.png"},
{"data": "Product B", "filename": "product-b.png"},
{"data": "Product C", "filename": "product-c.png"}
],
"defaults": {
"size": 500,
"color": "22c55e",
"format": "png"
}
}' \
-o products.zipJavaScript Example
javascript
async function generateBatch(items, defaults = {}) {
const response = await fetch('https://www.qrcodeapi.io/api/batch', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ items, defaults })
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.message);
}
return response.blob();
}
// Generate QR codes for a product list
const products = [
{ id: 1, name: 'Widget A', url: 'https://shop.com/widget-a' },
{ id: 2, name: 'Widget B', url: 'https://shop.com/widget-b' },
{ id: 3, name: 'Widget C', url: 'https://shop.com/widget-c' }
];
const items = products.map(p => ({
data: p.url,
filename: `${p.name.toLowerCase().replace(' ', '-')}.png`
}));
const zipBlob = await generateBatch(items, {
size: 400,
color: '000000'
});
// Download the ZIP
const url = URL.createObjectURL(zipBlob);
const a = document.createElement('a');
a.href = url;
a.download = 'product-qrcodes.zip';
a.click();Python Example
python
import requests
import zipfile
import io
def generate_batch(items, defaults=None):
payload = {'items': items}
if defaults:
payload['defaults'] = defaults
response = requests.post(
'https://www.qrcodeapi.io/api/batch',
json=payload,
headers={'Authorization': f'Bearer {API_KEY}'}
)
response.raise_for_status()
return response.content
# Generate QR codes for URLs
urls = [
'https://example.com/page1',
'https://example.com/page2',
'https://example.com/page3'
]
items = [{'data': url, 'filename': f'qr-{i}.png'} for i, url in enumerate(urls)]
zip_content = generate_batch(items, {
'size': 500,
'color': '4F46E5'
})
# Extract the ZIP
with zipfile.ZipFile(io.BytesIO(zip_content)) as z:
z.extractall('qrcodes/')Node.js Example
javascript
const fs = require('fs');
const https = require('https');
async function generateBatch(items, defaults = {}) {
return new Promise((resolve, reject) => {
const payload = JSON.stringify({ items, defaults });
const options = {
hostname: 'www.qrcodeapi.io',
path: '/api/batch',
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(payload)
}
};
const req = https.request(options, (res) => {
const chunks = [];
res.on('data', chunk => chunks.push(chunk));
res.on('end', () => resolve(Buffer.concat(chunks)));
});
req.on('error', reject);
req.write(payload);
req.end();
});
}
// Usage
const items = [
{ data: 'https://example.com/1', filename: 'qr1.png' },
{ data: 'https://example.com/2', filename: 'qr2.png' },
{ data: 'https://example.com/3', filename: 'qr3.png' }
];
const zipBuffer = await generateBatch(items, { size: 400 });
fs.writeFileSync('qrcodes.zip', zipBuffer);Limits
| Plan | Max Items per Request | Requests per Minute |
|---|---|---|
| Pro | 100 | 10 |
| Enterprise | 1,000 | 100 |
Error Handling
Partial Failures
If some items fail but others succeed, the ZIP will contain:
- Successfully generated QR codes
- An
errors.jsonfile listing failures
json
{
"errors": [
{
"index": 2,
"data": "invalid-data-too-long...",
"error": "Data exceeds maximum length"
}
]
}Common Errors
| Status | Message | Solution |
|---|---|---|
| 400 | items array required | Include items array in request |
| 400 | Maximum 100 items allowed | Split into multiple requests |
| 403 | Batch generation requires Pro plan | Upgrade your plan |
| 429 | Rate limit exceeded | Wait before retrying |
Use Cases
| Use Case | Example |
|---|---|
| Product Catalog | Generate QR codes for all SKUs |
| Event Tickets | Create unique QR codes for each attendee |
| Asset Labels | Label equipment with QR codes |
| Marketing | Generate QR codes for multiple campaigns |
| Inventory | Create labels for warehouse items |
Related
- Generate QR Code - Single QR code generation
- Dynamic Links - Trackable QR codes
- Bulk Generate Guide - Step-by-step tutorial