Skip to main content

Worked QR samples

The endpoint list below documents every operation’s parameters; this overlay walks a QR render the way a checkout or loyalty integration actually uses it: generate an arbitrary QR → render an SMS deep link → branch on the script-scheme rejection. Success envelopes are { data, meta } when you ask for JSON (format=json), and raw binary when you let the default image/png content-type carry the pixels — see How to read a worked sample. Script-execution URL schemes (javascript:, data:, vbscript:, …) are rejected with 422 even inside a { data, meta } JSON response, so a misrouted user gesture never becomes a stored XSS. Every response carries meta.request_id. Quote it when you report a render the SDK will not link to, or a phone number that failed the normalization the SMS route applies.

1. Generate a QR code for arbitrary data

GET /api/v1/qr/generate renders a QR for any text or URL payload. It streams image/png bytes by default, or a base64 data URL inside the standard { data, meta } envelope when you pass format=json. Script-execution URL schemes are rejected with 422.
200
  • data_url is a complete data:image/png;base64,… — assign it to an <img src> directly inside the browser, or paste it into a card body for an email client that honors inline images.
  • A 200 with JSON only asks for the envelope; the bytes are still attached per scan, not per poll — recompute is not needed on the second party’s page view.
GET /api/v1/qr/sms renders a QR that encodes an sms:<phone>?body=… deep link — scanning it opens the device’s native SMS composer addressed to the given number with an optional pre-filled body. The phone number is validated and normalised to E.164 before rendering.
200
  • The number is normalised before render — pass a national-format number and the route returns the same envelope with E.164 applied.
  • A 422 fires when the phone is unrouteable under the numbering plan; the rejected input is echoed back, not stored.

3. Render a WhatsApp click-to-chat QR code

GET /api/v1/qr/whatsapp renders a QR that encodes a https://wa.me/<phone>?text=… click-to-chat deep link — scanning it opens a WhatsApp chat with the given number and an optional pre-filled message. The number is validated for a dialable international format.

4. Errors

Errors follow the { error, meta } envelope. The failure every integrator hits: 422 — script-scheme rejection. A payload starting with javascript:, data:, vbscript: or any non-whitelisted scheme never reaches the renderer:
422