Overview
A Model 2 QR Code in PixQR is a dynamic QR code variant that uses a centralized redirect service to determine the final destination URL at scan time. Unlike static QR codes that encode fixed URLs, Model 2 codes contain a unique identifier that references a database entry containing the actual target. This enables real-time updates to destinations without requiring physical QR code regeneration.
The primary use case for Model 2 QR codes is in marketing campaigns, event management, and logistics where content may change frequently or where detailed analytics are required. Each QR code in this format typically resolves through a PixQR endpoint that performs validation, tracking, and access control before issuing the final redirect.

Why It Matters
For developers and operations teams, Model 2 QR codes offer significant advantages in campaign management and system maintainability. They eliminate the need for physical QR code reprinting when destinations change, reduce operational overhead, and provide granular tracking capabilities. This is particularly important in enterprise environments where compliance, security, and audit trails are critical.
From a performance perspective, the centralized redirect mechanism allows for optimized resource allocation and caching strategies. PixQR's implementation supports load balancing, failover mechanisms, and content delivery network integration that static QR codes cannot provide. Additionally, the dynamic nature enables A/B testing, personalization, and contextual routing based on user data or scan metadata.
How It Works
Model 2 QR codes operate through a three-phase process: encoding, resolution, and redirection. The QR code itself encodes a compact identifier, typically a UUID or Base64-encoded token, which is then used by the PixQR redirect service to retrieve the current destination URL from a backend database.
- The QR code data structure contains a unique token that maps to a specific redirect entry in PixQR's database.
- Upon scanning, the token is passed to the PixQR redirect endpoint (e.g., https://api.pixqr.com/redirect/{token}).
- The system validates the token, checks access permissions, and retrieves the current target URL from storage.
- Analytics data is collected and stored before the final redirect is issued to the user's device.
- The redirect can include additional parameters, such as UTM tracking codes or user context data, that are appended to the target URL.
Quick Reference
| Property | Value | Description |
|---|---|---|
| Encoding Format | UUID or Base64 | Compact identifier for redirect lookup |
| Redirect Endpoint | https://api.pixqr.com/redirect/{token} | Centralized resolution service |
| Storage Type | Database | Backend storage for target URLs |
| Analytics Support | Yes | Scan tracking and reporting |
| Access Control | Configurable | Token validation and permissions |
Basic Example
PixQR Example QR
This QR links directly to this glossary page, so printed notes, onboarding docs, and support material can bring scanners back to the current reference.
This example demonstrates the fundamental structure of a Model 2 QR code configuration. The QR code contains a token that references a target URL stored in the PixQR system.
// Basic Model 2 QR code structure
const model2QR = {
type: 'model2',
token: '550e8400-e29b-41d4-a716-446655440000',
redirectUrl: 'https://api.pixqr.com/redirect/550e8400-e29b-41d4-a716-446655440000',
targetUrl: 'https://example.com/product/123',
createdAt: '2023-06-15T10:00:00Z',
expiresAt: '2023-12-31T23:59:59Z'
};
The token serves as the lookup key in the PixQR database. The redirectUrl points to the PixQR service endpoint that resolves the actual destination. The targetUrl is the final destination stored in the backend.
Production Example
This production-ready implementation includes validation, error handling, and security measures required for enterprise deployment. The system ensures token uniqueness, validates redirect targets, and logs all access attempts.
// Production Model 2 QR code generation
const generateSecureModel2QR = (targetUrl, options = {}) => {
// Validate input
if (!targetUrl || !isValidUrl(targetUrl)) {
throw new Error('Invalid target URL provided');
}
// Generate secure token
const token = crypto.randomUUID();
// Create QR data structure
const qrData = {
type: 'model2',
token: token,
redirectUrl: `https://api.pixqr.com/redirect/${token}`,
targetUrl: targetUrl,
analytics: options.analytics || true,
accessControl: options.accessControl || true,
createdAt: new Date().toISOString(),
expiresAt: options.expiresAt || calculateExpiry(30), // 30 days default
tags: options.tags || []
};
// Store in secure database
storeRedirectEntry(token, qrData);
return qrData;
};
This version includes comprehensive input validation, secure token generation, database storage, and optional analytics and access control features. It is suitable for high-volume production environments requiring reliability and security.
Common Mistakes
- Using predictable or sequential tokens that can be easily guessed or enumerated by attackers.
- Storing sensitive data directly in QR code tokens or redirect entries, violating privacy regulations.
- Not implementing proper access control or validation, allowing unauthorized users to modify redirect targets.
- Ignoring analytics configuration, which reduces the value of the dynamic redirect system for tracking and optimization.
- Reusing tokens or failing to implement token rotation, creating security vulnerabilities and audit trail issues.
Security And Production Notes
- Always use cryptographically secure random number generators for token creation to prevent predictability.
- Implement strict input validation on all redirect targets to prevent open redirect vulnerabilities.
- Ensure all redirect endpoints use HTTPS to prevent man-in-the-middle attacks and data interception.
- Regularly audit token usage and implement automatic token expiration and cleanup mechanisms.
- Design access control policies that restrict token modification to authorized personnel or systems.
Related Concepts
Model 2 QR codes are part of a broader ecosystem of QR code technologies and redirect mechanisms:
- Static QR Codes encode fixed data and are less flexible for dynamic updates, making them unsuitable for Model 2's use cases.
- URL Shorteners provide similar redirection capabilities but lack the enterprise-grade features and security controls of Model 2 systems.
- Link Management Systems often integrate with Model 2 QR codes to provide centralized control over multiple redirect entries.
- Scan Analytics are enhanced by Model 2's tracking capabilities, providing detailed insights into user behavior and campaign performance.
- Content Delivery Networks can be integrated with Model 2 systems to optimize redirect response times and global availability.