Install the Official SDK
@qrgen/sdk is QRGen's official JavaScript client. It supports Node.js 18+, TypeScript, and modern browser runtimes that provide fetch.
npm install https://qrgenapp.com/sdk/qrgen-sdk-0.1.0.tgzThe package is published directly by QRGen. You can also inspect the live package manifest, JavaScript source, and TypeScript declarations before installing.
Generate a QR Code
import { qrgen } from '@qrgen/sdk';
const response = await qrgen.generate({
data: 'https://example.com',
format: 'png',
size: 512,
ec: 'H',
});
const image = await response.arrayBuffer();Typed Methods
| SDK method | Public endpoint | Purpose |
|---|---|---|
generateUrl() | GET /api/qr | Build a directly embeddable QR image URL. |
generate() | POST /api/qr | Generate PNG, SVG, or JSON output. |
generateJson() | POST /api/qr | Return the typed QR module matrix. |
generateBatch() | POST /api/qr/batch | Generate as many as 50 QR codes per request. |
validate() | POST /api/qr/validate | Check scan reliability and receive actionable issues. |
inspect() | POST /api/qr/inspect | Inspect density, version, contrast, and render options. |
createLink() | POST /api/i | Create a short share URL such as /i/102f9j. |
ogImageUrl() | GET /api/og | Build a social preview image URL. |
generateOgImage() | GET /api/og | Fetch the generated social preview image. |
Batch Example
const batch = await qrgen.generateBatch({
items: [
{ data: 'https://example.com/a', format: 'svg' },
{ data: 'https://example.com/b', format: 'svg' },
],
});
console.log(batch.count, batch.results);Validation Example
const report = await qrgen.validate({
data: 'https://example.com',
size: 512,
ec: 'M',
});
if (!report.valid) console.log(report.issues);Package Files and Examples
- Download @qrgen/sdk v0.1.0
- TypeScript API declarations
- Generate URL example
- Batch generation example
- Validation example
Frequently Asked Questions
What is the QRGen JavaScript SDK?
The official @qrgen/sdk package is a typed JavaScript client for the QRGen API. It supports Node.js 18+, TypeScript, and modern browser runtimes with fetch.
How do I generate a QR code with the SDK?
Install the package with npm install https://qrgenapp.com/sdk/qrgen-sdk-0.1.0.tgz, import qrgen from @qrgen/sdk, and call qrgen.generate with your data, format, and size. Read the returned response as an arrayBuffer to save the image.
Can the SDK generate QR codes in batches?
Yes. Call qrgen.generateBatch with an items array to generate up to 50 QR codes per request. The result includes the batch count and individual results.
Using an AI agent?
Connect Claude, Codex, or another compatible client to QRGen's live MCP endpoint and get the focused generate_qr tool.