QRay API
Buat kode QR dari aplikasi Anda melalui REST API sederhana: 8 tipe data, PNG dan SVG, warna, gradien, logo, dan bingkai — semua yang bisa dilakukan generator web.
https://qray.io/api/v1
Coba sekarang — tanpa daftar
Tempel ini di terminal. Satu permintaan, langsung dapat kode QR asli:
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
Membuka qr.png (macOS; di Linux pakai xdg-open qr.png). Tanpa kunci — demo mengizinkan 10 permintaan/jam per IP.
Autentikasi
Setiap permintaan harus menyertakan kunci API di header X-Api-Key. Buat dan kelola kunci di dasbor Anda.
curl https://qray.io/api/v1/usage \ -H "X-Api-Key: qray_live_YOUR_KEY"
Kunci lengkap hanya ditampilkan sekali, saat dibuat. Simpan di secret manager — kami hanya menyimpan digest SHA-256.
Mulai cepat
Buat kode QR bergaya untuk sebuah 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 }
}
}
}'
Respons berisi gambar dalam base64 serta URL permanen:
{
"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"
}
Endpoint
| Endpoint | Deskripsi |
|---|---|
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 |
Butuh spesifikasi machine-readable? Jelajahi secara interaktif atau impor file OpenAPI kami ke Postman, Insomnia, atau generator klien: Penjelajah API interaktif · openapi.yaml
Tipe QR dan kolomnya
Kirim tipe data di qr.type dan kolomnya di 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 |
Misalnya, QR WiFi yang bisa dipindai tamu untuk terhubung:
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
Opsi dan gaya
| Parameter | Deskripsi |
|---|---|
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. |
Gambar di-cache 24 jam lalu diregenerasi secara transparan — image_url permanen dan aman untuk hotlink.
Paket dan batas
Setiap kunci punya kuota harian yang direset tengah malam UTC:
| Paket | Permintaan |
|---|---|
| free | 100 permintaan / hari |
| pro | 10 000 permintaan / hari |
| enterprise | 100 000 permintaan / hari |
Setiap respons memuat status jendela saat ini:
X-RateLimit-Limit: 100 X-RateLimit-Remaining: 87
Butuh pro atau enterprise? Tulis ke support@qray.io — kami tingkatkan kunci Anda.
Kesalahan
| HTTP | error | Deskripsi |
|---|---|---|
| 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. |