Overview
The SmartQRCodes Analytics API gives you programmatic access to scan and click analytics for your QR codes and Smart Links. All endpoints are read-only and scoped exclusively to resources owned by the API key holder.
Base URL
https://api.smart-qrcodes.com
Version
v1
Format
JSON
Available on Premium & Enterprise plans
Generate API keys from Dashboard → Settings → API Keys. Each key belongs to your account and can only access your own QR codes and Smart Links.
Authentication
All API requests must include your API key in the x-api-key request header. Never share your key publicly or commit it to source control.
x-api-key: sqr_live_xxxxxxxxxxxxxxxxxxxxxxxxGenerating an API Key
- Go to Dashboard → Settings → API Keys.
- Click Create New Key, give it a name (e.g. "Analytics Integration").
- Copy the key immediately — it will only be shown once.
- Store it securely in your environment variables (e.g.
SQR_API_KEY).
Example — cURL
curl -X GET "https://api.smart-qrcodes.com/api/v1/qrcodes/abc123/analytics" \
-H "x-api-key: sqr_live_xxxxxxxxxxxxxxxxxxxxxxxx"Example — JavaScript (fetch)
const response = await fetch(
'https://api.smart-qrcodes.com/api/v1/qrcodes/abc123/analytics',
{
headers: {
'x-api-key': process.env.SQR_API_KEY,
},
}
);
const { status, data } = await response.json();Example — Python
import requests, os
resp = requests.get(
"https://api.smart-qrcodes.com/api/v1/qrcodes/abc123/analytics",
headers={"x-api-key": os.environ["SQR_API_KEY"]},
)
data = resp.json()QR Code Analytics
/api/v1/qrcodes/:id/analyticsReturns scan analytics for a single QR code identified by its short ID. The response includes total scan counts, period breakdowns (24 h / 7 d / 30 d), device and browser splits, geographic locations, and all-time aggregates.
Path Parameters
Request
curl -X GET "https://api.smart-qrcodes.com/api/v1/qrcodes/xK9mP2/analytics" \
-H "x-api-key: sqr_live_xxxxxxxxxxxxxxxxxxxxxxxx"Response — 200 OK
{
"status": true,
"data": {
"totalScans": 1482,
"last24Hours": {
"totalScans": 34,
"devices": {
"Mobile": 28,
"Desktop": 5,
"Tablet": 1
},
"browsers": {
"Chrome": 20,
"Safari": 10,
"Firefox": 4
},
"locations": {
"India": 18,
"United States": 9,
"United Kingdom": 7
}
},
"lastWeek": {
"totalScans": 210,
"dailyAverage": 30,
"devices": {
"Mobile": 170,
"Desktop": 32,
"Tablet": 8
},
"topLocations": {
"India": 95,
"United States": 55,
"United Kingdom": 28,
"Germany": 18,
"Canada": 14
}
},
"lastMonth": {
"totalScans": 860,
"dailyAverage": 28.67,
"devices": {
"Mobile": 680,
"Desktop": 148,
"Tablet": 32
},
"topLocations": {
"India": 380,
"United States": 210,
"United Kingdom": 130,
"Germany": 80,
"Canada": 60
}
},
"allTime": {
"totalScans": 1482,
"averageDailyScans": 24.7,
"peakDay": "2025-06-15",
"devices": {
"Mobile": 1200,
"Desktop": 230,
"Tablet": 52
},
"browsers": {
"Chrome": 890,
"Safari": 420,
"Firefox": 98,
"Edge": 74
},
"os": {
"Android": 750,
"iOS": 450,
"Windows": 198,
"macOS": 84
}
}
}
}Response Fields
Smart Link Analytics
/api/v1/smartlinks/:id/analyticsReturns click analytics for a single Smart Link identified by its MongoDB document ID. The response includes total click counts, period breakdowns, device / browser / geographic splits, and referrer data.
Path Parameters
Request
curl -X GET "https://api.smart-qrcodes.com/api/v1/smartlinks/6643f2a1c3b2e10012ab4f90/analytics" \
-H "x-api-key: sqr_live_xxxxxxxxxxxxxxxxxxxxxxxx"Response — 200 OK
{
"status": true,
"data": {
"overall": {
"totalClicks": 2340,
"averageClicksPerDay": 31.6,
"peakDay": "2025-06-20"
},
"recent": {
"last24Hours": 48,
"lastWeek": 310,
"lastMonth": 940
},
"devices": {
"Mobile": 1800,
"Desktop": 480,
"Tablet": 60
},
"browsers": {
"Chrome": 1400,
"Safari": 620,
"Firefox": 180,
"Edge": 140
},
"locations": {
"India": 1100,
"United States": 560,
"United Kingdom": 320,
"Germany": 200,
"Canada": 160
}
}
}Response Fields
Errors
All errors return a JSON body with status: false and a human-readable msg field.
{
"status": false,
"msg": "Human-readable error message"
}| Status | Meaning | Common Cause |
|---|---|---|
| 200 | OK | Request succeeded. |
| 401 | Unauthorized | Missing, invalid, or revoked x-api-key header. |
| 403 | Forbidden | Your API key does not own this resource, or your plan does not include API access. |
| 404 | Not Found | No QR code or Smart Link matches the provided ID. |
| 429 | Too Many Requests | You have exceeded the rate limit. See Rate Limits. |
| 500 | Internal Server Error | Unexpected server error. Contact support if this persists. |
Rate Limits
API requests are rate-limited per API key to protect platform stability. Exceeding the limit returns a 429 Too Many Requests response.
Premium
100 requests / 15 min per key
Enterprise
500 requests / 15 min per key
Handling 429 responses
When you receive a 429, wait before retrying. Use exponential back-off (e.g. wait 1s, then 2s, then 4s). If you need higher limits, consider upgrading to Enterprise or contact support@smart-qrcodes.com.
Retry Example — JavaScript
async function fetchWithRetry(url, options, retries = 3) {
for (let i = 0; i < retries; i++) {
const res = await fetch(url, options);
if (res.status !== 429) return res;
const delay = Math.pow(2, i) * 1000; // 1s, 2s, 4s
await new Promise((r) => setTimeout(r, delay));
}
throw new Error('Rate limit exceeded after retries');
}