Skip to content
Documentation menu

QR codes

Create, update and export static and dynamic QR codes.

Create a QR code#

POST /qr-codes (scope qr_codes:write) creates a QR code. The minimal body contains information (name and type, static or dynamic) and content (contentType and data):

{
  "information": {
    "name": "Restaurant menu",
    "type": "dynamic"
  },
  "content": {
    "contentType": "url",
    "data": {
      "url": "https://example.com/menu"
    }
  }
}
  • Static: the content is encoded in the image, with no tracking. Dynamic: the QR code encodes a short Hyllo address; its destination stays editable after printing and its visits are counted.
  • type is immutable. domainId (custom domain) and short (custom code) only apply to dynamic QR codes and are immutable too.
  • The shape of data depends on contentType, and the available types on type (stores, file and menu: dynamic QR codes only). It is all in the reference.

A 402 means the dynamic QR code quota is reached (quota_reached) or a feature the plan does not include (plan_required): custom code, custom domain, advanced design or frame. Idempotency-Key is accepted.

Default design#

design (the look) and frame (the frame) are optional at creation. When absent, the API applies the token creator’s default design: their template marked as default in the app, otherwise the base design, with no frame.

If that template’s logo is not a media file of the token’s workspace, it is dropped (design.image comes out with src: null and enabled: false); the rest of the design is kept.

If you provide design, all its fields are required; without frame, the QR code has no frame. For a precise design, start from the design returned by GET /qr-codes/{qrCode}.

Advanced design options and frames depend on the plan (402 plan_required otherwise).

Export an image#

GET /qr-codes/{qrCode}/export (scope qr_codes:read) returns the QR code image, drawn by the same engine as the app’s preview: design, frame and logo included. A dynamic QR code encodes its short address, a static one its content.

format is required (png or svg). size is the width in pixels, for PNG only; its bounds and default value are in the reference.

curl -sS -f "https://api.hyllo.fr/api/public/v1/qr-codes/$1/export?format=png&size=1024" \
  -H "Authorization: Bearer $HYLLO_API_TOKEN" \
  -o qr-code.png

The response is an attachment (Content-Disposition: attachment): write its bytes to a file. Errors specific to export:

  • 422 logo_too_large: the SVG logo is too large.
  • 422 render_refused: the engine refuses to draw this QR code.
  • 422 export_not_available: this QR code cannot be exported (for example a dynamic QR code with no short address).
  • 503 renderer_unavailable: the rendering engine is unavailable, try again.

Export limits#

Export has a limit of its own: 20 per minute and per token, and 2 times that limit for all the workspace’s tokens, on top of the plan’s limit. Beyond it, 429 with Retry-After.

Every export is rendered on demand, with no cache on Hyllo’s side: keep the image on your side instead of requesting it again. A dynamic QR code does not need to be exported again when its destination changes, because the image encodes the short address, not the destination.

Update a QR code#

PATCH /qr-codes/{qrCode} (scope qr_codes:write) updates a QR code. All blocks are optional; in design, each field is optional and merged with the existing one. options is only accepted for a dynamic QR code.

The type (static or dynamic), the domain and the short code are immutable. To change a dynamic QR code’s destination, update content: the printed QR code stays valid.

organization or folderId answer 422 field_not_available.

What the API does not cover#

  • No deletion: DELETE /qr-codes/{qrCode} does not exist (405). Delete a QR code in the app.
  • No folders: folderId and organization are refused (422 field_not_available).
  • Nothing beyond the reference: what is not in it (sharing, conversion, CSV or PDF exports, reports, alerts) does not exist in the public API.

Read next