QR Code REST API
A simple, RESTful API for generating QR codes. Standard HTTP methods, predictable URLs, and JSON error responses. Works with any programming language.
API Endpoints
GET /api/generate
Generate a QR code. Returns the image directly (PNG or SVG).
curl "https://qrcodeapi.io/api/generate?data=https://example.com" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o qr.png
POST /api/generate
Same as GET, but parameters in request body (useful for long data).
curl -X POST "https://qrcodeapi.io/api/generate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data": "https://example.com", "size": 400}' \
-o qr.png
POST /api/batch
Generate multiple QR codes in one request.
curl -X POST "https://qrcodeapi.io/api/batch" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"items": [{"data": "url1"}, {"data": "url2"}]}'
Request Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
data | string | required | Content to encode |
size | number | 300 | Size in pixels (50-2000) |
format | string | png | png or svg |
color | string | 000000 | QR color (hex) |
background | string | ffffff | Background (hex) |
errorCorrection | string | M | L, M, Q, or H |
margin | number | 4 | Quiet zone (0-10) |
Authentication
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Or use the X-API-Key header or api_key query parameter.
Response Codes
| Code | Meaning |
|---|---|
200 | Success - QR code returned as image |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
429 | Rate Limited - Too many requests |
500 | Server Error |
Error Response Format
{
"error": true,
"message": "API key required"
}