A comprehensive Python client for the Apple App Store Connect API, providing simple and intuitive interfaces for sales reporting, app metadata management, and advanced analytics.
- π Sales & Financial Reporting - Daily, weekly, monthly sales and revenue data
- π― App Metadata Management - Update app listings, descriptions, and keywords
- π Advanced Analytics - Period comparisons, performance ranking, trend analysis
- π³ Subscription Analytics - Active subscriptions, events, and lifecycle metrics
- π Localization Support - Multi-language content management
- π Batch Operations - Update multiple apps simultaneously
- π Secure Authentication - JWT ES256 token-based auth
- β‘ Smart Rate Limiting - Automatic handling of API limits (50 requests/hour)
- πΌ Pandas Integration - DataFrames for easy data manipulation
- β Type Hints - Full type support for better IDE experience
pip install appstore-connect-client
For development:
pip install appstore-connect-client[dev]
from appstore_connect import AppStoreConnectAPI
from datetime import date, timedelta
# Initialize the client
client = AppStoreConnectAPI(
key_id="your_key_id",
issuer_id="your_issuer_id",
private_key_path="/path/to/AuthKey_XXXXXX.p8",
vendor_number="your_vendor_number"
)
# Get yesterday's sales data
yesterday = date.today() - timedelta(days=1)
sales_df = client.get_sales_report(yesterday)
print(f"Revenue: ${sales_df['proceeds'].sum():,.2f}")
- Apple Developer Account with App Store Connect access
- App Store Connect API Key (generate here)
- Private key file (.p8) downloaded from App Store Connect
- Vendor number from your App Store Connect account
You can provide credentials in three ways:
client = AppStoreConnectAPI(
key_id="your_key_id",
issuer_id="your_issuer_id",
private_key_path="/path/to/private_key.p8",
vendor_number="your_vendor_number"
)
export APP_STORE_KEY_ID="your_key_id"
export APP_STORE_ISSUER_ID="your_issuer_id"
export APP_STORE_PRIVATE_KEY_PATH="/path/to/private_key.p8"
export APP_STORE_VENDOR_NUMBER="your_vendor_number"
import os
client = AppStoreConnectAPI(
key_id=os.getenv('APP_STORE_KEY_ID'),
issuer_id=os.getenv('APP_STORE_ISSUER_ID'),
private_key_path=os.getenv('APP_STORE_PRIVATE_KEY_PATH'),
vendor_number=os.getenv('APP_STORE_VENDOR_NUMBER')
)
Create a .env
file based on .env.example
and the client will load it automatically in development.
# Get comprehensive 30-day analytics
from appstore_connect import create_report_processor
processor = create_report_processor(
key_id=os.getenv('APP_STORE_KEY_ID'),
issuer_id=os.getenv('APP_STORE_ISSUER_ID'),
private_key_path=os.getenv('APP_STORE_PRIVATE_KEY_PATH'),
vendor_number=os.getenv('APP_STORE_VENDOR_NUMBER')
)
summary = processor.get_sales_summary(days=30)
print(f"Total Revenue: ${summary['summary']['total_revenue']:,.2f}")
print(f"Total Units: {summary['summary']['total_units']:,}")
# Compare performance periods
comparison = processor.compare_periods(current_days=30, comparison_days=30)
revenue_change = comparison['changes']['total_revenue']['change_percent']
print(f"Revenue Change: {revenue_change:+.1f}%")
from appstore_connect import create_metadata_manager
manager = create_metadata_manager(
key_id=os.getenv('APP_STORE_KEY_ID'),
issuer_id=os.getenv('APP_STORE_ISSUER_ID'),
private_key_path=os.getenv('APP_STORE_PRIVATE_KEY_PATH'),
vendor_number=os.getenv('APP_STORE_VENDOR_NUMBER')
)
# Update app listing
results = manager.update_app_listing(
app_id='123456789',
updates={
'name': 'My Awesome App',
'subtitle': 'The Best App Ever',
'description': 'This app will change your life...',
'keywords': 'productivity,utility,business'
}
)
# Batch update multiple apps
batch_updates = {
'123456789': {'subtitle': 'Productivity Booster'},
'987654321': {'subtitle': 'Entertainment Hub'}
}
results = manager.batch_update_apps(batch_updates)
# Get sales data and calculate weekly totals
import pandas as pd
# Fetch multiple days efficiently
reports = client.fetch_multiple_days(days=90) # Automatically optimizes API calls
# Calculate weekly revenue
reports['week'] = pd.to_datetime(reports['begin_date']).dt.isocalendar().week
weekly_revenue = reports.groupby('week')['proceeds'].sum()
# Get top performing apps
top_apps = reports.groupby('app_name')['units'].sum().nlargest(10)
See API Documentation for complete reference.
- AppStoreConnectAPI - Main client for direct API access
- ReportProcessor - High-level analytics with advanced reporting
- MetadataManager - Portfolio management with batch operations
from appstore_connect.exceptions import (
AuthenticationError,
RateLimitError,
ValidationError,
PermissionError
)
try:
sales_df = client.get_sales_report(date.today())
except AuthenticationError:
print("Check your API credentials")
except RateLimitError:
print("Rate limit exceeded - wait before retrying")
except PermissionError:
print("Insufficient API key permissions")
except ValidationError as e:
print(f"Invalid input: {e}")
- Reuse client instances - Create once and reuse for multiple requests
- Use smart fetching - Let the client optimize API calls for date ranges
- Handle rate limits - Built-in retry logic, but be mindful of usage
- Leverage DataFrames - Use pandas operations for data analysis
- Secure credentials - Never commit credentials to version control
# Run all tests
pytest
# Run with coverage
pytest --cov=appstore_connect --cov-report=term-missing
# Run specific test file
pytest tests/test_client.py
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Install development dependencies:
pip install -e .[dev]
- Make your changes and add tests
- Run tests:
python -m pytest
- Check formatting:
python -m black --check src/appstore_connect tests
- Format code:
python -m black src/appstore_connect tests
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
See CLAUDE.md for detailed development commands.
- π Getting Started - Setup and basic usage
- π§ API Reference - Complete API documentation
- π Troubleshooting - Common issues and solutions
- π‘ Examples - Comprehensive usage examples
This project is licensed under the MIT License - see the LICENSE file for details.
- π Issues: GitHub Issues
- π Documentation: Read the Docs
- π¬ Discussions: GitHub Discussions
See CHANGELOG.md for version history and changes.
Made with β€οΈ for iOS developers and app analytics teams