Skip to content

Quickstart

Quickstart

Create your first QR code in less than 5 minutes.

Prerequisites

1. Create your first QR code

Terminal window
npm install @qr3/sdk
import { QR3 } from "@qr3/sdk";
const client = new QR3({ apiKey: "qr3_sk_your_key" });
const code = await client.codes.create({
type: "url",
url: "https://example.com",
title: "My first QR code",
is_dynamic: true,
});
console.log(code.data.short_code); // "r7f3Kx"
console.log(code.data.image_svg_url); // SVG URL

2. Download the QR code image

// SVG (vector, ideal for print)
const svg = await fetch(code.data.image_svg_url).then(r => r.text());
// PNG (raster, 512×512px by default)
const pngBuffer = await fetch(code.data.image_png_url).then(r => r.arrayBuffer());
// PDF (vector PDF for print: black modules by default; with ?fg=/?bg= the
// colors are written as grayscale or CMYK, no ICC profile, not PDF/X)
const pdf = await fetch(
`https://qr3.app/v1/codes/${code.data.short_code}/qr.pdf`
).then(r => r.arrayBuffer());

3. Scan analytics

const scans = await client.scans.list(code.data.id, { days: 30 });
console.log(scans.data.total_scans); // 142
console.log(scans.data.unique_visitors); // 118
console.log(scans.data.top_countries[0]); // { value: "AT", count: 45 }

Next steps