QR codes on event tickets
This guide adds a QR code to each ticket your backend issues. The code encodes a signed ticket URL that your door scanners verify.
1. Create a dedicated key
Create a key named tickets-backend with the Developer role and a service restriction of qrcode. Store the secret in your secret manager as WEBKNX_SECRET_KEY.
2. Encode a signed URL, not raw data
Encode a URL such as https://tickets.example.com/t/9f2c…?sig=…. Your scanner app checks the signature, so a copied or altered code is rejected at the door.
3. Generate the image at checkout
curl -X POST https://webknx.com/api/v1/qrcode \
-H "Authorization: Bearer $WEBKNX_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"data":"https://tickets.example.com/t/9f2c?sig=abc","size":600,"error_correction":"quartile"}' \
--output ticket.png
Use quartile or high error correction for printed or phone-screen tickets, which get scratched, folded or shown at low brightness.
4. Store, don't regenerate
Save the PNG with the ticket (for example in object storage) and attach it to the confirmation email. Generating once per ticket keeps your cost at one credit per ticket.
5. Handle failures
Retry 429 and 5xx responses with backoff (see errors and retries). Failed attempts are not charged.