Skip to main content
POST
/
analytics
/
export
/
curl --request POST \
--url https://management.scanova.io/analytics/export/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form q=Qf94b25d768294148
This response does not have an example.

Description

This endpoint allows you to export comprehensive analytics data for one or more QR codes over a specific date range.
The export includes scan details, device and OS data, and geographic insights โ€” formatted for spreadsheet analysis.
You can choose between:
  • .csv for lightweight integration or scripting use
  • .xls**/ ** .xlsx for advanced Excel-based reportingPurpose

Query Parameters

ParameterTypeRequiredDescription
fromstring (YYYY-MM-DD)โœ… YesStart date for analytics data (inclusive).
tostring (YYYY-MM-DD)โœ… YesEnd date for analytics data (inclusive). Defaults to current date.
file_formatstringโœ… YesDesired export format โ€” must be one of: xls, xlsx, csv.

Request Body

FieldTypeRequiredDescription
qarrayโœ… YesArray of QR Code IDs or tags for which analytics will be exported.

Examples

Export Single QR Code (Excel)

curl -X POST "https://management.scanova.io/analytics/export/?from=2025-02-01&to=2025-02-25&file_format=xlsx" \
  -H "Authorization: YOUR_API_KEY" \
  -F "q=Qf94b25d768294148"

Export Multiple QR Codes (CSV)

curl -X POST "https://management.scanova.io/analytics/export/?from=2025-02-01&to=2025-02-25&file_format=csv" \
  -H "Authorization: YOUR_API_KEY" \
  -F "q=Qf94b25d768294148" \
  -F "q=Qf94b25d768294149" \
  -F "q=Qf94b25d768294150"

Export with Date Range

curl -X POST "https://management.scanova.io/analytics/export/?from=2025-01-01&to=2025-01-31&file_format=xlsx" \
  -H "Authorization: YOUR_API_KEY" \
  -F "q=Qf94b25d768294148"

Response

Success Response (200 OK)

The response returns a file download with the analytics data in the requested format.

Excel File (.xlsx/.xls)

  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx) or application/vnd.ms-excel (xls)
  • Content: Multi-sheet Excel file with comprehensive analytics data
  • Sheets: Multiple sheets with different analytics views

CSV File (.csv)

  • Content-Type: text/csv
  • Content: Comma-separated values with analytics data
  • Structure: Single file with all analytics data
The export endpoint returns a file download. Make sure your application can handle binary file responses and provide appropriate download functionality to users.
Excel files (.xlsx/.xls) provide the most comprehensive data structure with multiple sheets, while CSV files are better for simple data analysis and integration with other tools.
Large date ranges or many QR codes may result in large file sizes. Consider breaking down exports into smaller chunks if needed.

Integration Examples

JavaScript - Export Analytics

async function exportAnalytics(qrCodes, fromDate, toDate, format = 'xlsx') {
  try {
    const formData = new FormData();
    
    // Add QR code IDs
    qrCodes.forEach(qrId => {
      formData.append('q', qrId);
    });
    
    const response = await fetch(
      `https://management.scanova.io/analytics/export/?from=${fromDate}&to=${toDate}&file_format=${format}`,
      {
        method: 'POST',
        headers: {
          'Authorization': 'YOUR_API_KEY'
        },
        body: formData
      }
    );
    
    if (response.ok) {
      // Get the file blob
      const blob = await response.blob();
      
      // Create download link
      const url = window.URL.createObjectURL(blob);
      const a = document.createElement('a');
      a.href = url;
      a.download = `analytics_${fromDate}_to_${toDate}.${format}`;
      document.body.appendChild(a);
      a.click();
      window.URL.revokeObjectURL(url);
      document.body.removeChild(a);
      
      console.log('Analytics exported successfully');
      return true;
    } else {
      throw new Error('Failed to export analytics');
    }
  } catch (error) {
    console.error('Error exporting analytics:', error);
    return false;
  }
}

// Usage
const qrCodes = ['Qf94b25d768294148', 'Qf94b25d768294149'];
exportAnalytics(qrCodes, '2025-02-01', '2025-02-25', 'xlsx');

Python - Export Analytics

import requests
from datetime import datetime, timedelta

def export_analytics(qr_codes, from_date, to_date, file_format='xlsx'):
    url = "https://management.scanova.io/analytics/export/"
    headers = {"Authorization": "YOUR_API_KEY"}
    
    # Prepare form data
    data = {}
    for i, qr_id in enumerate(qr_codes):
        data[f'q[{i}]'] = qr_id
    
    # Prepare query parameters
    params = {
        'from': from_date,
        'to': to_date,
        'file_format': file_format
    }
    
    try:
        response = requests.post(url, headers=headers, data=data, params=params)
        response.raise_for_status()
        
        # Save the file
        filename = f"analytics_{from_date}_to_{to_date}.{file_format}"
        with open(filename, 'wb') as f:
            f.write(response.content)
        
        print(f"Analytics exported successfully to {filename}")
        return filename
        
    except requests.exceptions.RequestException as e:
        print(f"Error exporting analytics: {e}")
        return None

def export_monthly_analytics(qr_codes, year, month):
    """Export analytics for a specific month"""
    from_date = f"{year}-{month:02d}-01"
    
    # Calculate last day of month
    if month == 12:
        next_month = datetime(year + 1, 1, 1)
    else:
        next_month = datetime(year, month + 1, 1)
    
    to_date = (next_month - timedelta(days=1)).strftime('%Y-%m-%d')
    
    return export_analytics(qr_codes, from_date, to_date, 'xlsx')

# Usage
qr_codes = ['Qf94b25d768294148', 'Qf94b25d768294149']
export_analytics(qr_codes, '2025-02-01', '2025-02-25', 'xlsx')

# Export monthly data
export_monthly_analytics(qr_codes, 2025, 2)

PHP - Export Analytics

<?php
function exportAnalytics($qrCodes, $fromDate, $toDate, $fileFormat = 'xlsx') {
    $url = "https://management.scanova.io/analytics/export/";
    $headers = [
        "Authorization: YOUR_API_KEY"
    ];
    
    // Prepare form data
    $data = [];
    foreach ($qrCodes as $qrId) {
        $data[] = ['name' => 'q', 'contents' => $qrId];
    }
    
    // Prepare query parameters
    $params = http_build_query([
        'from' => $fromDate,
        'to' => $toDate,
        'file_format' => $fileFormat
    ]);
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url . '?' . $params);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    if ($httpCode === 200) {
        $filename = "analytics_{$fromDate}_to_{$toDate}.{$fileFormat}";
        file_put_contents($filename, $response);
        echo "Analytics exported successfully to {$filename}";
        return $filename;
    } else {
        echo "Error exporting analytics: " . $response;
        return null;
    }
}

// Usage
$qrCodes = ['Qf94b25d768294148', 'Qf94b25d768294149'];
$filename = exportAnalytics($qrCodes, '2025-02-01', '2025-02-25', 'xlsx');
?>

Notes

  • โœ… Supports bulk analytics export for multiple QR codes at once.
  • โš™๏ธ Recommended file format:
    • .xlsx for visualization/reporting
    • .csv for integration or automation pipelines
  • ๐Ÿ“… Data range can span multiple months, depending on account plan limits.
  • โฑ๏ธ Large exports may take a few seconds to generate โ€” consider background processing for high-volume requests.

Example Use Cases

  • ๐Ÿ“Š Generate weekly or monthly QR scan reports
  • ๐Ÿงพ Export data for BI tools such as Power BI or Tableau
  • ๐Ÿ“ˆ Analyze trends by device, OS, or location in Excel
  • ๐Ÿ” Audit campaign performance across multiple QR codes

Authorizations

Authorization
string
header
required

API key authentication. Enter your API key directly in the Authorization header.

Query Parameters

from
string<date>
required

Start date for analytics data (inclusive). Format: YYYY-MM-DD

to
string<date>
required

End date for analytics data (inclusive). Format: YYYY-MM-DD. Defaults to current date.

file_format
enum<string>
required

Export file format

Available options:
xls,
xlsx,
csv

Body

multipart/form-data
q
string[]
required

Array of QR code IDs or tags to include in the export

Example:
["Qf94b25d768294148"]

Response

Analytics data exported successfully

The response is of type file.