GET
https://jmpy.me/api/v1
/
qranalytics
/
top-qr-codes
Top Performing QR Codes
curl --request GET \
  --url https://jmpy.me/api/v1/qranalytics/top-qr-codes \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "id": "<string>",
      "name": "<string>",
      "contentType": "<string>",
      "totalScans": 123,
      "recentScans": 123,
      "uniqueScanners": 123,
      "lastScannedAt": "<string>",
      "createdAt": "<string>"
    }
  ]
}
Get a list of your top performing QR codes ranked by scan count. This endpoint helps identify which QR codes drive the most engagement.

Query Parameters

limit
integer
default:10
Number of QR codes to return (max 100).
days
integer
default:30
Number of days to include in recent scan calculations (1-365).

Response

data
array
Array of top performing QR codes.

Request Examples

# Get top 10 QR codes by scans
curl -X GET "https://jmpy.me/api/v1/qranalytics/top-qr-codes?limit=10&days=30" \
  -H "Authorization: Bearer YOUR_API_KEY"

# Get top 25 QR codes for last 90 days
curl -X GET "https://jmpy.me/api/v1/qranalytics/top-qr-codes?limit=25&days=90" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Examples

{
  "success": true,
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Product Launch Campaign",
      "contentType": "url",
      "totalScans": 4523,
      "recentScans": 1234,
      "uniqueScanners": 980,
      "lastScannedAt": "2025-01-07T15:30:00Z",
      "createdAt": "2024-06-15T10:00:00Z"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "name": "Store Front Display",
      "contentType": "url",
      "totalScans": 3256,
      "recentScans": 987,
      "uniqueScanners": 756,
      "lastScannedAt": "2025-01-07T14:22:00Z",
      "createdAt": "2024-08-20T09:30:00Z"
    },
    {
      "id": "770e8400-e29b-41d4-a716-446655440002",
      "name": "Business Card",
      "contentType": "vcard",
      "totalScans": 2145,
      "recentScans": 456,
      "uniqueScanners": 389,
      "lastScannedAt": "2025-01-07T12:15:00Z",
      "createdAt": "2024-03-10T14:45:00Z"
    }
  ]
}

Use Cases

Display top performing QR codes in a dashboard leaderboard.
async function getLeaderboard() {
  const response = await fetch(
    'https://jmpy.me/api/v1/qranalytics/top-qr-codes?limit=5&days=30',
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );
  const { data } = await response.json();
  
  // Format for leaderboard display
  return data.map((qr, index) => ({
    rank: index + 1,
    name: qr.name,
    scans: qr.recentScans,
    trend: qr.recentScans > (qr.totalScans * 0.3) ? 'hot' : 'normal',
    lastActive: new Date(qr.lastScannedAt).toLocaleDateString()
  }));
}
Find QR codes that were once popular but have declined in engagement.
import requests
from datetime import datetime

def find_declining_qr_codes():
    response = requests.get(
        'https://jmpy.me/api/v1/qranalytics/top-qr-codes?limit=50&days=30',
        headers={'Authorization': 'Bearer YOUR_API_KEY'}
    )
    
    qr_codes = response.json()['data']
    
    declining = []
    for qr in qr_codes:
        # If recent activity is less than 10% of total, it's declining
        if qr['totalScans'] > 100:
            activity_ratio = qr['recentScans'] / qr['totalScans']
            if activity_ratio < 0.1:
                declining.append({
                    'name': qr['name'],
                    'total': qr['totalScans'],
                    'recent': qr['recentScans'],
                    'ratio': f"{activity_ratio*100:.1f}%"
                })
    
    print("Declining QR Codes (need refreshing):")
    for qr in declining:
        print(f"  {qr['name']}: {qr['recent']}/{qr['total']} ({qr['ratio']} recent)")
    
    return declining
Analyze which types of QR codes perform best.
interface ContentTypeStats {
  type: string;
  count: number;
  totalScans: number;
  avgScans: number;
}

async function analyzeContentTypes(): Promise<ContentTypeStats[]> {
  const response = await fetch(
    'https://jmpy.me/api/v1/qranalytics/top-qr-codes?limit=100&days=30',
    { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
  );
  const { data } = await response.json();
  
  // Group by content type
  const byType: Record<string, { scans: number; count: number }> = {};
  
  data.forEach(qr => {
    if (!byType[qr.contentType]) {
      byType[qr.contentType] = { scans: 0, count: 0 };
    }
    byType[qr.contentType].scans += qr.recentScans;
    byType[qr.contentType].count++;
  });
  
  // Calculate averages and format
  return Object.entries(byType).map(([type, stats]) => ({
    type,
    count: stats.count,
    totalScans: stats.scans,
    avgScans: Math.round(stats.scans / stats.count)
  })).sort((a, b) => b.avgScans - a.avgScans);
}