MizQR: create, update and measure a dynamic QR from Node.js Prepared by the MizQR product team. Updated 14 November 2026. FILES AND REQUIREMENTS Download mizqr-api-example.txt (or clone it from GitHub), save it as mizqr-api-example.mjs, and keep it on your server or development computer. Node.js 22 or newer is required. No npm installation is needed for this sample. The file uses Node's built-in fetch and a 15-second request timeout. Node reference: https://nodejs.org/api/globals.html#fetch Use a verified workspace with current API access. In Developer settings, create a key with Manage access for creation and updates. API access and dynamic QR allowances depend on the current plan/offer. Copy the API base URL from the API reference: https://mizqr.com/api-docs Keep the token in a server environment or secret manager. It does not belong in a browser bundle, URL, screenshot, public repository or outreach attachment. POWERSHELL SETUP Replace the base below with the value shown in the API reference if different: $env:MIZQR_API_BASE = 'https://api.mizqr.com/api' $env:MIZQR_API_TOKEN = [System.Net.NetworkCredential]::new('', (Read-Host 'Workspace API key' -AsSecureString)).Password node mizqr-api-example.mjs --help macOS / LINUX BASH SETUP export MIZQR_API_BASE='https://api.mizqr.com/api' read -r -s -p 'Workspace API key: ' MIZQR_API_TOKEN printf '\n' export MIZQR_API_TOKEN node mizqr-api-example.mjs --help CREATE A RECORD Use your own intended destination instead of this reserved example domain: node mizqr-api-example.mjs create --title "Menu campaign" --url https://example.com/menu This makes one real dynamic URL QR record and uses the applicable allowance. Save the returned id and short_url in your own system. The id is a UUID; the path segment at the end of the short link is a different value. The API returns JSON, not a printable PNG or SVG. Open the saved code in the workspace to design/export the actual QR artwork, then check a physical proof. UPDATE THE SAME CODE node mizqr-api-example.mjs update QR_ID --url https://example.com/new-menu Replace QR_ID with the returned id, without angle brackets. Updating this saved dynamic code changes its destination while keeping its printed short link. It does not edit an already printed static QR, or replace an image file. READ ANALYTICS node mizqr-api-example.mjs analytics QR_ID --from 2026-11-01 --to 2026-11-14 Use your reporting dates. Dates are interpreted in the workspace time zone; the API accepts a period of at most 366 days. The sample prints total_scans and unique_scans. Zero is a valid result. These are scan measures, not orders or revenue; separately measure completed actions on the destination. IMPORT INTO YOUR OWN SERVER CODE import { createMizqrClient } from './mizqr-api-example.mjs'; const client = createMizqrClient({ apiBase: process.env.MIZQR_API_BASE, token: process.env.MIZQR_API_TOKEN, }); const qr = await client.create({title: 'Menu campaign', destinationUrl: 'https://example.com/menu'}); await client.update(qr.id, 'https://example.com/new-menu'); const report = await client.analytics(qr.id); Importing the module makes no API call. Running it with no arguments only shows help. Use an explicit create/update command when you intend to change a record. ERROR HANDLING 401: check the key. 402: check plan/allowance. 403: check verification, key scope and workspace permissions. 404: check the QR UUID/workspace. 422: correct the listed field names. 429: respect the reported Retry-After value before retrying. The sample does not automatically retry any request. A lost response may follow a successful create/update: check the workspace before repeating the write, so you do not create duplicate codes. The sample does not implement an idempotency key or promise exactly-once delivery. Avoid concurrent edits to the same code unless your integration defines how those changes should be reconciled. Do not log API tokens or full response bodies. The CLI prints a small summary; its errors expose status and field names rather than private input values. HTTPS is required except for local development on localhost/127.0.0.1/::1. Redirects are rejected; update the API base rather than forwarding credentials. SCOPE AND REUSE This is an integration example, not a complete SDK, batch importer, image export service or monitoring system. You may copy and adapt this sample for your MizQR integrations. That permission applies to this example only, not to the MizQR application or its dependencies. No real customer data or API key is included. Guide: https://mizqr.com/resources/use-the-nexqr-api Reference: https://mizqr.com/api-docs