Access and download comprehensive analytics, sales, and financial reports for your apps.
Overview
The CLI provides access to:
- Sales Reports: Daily, weekly, and monthly sales data
- Analytics Reports: App usage, crashes, and performance metrics
- Financial Reports: Revenue and payment information
- Custom Analytics: Request specific metrics and segments
Sales Reports
Sales reports provide transaction-level data for your apps.
Download Daily Sales Report
asc analytics sales \
--vendor "YOUR_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency DAILY \
--date "2024-01-20"
Download Weekly Sales Report
asc analytics sales \
--vendor "YOUR_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency WEEKLY \
--date "2024-01-20"
Download Monthly Sales Report
asc analytics sales \
--vendor "YOUR_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency MONTHLY \
--date "2024-01-01"
Sales Report Types
- SALES: Standard sales transactions
- PRE_ORDER: Pre-order transactions
- NEWSSTAND: Newsstand sales (if applicable)
- SUBSCRIPTION: Subscription events
- SUBSCRIPTION_EVENT: Detailed subscription lifecycle events
Sales Report Subtypes
- SUMMARY: Aggregated sales summary
- DETAILED: Transaction-level details
- OPT_IN: Reports for apps with opted-in features
The vendor number is found in App Store Connect under Sales and Trends > Reports. Set it as ASC_VENDOR_NUMBER environment variable to avoid repeating it.
Analytics Reports
Request custom analytics reports for detailed app metrics.
Create Analytics Request
Request analytics report
Create a request for ongoing analytics access:asc analytics request \
--app "YOUR_APP_ID" \
--access-type ONGOING
For one-time reports:asc analytics request \
--app "YOUR_APP_ID" \
--access-type ONE_TIME_SNAPSHOT
List analytics requests
View all analytics requests for your app:asc analytics requests --app "YOUR_APP_ID"
Check request status
Get detailed status of a request:asc analytics get --request-id "REQUEST_ID"
List available report instances
Once the request is processed, list available report instances:asc analytics instances list --request-id "REQUEST_ID"
Download Analytics Data
Download the actual report data:
asc analytics download \
--request-id "REQUEST_ID" \
--instance-id "INSTANCE_ID" \
--output "./analytics-report.csv"
Analytics Report Segments
Segment analytics by various dimensions:
asc analytics segments \
--request-id "REQUEST_ID" \
--output json
Common segments include:
- App version
- Device type
- Platform version
- Territory
- Source type
Financial Reports
Access payment and financial information:
Download Financial Report
asc analytics sales \
--vendor "YOUR_VENDOR_NUMBER" \
--type FINANCIAL \
--frequency MONTHLY \
--date "2024-01-01"
Report Regions
Financial reports are organized by region:
asc analytics sales \
--vendor "YOUR_VENDOR_NUMBER" \
--type FINANCIAL \
--frequency MONTHLY \
--date "2024-01-01" \
--region-code "US"
Common region codes:
US - United States
EU - European Union
JP - Japan
AU - Australia
CN - China
Complete Reporting Workflow
Here’s a complete workflow for downloading reports:
#!/bin/bash
set -e
# Configuration
export ASC_VENDOR_NUMBER="YOUR_VENDOR_NUMBER"
export ASC_APP_ID="YOUR_APP_ID"
REPORT_DIR="./reports/$(date +%Y-%m-%d)"
mkdir -p "$REPORT_DIR"
# 1. Download daily sales report
echo "Downloading daily sales report..."
asc analytics sales \
--vendor "$ASC_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency DAILY \
--date "$(date -v-1d +%Y-%m-%d)" \
--output "$REPORT_DIR/daily-sales.txt"
# 2. Download weekly sales report (if Monday)
if [ $(date +%u) -eq 1 ]; then
echo "Downloading weekly sales report..."
asc analytics sales \
--vendor "$ASC_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency WEEKLY \
--date "$(date -v-7d +%Y-%m-%d)" \
--output "$REPORT_DIR/weekly-sales.txt"
fi
# 3. Request analytics if not already requested
echo "Checking for analytics request..."
REQUESTS=$(asc analytics requests --app "$ASC_APP_ID" --output json)
if [ "$(echo $REQUESTS | jq '.data | length')" -eq 0 ]; then
echo "Creating analytics request..."
asc analytics request --app "$ASC_APP_ID" --access-type ONGOING
fi
# 4. Download available analytics instances
REQUEST_ID=$(echo $REQUESTS | jq -r '.data[0].id')
if [ -n "$REQUEST_ID" ]; then
echo "Downloading analytics instances..."
INSTANCES=$(asc analytics instances list --request-id "$REQUEST_ID" --output json)
echo $INSTANCES | jq -r '.data[] | .id' | while read INSTANCE_ID; do
echo "Downloading instance $INSTANCE_ID..."
asc analytics download \
--request-id "$REQUEST_ID" \
--instance-id "$INSTANCE_ID" \
--output "$REPORT_DIR/analytics-$INSTANCE_ID.csv"
done
fi
echo "Reports downloaded to $REPORT_DIR"
Automated Daily Reports (CI/CD)
GitHub Actions Example
name: Daily Reports
on:
schedule:
- cron: '0 9 * * *' # 9 AM UTC daily
workflow_dispatch:
jobs:
download_reports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install asc CLI
run: |
curl -fsSL https://raw.githubusercontent.com/rudrankriyam/App-Store-Connect-CLI/main/install.sh | bash
- name: Configure credentials
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
ASC_VENDOR_NUMBER: ${{ secrets.ASC_VENDOR_NUMBER }}
run: |
echo "Credentials configured"
- name: Download daily sales report
run: |
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
asc analytics sales \
--vendor "$ASC_VENDOR_NUMBER" \
--type SALES \
--subtype SUMMARY \
--frequency DAILY \
--date "$YESTERDAY" \
--output "./sales-$YESTERDAY.txt"
- name: Upload reports as artifact
uses: actions/upload-artifact@v3
with:
name: sales-reports
path: ./sales-*.txt
retention-days: 30
- name: Send to analytics platform (optional)
run: |
# Parse and send to your analytics/BI platform
# Example: curl -X POST https://your-analytics.com/api/ingest -d @sales-*.txt
Report Data Processing
Parse Sales Report
Sales reports are typically tab-delimited:
# Extract download counts
grep "^[0-9]" sales-report.txt | cut -f7 | awk '{sum+=$1} END {print sum}'
# Extract revenue by app
grep "^[0-9]" sales-report.txt | awk -F'\t' '{revenue[$3]+=$14} END {for(app in revenue) print app, revenue[app]}'
# Extract top countries by downloads
grep "^[0-9]" sales-report.txt | awk -F'\t' '{country[$13]+=$7} END {for(c in country) print country[c], c}' | sort -rn | head -10
Convert to JSON
#!/usr/bin/env python3
import csv
import json
import sys
with open(sys.argv[1], 'r') as tsv_file:
reader = csv.DictReader(tsv_file, delimiter='\t')
rows = list(reader)
with open('sales-report.json', 'w') as json_file:
json.dump(rows, json_file, indent=2)
print(f"Converted {len(rows)} rows to JSON")
Run with:
python convert_sales.py sales-report.txt
Troubleshooting
”Vendor number not found”
Problem: Invalid or missing vendor number.
Solution: Find your vendor number in App Store Connect:
- Go to Sales and Trends
- Click Reports
- Your vendor number is displayed at the top
Set it as an environment variable:
export ASC_VENDOR_NUMBER="YOUR_VENDOR_NUMBER"
“Report not available for date”
Problem: Report for the requested date doesn’t exist yet.
Solution:
- Daily reports are available ~24 hours after the date
- Weekly reports are available on Sundays for the previous week
- Monthly reports are available ~14 days after month end
”Analytics request pending”
Problem: Analytics request is still processing.
Solution: Check request status:
asc analytics get --request-id "REQUEST_ID"
Wait for the state to change to COMPLETED before downloading instances.
”Failed to download report”
Problem: Network issues or API errors during download.
Solution: Retry with increased timeout:
export ASC_TIMEOUT=180s
asc analytics sales --vendor "..." --date "..." --output report.txt
Best Practices
-
Automate daily downloads: Set up scheduled jobs to download reports automatically
-
Store reports securely: Reports contain sensitive financial data—encrypt and restrict access
-
Parse and analyze: Don’t just download—parse reports and feed into analytics platforms
-
Set up monitoring: Alert on anomalies like sudden drop in downloads or revenue
-
Use environment variables: Store vendor number and other config in environment variables
-
Handle missing reports gracefully: Not all reports are available for all dates
-
Archive historical data: Keep long-term archives for trend analysis
-
Validate data: Cross-check totals with App Store Connect web interface