Analytics API

Access detailed scan analytics for your QR codes programmatically.

Endpoints

Method Endpoint Description
GET /v1/qrcodes/:id/analytics Get analytics summary
GET /v1/qrcodes/:id/analytics/scans Get individual scans
GET /v1/qrcodes/:id/analytics/timeseries Get scans over time

Analytics Summary

GET /v1/qrcodes/:id/analytics

Query Parameters

Parameter Type Description
start_date string ISO 8601 date (e.g., 2026-01-01)
end_date string ISO 8601 date (e.g., 2026-01-31)

Response

{
  "qr_id": "qr_abc123xyz",
  "period": {
    "start": "2026-01-01T00:00:00Z",
    "end": "2026-01-31T23:59:59Z"
  },
  "summary": {
    "total_scans": 1234,
    "unique_visitors": 987,
    "avg_daily_scans": 39.8
  },
  "top_countries": [
    { "country": "US", "scans": 456 },
    { "country": "GB", "scans": 234 },
    { "country": "CA", "scans": 123 }
  ],
  "top_cities": [
    { "city": "New York", "country": "US", "scans": 89 },
    { "city": "London", "country": "GB", "scans": 76 },
    { "city": "Los Angeles", "country": "US", "scans": 65 }
  ],
  "devices": {
    "ios": 534,
    "android": 412,
    "desktop": 288
  },
  "browsers": {
    "safari": 534,
    "chrome": 456,
    "samsung_browser": 123,
    "other": 121
  }
}

Individual Scans

GET /v1/qrcodes/:id/analytics/scans

Returns a paginated list of individual scan events.

Query Parameters

Parameter Type Description
start_date string ISO 8601 date
end_date string ISO 8601 date
page integer Page number (default: 1)
limit integer Results per page (default: 50, max: 500)

Response

{
  "data": [
    {
      "id": "scan_xyz789",
      "timestamp": "2026-01-15T14:32:18Z",
      "country": "US",
      "region": "California",
      "city": "San Francisco",
      "device": "ios",
      "browser": "safari",
      "is_unique": true
    },
    {
      "id": "scan_xyz790",
      "timestamp": "2026-01-15T14:35:42Z",
      "country": "US",
      "region": "New York",
      "city": "New York",
      "device": "android",
      "browser": "chrome",
      "is_unique": true
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 1234,
    "total_pages": 25
  }
}

Time Series Data

GET /v1/qrcodes/:id/analytics/timeseries

Returns scan counts grouped by time interval.

Query Parameters

Parameter Type Description
start_date string ISO 8601 date
end_date string ISO 8601 date
interval string hour, day, week, month (default: day)

Response

{
  "qr_id": "qr_abc123xyz",
  "interval": "day",
  "data": [
    {
      "date": "2026-01-01",
      "total_scans": 45,
      "unique_visitors": 38
    },
    {
      "date": "2026-01-02",
      "total_scans": 52,
      "unique_visitors": 41
    },
    {
      "date": "2026-01-03",
      "total_scans": 38,
      "unique_visitors": 32
    }
  ]
}

Export Analytics

GET /v1/qrcodes/:id/analytics/export

Download analytics data as CSV or JSON file.

Query Parameters

Parameter Type Description
format string csv or json (default: csv)
start_date string ISO 8601 date
end_date string ISO 8601 date

Example

curl "https://api.qrcodepro.io/v1/qrcodes/qr_abc123/analytics/export?format=csv&start_date=2026-01-01&end_date=2026-01-31" \
  -H "Authorization: Bearer qrcp_live_xxx" \
  -o analytics.csv

Real-Time Webhooks

For real-time scan notifications, configure webhooks in your account settings.

When a scan occurs, we will POST to your webhook URL:

{
  "event": "scan.created",
  "timestamp": "2026-01-15T14:32:18Z",
  "data": {
    "qr_id": "qr_abc123xyz",
    "scan_id": "scan_xyz789",
    "country": "US",
    "city": "San Francisco",
    "device": "ios",
    "is_unique": true
  }
}

Privacy Note

Analytics data does not include personally identifiable information (PII). IP addresses are hashed and never stored raw. Location data is approximate (city-level accuracy).