Da sviluppatore non vuoi creare QR code manualmente da una dashboard: vuoi generarli automaticamente, integrarli nella tua pipeline di build e reagire alle scansioni tramite webhook. È esattamente per questo che è nato qr3.app.
Lo stack
qr3.app è interamente nativo su Cloudflare:
- API Worker: Hono su Cloudflare Workers (runtime V8, zero dipendenze da Node.js)
- Redirect Worker: worker ultra-leggero, redirect in cache su KV in < 5 ms p50
- Database: Cloudflare D1 (SQLite) con multi-tenancy tramite
workspace_id - Queue: eventi di scansione disaccoppiati tramite Cloudflare Queues
Autenticazione
Tutte le richieste API richiedono un Bearer token e un ID del workspace:
POST https://qr3.app/v1/codes
Authorization: Bearer qr3_sk_...
Content-Type: application/json
Crea le tue API key su app.qr3.app/dashboard/api-keys.
SDK TypeScript
npm install @qr3/sdk
# oppure
pnpm add @qr3/sdk
import { QR3 } from "@qr3/sdk";
const client = new QR3({
apiKey: process.env.QR3_API_KEY!,
workspaceId: process.env.QR3_WORKSPACE_ID!,
});
// Create a QR code
const { data: code } = await client.codes.create({
type: "url",
url: "https://my-shop.com/product/42",
title: "Product 42",
tags: ["shop", "product"],
});
console.log(code.short_code); // "r7f3Kx"
console.log(code.image_svg_url); // SVG image URL
console.log(code.redirect_url); // https://qr3.app/r7f3Kx
// Change URL later (dynamic codes only)
await client.codes.update(code.id, {
url: "https://my-shop.com/product/42-new",
});
// Query analytics
const stats = await client.codes.stats(code.id, {
from: "2026-01-01",
to: "2026-03-31",
});
console.log(stats.data.total_scans); // e.g. 1247
REST API diretta
Nessuna dipendenza dall'SDK? La REST API è utilizzabile direttamente:
# Create a QR code
curl -X POST https://qr3.app/v1/codes \
-H "Authorization: Bearer $QR3_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "url",
"url": "https://my-site.com",
"title": "My Site",
"is_dynamic": true
}'
# List all QR codes
curl https://qr3.app/v1/codes?limit=20 \
-H "Authorization: Bearer $QR3_API_KEY"
# Download QR code as SVG (with logo overlay)
curl "https://qr3.app/v1/codes/r7f3Kx/qr.svg?size=8&logo_url=https://mylogo.com/logo.png" \
-o qrcode.svg
CLI
Per lo scripting e per il CI/CD c'è la @qr3/cli:
npm install -g @qr3/cli
qr3 login
# Create QR code and save as SVG
qr3 codes create --url "https://my-site.com" --title "CI Deploy" --output qr.svg
# Batch creation from CSV
qr3 codes batch import urls.csv --format svg --output ./qr-codes/
Webhook: reagisci alle scansioni
I webhook sono la funzionalità più potente: ti permettono di reagire in tempo reale a ogni singola scansione.
// Register a webhook
const { data: webhook } = await client.webhooks.create({
url: "https://your-app.com/webhooks/qr3",
events: ["scan.created", "code.updated"],
});
Payload del webhook
{
"event": "scan.created",
"timestamp": "2026-03-15T14:30:00Z",
"data": {
"code_id": "code_abc123",
"short_code": "r7f3Kx",
"country": "DE",
"city": "Berlin",
"device": "mobile",
"os": "iOS",
"browser": "Safari"
}
}
Verifica dei webhook (HMAC)
import { createHmac } from "crypto";
export async function verifyWebhook(
payload: string,
signature: string,
secret: string,
): Promise<boolean> {
const expected = createHmac("sha256", secret)
.update(payload)
.digest("hex");
return `sha256=${expected}` === signature;
}
Rate limiting
| Piano | Codici/giorno | Richieste API/min |
|---|---|---|
| Free | 10 | 60 |
| Pro | 100 | 300 |
| Business | 1.000 | 1.200 |
| Enterprise | Illimitati | Personalizzato |
Header di rate limit in ogni risposta:
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 247
X-RateLimit-Reset: 1710510060
Formato degli errori (RFC 7807)
Tutti gli errori seguono lo standard RFC 7807 Problem Details:
{
"type": "https://docs.qr3.app/errors/validation",
"title": "Validation Error",
"status": 422,
"detail": "url is required for type 'url'",
"errors": [
{ "field": "url", "message": "Required" }
]
}
Conclusione
qr3.app è stato progettato fin dalle fondamenta come strumento per sviluppatori: REST API aperta, SDK TypeScript-first, CLI, webhook e documentazione OpenAPI completa. Dai un'occhiata alla documentazione API oppure inizia subito dalla Dashboard.