Skip to content

blubblub/appstoreconnect-storekitconfig-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

App Store Connect CLI

A Node.js command-line tool for interacting with the App Store Connect API to list apps and in-app purchases.

Features

  • πŸ“± List all apps in your App Store Connect account
  • πŸ’Ž List in-app purchases and subscriptions for specific apps
  • πŸ’° Display en-US prices for all in-app purchases and subscriptions
  • πŸ“ Organize subscriptions by subscription groups
  • πŸ” Secure authentication using JWT tokens
  • βš™οΈ Flexible configuration via CLI arguments or environment variables

Prerequisites

  • Node.js 16.0.0 or higher
  • npm or yarn
  • App Store Connect API key (.p8 file)
  • Issuer ID from App Store Connect

Installation

Clone and Install

git clone <repository-url>
cd appstoreconnect-storekitconfig-node
npm install

Make the CLI globally available

npm link

After linking, you can use the appstore command from anywhere in your terminal.

Configuration

Option 1: Environment Variables (Recommended)

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env and add your credentials:
APPSTORE_API_KEY_PATH=/path/to/your/AuthKey_XXXXXXXXXX.p8
APPSTORE_ISSUER_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Option 2: Command-line Arguments

You can also provide credentials directly via command-line arguments:

  • --api-key <path> - Path to your .p8 API key file
  • --issuer-id <id> - Your Issuer ID from App Store Connect
  • --key-id <id> - Your API Key ID (optional if included in the filename)

Generating App Store Connect API Keys

  1. Log in to App Store Connect
  2. Navigate to Users and Access
  3. Select Keys β†’ App Store Connect API
  4. Click the + button to create a new key
  5. Give your key a name and select appropriate permissions
  6. Download the .p8 file (you can only download it once!)
  7. Note your Issuer ID (displayed at the top of the API Keys page)
  8. Note your Key ID (displayed in the key list)

Important: Store your .p8 file securely. You cannot download it again after the initial creation.

Usage

List All Apps

Using environment variables:

appstore list-apps

Using CLI arguments:

appstore list-apps --api-key /path/to/AuthKey_XXXXXXXXXX.p8 --issuer-id your-issuer-id

List In-App Purchases and Subscriptions

Using environment variables:

appstore list-inapp-purchases --app-id YOUR_APP_ID

Using CLI arguments:

appstore list-inapp-purchases --app-id YOUR_APP_ID --api-key /path/to/key.p8 --issuer-id your-issuer-id

This command will:

  • Fetch all in-app purchases (consumables, non-consumables) with their US prices
  • Fetch all subscription groups and their subscriptions with US prices
  • Display items organized by type (in-app purchases first, then subscriptions grouped by subscription group)

Get Help

appstore --help
appstore list-apps --help
appstore list-inapp-purchases --help

Example Output

List Apps

πŸ“± My Awesome App
   ID: 123456789
   Bundle ID: com.example.myapp
   SKU: MYAPP2024
   Platform: IOS

πŸ“± Another Great App
   ID: 987654321
   Bundle ID: com.example.another
   SKU: ANOTHER2024
   Platform: IOS

List In-App Purchases and Subscriptions

================================================================================
IN-APP PURCHASES AND SUBSCRIPTIONS
================================================================================

Found 2 in-app purchase(s) and 3 subscription(s)

πŸ“¦ IN-APP PURCHASES
--------------------------------------------------------------------------------

πŸ’Ž Remove Ads
   Product ID: com.example.remove_ads
   Type: NON_CONSUMABLE
   State: APPROVED
   Price (US): $4.99

πŸ’Ž 100 Coins Pack
   Product ID: com.example.coins_100
   Type: CONSUMABLE
   State: APPROVED
   Price (US): $0.99


πŸ”„ SUBSCRIPTIONS
--------------------------------------------------------------------------------

πŸ“ Subscription Group: Premium Access

   πŸ”„ Premium Monthly
      Product ID: com.example.premium_monthly
      Period: ONE_MONTH
      State: APPROVED
      Price (US): $9.99

   πŸ”„ Premium Annual
      Product ID: com.example.premium_annual
      Period: ONE_YEAR
      State: APPROVED
      Price (US): $79.99

   πŸ”„ Premium Weekly Trial
      Product ID: com.example.premium_weekly_trial
      Period: ONE_WEEK
      State: READY_TO_SUBMIT
      Price (US): $1.99

================================================================================

Finding Your App ID

To find the App ID needed for the list-inapp-purchases command:

  1. Run appstore list-apps to see all your apps
  2. Copy the ID value from the app you want to query
  3. Use this ID with the --app-id parameter

Alternatively, you can find the App ID in App Store Connect:

  1. Go to My Apps
  2. Select your app
  3. Go to App Information
  4. Look for "Apple ID" or check the URL (it contains the app ID)

Troubleshooting

Authentication Errors

If you get authentication errors:

  • Verify your .p8 file path is correct
  • Ensure your Issuer ID is correct (find it at the top of the API Keys page in App Store Connect)
  • Check that your API key has the necessary permissions
  • Ensure the Key ID is correct (either in the filename like AuthKey_ABC123.p8 or provided via --key-id)

File Not Found

If the CLI cannot find your .p8 file:

  • Use absolute paths instead of relative paths
  • Ensure the file has the correct permissions
  • Check that the file hasn't been moved or deleted

App Not Found

If you get a 404 error when listing in-app purchases:

  • Verify the app ID is correct (use list-apps to double-check)
  • Ensure your API key has permission to access this app
  • Check if the app exists in your App Store Connect account

Rate Limiting

The App Store Connect API has rate limits. If you encounter rate limiting:

  • Wait a few minutes before retrying
  • Reduce the frequency of your requests
  • Consider implementing caching for frequently accessed data

Project Structure

appstoreconnect-storekitconfig-node/
β”œβ”€β”€ appstore.js           # Main CLI entry point
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ auth.js          # JWT authentication module
β”‚   └── api-client.js    # App Store Connect API client
β”œβ”€β”€ .env.example         # Example environment configuration
β”œβ”€β”€ .gitignore          # Git ignore patterns
β”œβ”€β”€ package.json        # Node.js project configuration
└── README.md          # This file

Security Notes

  • Never commit your .p8 file or .env file to version control
  • Keep your API keys secure and rotate them regularly
  • Use environment variables instead of command-line arguments when possible to avoid exposing credentials in shell history
  • Set appropriate file permissions on your .p8 file (e.g., chmod 600)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues related to the CLI tool, please open an issue in the repository.

For App Store Connect API issues, refer to Apple's documentation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published