API Documentation
Complete reference for the QRCraft API
Contents
Getting Started
QRCraft API allows you to generate QR codes programmatically. To get started:
- Create an account and upgrade to Pro or Business plan
- Generate an API key from your dashboard
- Include the API key in your requests as a Bearer token or X-API-Key header
Base URL: https://qrcraft.org/api/v1
Authentication
All API requests require authentication. You can authenticate using either method:
Option 1: Bearer Token (recommended)
Authorization: Bearer qr_live_xxxxxxxxxxxxOption 2: X-API-Key Header
X-API-Key: qr_live_xxxxxxxxxxxxGenerate QR Code (POST)
/api/v1/qrGenerate a static QR code with full customization options.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | url, text, wifi, vcard, email, sms, phone |
| data | string/object | Yes | Content to encode (format depends on type) |
| format | string | No | png, svg, base64, dataurl (default: png) |
| options.size | number | No | 100-2000 (default: 300) |
| options.margin | number | No | 0-10 (default: 4) |
| options.foregroundColor | string | No | Hex color (default: #000000) |
| options.backgroundColor | string | No | Hex color (default: #ffffff) |
| options.errorCorrectionLevel | string | No | L, M, Q, H (default: M) |
Example Request
curl -X POST https://qrcraft.org/api/v1/qr \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "url",
"data": "https://example.com",
"format": "png",
"options": {
"size": 300,
"foregroundColor": "#000000",
"backgroundColor": "#ffffff"
}
}'Data Formats by Type
type: "url" or "text"
"data": "https://example.com"type: "wifi"
"data": { "ssid": "NetworkName", "password": "secret", "encryption": "WPA" }type: "email"
"data": { "email": "test@example.com", "subject": "Hello", "body": "..." }type: "sms"
"data": { "phone": "+1234567890", "message": "Hello!" }Generate QR Code (GET)
/api/v1/qrSimple QR code generation via URL parameters. Great for embedding in img tags.
Query Parameters
| Parameter | Description |
|---|---|
| data | Content to encode (required) |
| size | 100-2000 (default: 300) |
| format | png, svg (default: png) |
| fg | Foreground hex without # (default: 000000) |
| bg | Background hex without # (default: ffffff) |
| ecl | Error correction: L, M, Q, H (default: M) |
Example
<img src="https://qrcraft.org/api/v1/qr?data=https://example.com&size=200&fg=0066cc" />Dynamic QR Codes
Dynamic QR codes redirect through our servers, allowing you to change the destination URL and track scans.
/api/v1/dynamicCreate a new dynamic QR code
{ "targetUrl": "https://example.com/page" }/api/v1/dynamicList all your dynamic QR codes with scan counts
/api/v1/dynamic/:idUpdate destination URL
{ "targetUrl": "https://new-url.com" }/api/v1/dynamic/:id/statsGet scan analytics
{
"totalScans": 1234,
"scansByDay": [...],
"scansByCountry": [...],
"scansByDevice": [...]
}Response Formats
format: "png"
Returns binary PNG image with Content-Type: image/png
format: "svg"
Returns SVG markup with Content-Type: image/svg+xml
format: "base64"
Returns JSON with base64-encoded PNG
{ "success": true, "format": "base64", "data": "iVBORw0KGgo..." }format: "dataurl"
Returns JSON with data URL (ready for img src)
{ "success": true, "format": "dataurl", "data": "data:image/png;base64,..." }Rate Limits
Rate limit information is included in response headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1704067200Free
No API
Access
Pro - $9/mo
1,000
calls/month
Business - $29/mo
10,000
calls/month
Error Handling
Errors are returned as JSON with a descriptive message:
{
"success": false,
"error": "Rate limit exceeded",
"retryAfter": 3600,
"documentation": "https://qrcraft.io/docs/api"
}| Status | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 403 | Forbidden - API usage limit exceeded |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
Ready to Get Started?
Create your API key and start generating QR codes programmatically.
Go to Dashboard