QRay API
Generate QR codes from your own apps with a simple REST API: all 8 data types, PNG and SVG, colors, gradients, logos and frames — everything the web generator can do.
https://qray.io/api/v1
Try it now — no signup
Paste this in your terminal. You get a real QR code back in one request:
curl -X POST https://qray.io/api/v1/demo \
-H "Content-Type: application/json" \
-d '{"qr":{"type":"url","fields":{"url":"https://qray.io"},"style":{"dot_style":"rounded","gradient":{"colors":["#2563EB","#A3E635"],"angle":45}}}}' \
-o qr.png && open qr.png
Opens qr.png (macOS; on Linux use xdg-open qr.png). No key needed — the demo allows 10 requests/hour per IP.
Authentication
Every request must include your API key in the X-Api-Key header. Create and manage keys in your dashboard.
curl https://qray.io/api/v1/usage \ -H "X-Api-Key: qray_live_YOUR_KEY"
The full key is shown only once, at creation. Store it in a secret manager — we keep only a SHA-256 digest.
Quickstart
Generate a styled QR code for a URL:
curl -X POST https://qray.io/api/v1/generate \
-H "X-Api-Key: qray_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"qr": {
"type": "url",
"fields": { "url": "https://example.com" },
"format": "png",
"size": 512,
"style": {
"fg_color": "#111113",
"dot_style": "rounded",
"gradient": { "colors": ["#2563EB", "#A3E635"], "angle": 45 }
}
}
}'
The response contains the image as base64 plus permanent URLs:
{
"hash": "1c9a7f2b40d861e3",
"format": "png",
"size": 512,
"image": "iVBORw0KGgoAAA…", // base64
"image_url": "https://qray.io/qr/1c9a7f2b40d861e3.png",
"share_url": "https://qray.io/qr/1c9a7f2b40d861e3",
"url": "/qr/1c9a7f2b40d861e3"
}
Endpoints
| Endpoint | Description |
|---|---|
POST /api/v1/demo |
Generate a QR code without a key (keyless demo) |
POST /api/v1/generate |
Generate a QR code |
GET /api/v1/qr_codes |
List your QR codes |
GET /api/v1/qr_codes/:hash |
Get one QR code |
DELETE /api/v1/qr_codes/:hash |
Delete a QR code |
GET /api/v1/qr_codes/:hash/image |
Get the QR image binary |
GET /api/v1/health |
Service health and deployed version |
GET /api/v1/usage |
Current plan and usage |
GET /api/v1/api_keys |
List your API keys |
POST /api/v1/api_keys |
Create an additional API key |
DELETE /api/v1/api_keys/:id |
Revoke an API key |
Prefer a machine-readable spec? Explore it interactively or import our OpenAPI file into Postman, Insomnia or a client generator: Interactive API explorer · openapi.yaml
QR types and fields
Pass the data type in qr.type and its fields in qr.fields:
| type | fields |
|---|---|
url | url |
text | text |
wifi | ssid, password, encryption (WPA | WEP | nopass), hidden (true | false) |
vcard | first_name, last_name, phone, email, org, title, url |
email | address, subject, body |
phone | number |
sms | number, message |
geo | latitude, longitude |
For example, a WiFi QR your guests can scan to connect:
curl -X POST https://qray.io/api/v1/demo \
-H "Content-Type: application/json" \
-d '{"qr":{"type":"wifi","fields":{"ssid":"MyCafe","password":"latte123","encryption":"WPA"}}}' \
-o wifi.png && open wifi.png
Options and styling
| Parameter | Description |
|---|---|
format | png (default) | svg |
size | 256 | 512 (default) | 1024 | 2048 |
style.fg_color | Foreground hex color, e.g. #111113. |
style.bg_color | Background hex color, e.g. #FFFFFF. |
style.dot_style | square | circle | rounded |
style.eye_style | square | rounded |
style.logo_data | Raw base64 PNG/JPG, no data: prefix (max ~500 KB). |
style.gradient | Two or more colors; overrides fg_color. |
style.frame | PNG only; ignored for SVG. |
Images are cached for 24 hours and transparently regenerated afterwards — image_url is permanent and safe to hotlink.
Plans and rate limits
Each key has a daily quota that resets at midnight UTC:
| Plan | Requests |
|---|---|
| free | 100 requests / day |
| pro | 10 000 requests / day |
| enterprise | 100 000 requests / day |
Every response carries the current window state:
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 87
Need pro or enterprise? Write to support@qray.io and we will upgrade your key.
Errors
| HTTP | error | Description |
|---|---|---|
| 400 | missing_parameter | A required parameter is missing or the body is malformed. |
| 401 | unauthorized | Missing, invalid, or revoked API key. |
| 404 | not_found | Resource not found, or owned by another account. |
| 422 | cannot_delete_active_key | An API key cannot revoke the key used to authenticate the request. |
| 422 | invalid_data | The data to encode is empty or exceeds the length limit. |
| 422 | unknown_type | qr.type is not one of the supported types. |
| 422 | validation_failed | The resource could not be saved (see details). |
| 429 | rate_limited | The plan's daily request limit is exhausted. |
| 503 | service_unavailable | The QR generation service is temporarily unavailable. |