API Documentation
Generate QR codes programmatically. Free tier: 100 calls/day. Upgrade to Pro for 10,000/day.
Endpoint
POST https://qrcrack.com/api/v1/generateRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | QR code type (see types below) |
| data | object | Yes | Type-specific data fields |
| options | object | No | Customization (size, colors, error correction) |
Options
| Option | Type | Default | Description |
|---|---|---|---|
| size | number | 300 | Image size in pixels (100-1000) |
| fgColor | string | #000000 | Foreground color (hex) |
| bgColor | string | #ffffff | Background color (hex) |
| errorCorrectionLevel | string | M | L, M, Q, or H (higher = more resilient) |
Response
{
"qr": "data:image/png;base64,iVBORw0KGgo...",
"type": "url",
"content": "https://example.com",
"size": 400
}The qr field is a base64 PNG data URL you can use directly as an image src.
Rate Limits
| Plan | Daily Limit | Price |
|---|---|---|
| Free | 100 calls/day | $0 |
| Pro | 10,000 calls/day | $12/mo |
Code Examples
cURL
curl -X POST https://qrcrack.com/api/v1/generate \
-H "Content-Type: application/json" \
-d '{
"type": "url",
"data": { "url": "https://example.com" },
"options": { "size": 400, "fgColor": "#000000" }
}'JavaScript
const res = await fetch("https://qrcrack.com/api/v1/generate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "wifi",
data: { ssid: "MyNetwork", password: "s3cret", encryption: "WPA" },
options: { size: 300 },
}),
});
const { qr } = await res.json();
// qr is a base64 PNG data URL: "data:image/png;base64,..."
document.getElementById("img").src = qr;Python
import requests
import base64
res = requests.post("https://qrcrack.com/api/v1/generate", json={
"type": "vcard",
"data": {
"name": "Jane Doe",
"phone": "+1234567890",
"email": "jane@example.com",
"company": "Acme Inc"
}
})
qr_data_url = res.json()["qr"]
# Save as PNG
header, data = qr_data_url.split(",", 1)
with open("contact.png", "wb") as f:
f.write(base64.b64decode(data))QR Code Types
| Type | Data Fields | Description |
|---|---|---|
| url | url | Website URL |
| text | text | Plain text |
| wifi | ssid, password, encryption | WiFi auto-connect |
| vcard | name, phone, email, company, url | Contact card |
| to, subject, body | Pre-filled email | |
| sms | phone, message | Pre-filled SMS |
| phone | phone | Phone call |
| phone, message | WhatsApp chat | |
| location | latitude, longitude | Map location |
Error Handling
// 400 Bad Request
{ "error": "Missing 'type' field.", "validTypes": [...] }
// 422 Generation Error
{ "error": "QR generation failed: ..." }
// 429 Rate Limited
{ "error": "Rate limit exceeded...", "limit": 100, "remaining": 0 }
// CORS: All origins allowed