Skip to content
CoreMacs
CI/CDGuide

Uploading builds to App Store Connect from CI with API keys, not Apple IDs

Build servers cannot answer two-factor prompts, so App Store Connect API keys can replace Apple ID logins in CI. This guide covers key basics, Apple's upload tools, the altool question and key safety.

CoreMacs News Desk·Published ·Last verified ·5 min read
A Mac mini on a wooden desk beside a display showing a colorful macOS desktop with dock, keyboard and mouse.

A build server has no screen and no phone, so a pipeline that signs in with an Apple ID can stall at a two-factor prompt. Apple's route for automation is the App Store Connect API key. This guide covers key basics, upload routes and safe key handling.

Why Apple IDs break CI

An Apple ID, now called an Apple Account, belongs to a person. Apple's two-factor authentication page says signing in on a new device or the web can require a six-digit code from a trusted device or phone number, which an unattended job cannot supply. Apple's altool help says two-factor accounts must use an app-specific password, which still belongs to one person. API keys avoid both problems.

Keys come in two kinds. A team key has access to all apps, at levels set by its role; an individual key carries its user's access and roles and, Apple says, cannot use the provisioning endpoints, Sales and Finance, or notarytool. Apple's App Store Connect API help page says generating team keys requires the Account Holder or Admin role, once the Account Holder has requested API access. For shared CI, a team key avoids tying releases to one person.

The three values you handle

Apple describes a key as a public portion it keeps plus a private key you download to sign JSON Web Tokens (JWTs). A team key involves three values:

  • Issuer ID: identifies your team. Apple's token guide says it appears near the top of the Integrations tab under Users and Access; individual keys do not use it.
  • Key ID: identifies one key and goes in the token header.
  • Private key: the secret that signs tokens; whoever holds it can act with the key's role. Apple's key documentation says it can be downloaded only once and that Apple keeps no copy, so store it right away.

Roles and access

A key's role decides what it can reach and do. Apple notes that keys with the Admin role have broad permissions, such as creating and deleting users, and that team keys apply across all apps, so app access cannot be limited per key. Give each pipeline its own key with the smallest role that lets it upload builds, not Admin, and check the current role list when you create it.

The supported ways to upload

Apple's help page on uploading builds lists Xcode, Swift Playground, altool and Transporter. It adds that API users can upload with the Transporter command-line tool using the same JWTs, or through the API itself.

xcodebuild with an export options file

After xcodebuild archive, a pipeline can run -exportArchive with the key passed as flags. Apple's Xcode 13 release notes introduced the key flags shown below to enable automatic signing in headless environments such as build machines and continuous integration; the xcodebuild man page says xcodebuild then authenticates with the Apple Developer website.

xcodebuild -exportArchive \
  -archivePath build/App.xcarchive \
  -exportOptionsPlist ExportOptions.plist \
  -authenticationKeyPath "$KEY_PATH" \
  -authenticationKeyID "$KEY_ID" \
  -authenticationKeyIssuerID "$ISSUER_ID"

The man page says the product can be uploaded to Apple or exported locally; in the export options that xcodebuild -help prints, the destination key takes export or upload. Test this on the exact Xcode version your runners use before you build a pipeline around it.

Transporter and its command line

Apple's page calls Transporter a macOS app. In a developer forum thread, one developer reports that the Transporter command-line tool rejected an IPA with error ITMS-90529 that the app accepted; another saw the same error with Transporter on Linux. Apple's reply asks a diagnostic question and no solution is marked, so test the tool with your own build first.

The App Store Connect API

For a direct upload, Apple's page links to the Create a Build Upload endpoint, POST /v1/buildUploads, and your pipeline makes the API calls itself. Check the current buildUploads endpoint reference for the exact flow.

What about altool?

Apple's altool has already lost one job: notarization moved to notarytool. In the same forum thread, a DTS engineer wrote in January 2024 that altool is deprecated only for notarization and remains recommended for other purposes. That is one staff comment, not a roadmap; a 2025 reply asking whether it still holds has no Apple answer. Apple's altool help, whose revision history ends in April 2022, marks --upload-app as deprecated in favor of --upload-package, though the upload page's example still uses --upload-app. The help also documents --apiKey and --apiIssuer in place of a username and password. The upload page still says altool can validate and upload a binary, but makes no commitment about how long that will last; check the release notes of the Xcode version you run.

Key hygiene

  • Storage: keep the private key in the CI secret store, write it to a temporary file only for the step that needs it, and keep it out of logs. Apple warns against storing keys in a code repository.
  • Rotation: create a new key, update the secret, confirm an upload, then revoke the old one. Apple says revoked keys cannot be reinstated and a key's access level cannot be edited after creation.
  • Revocation: Apple advises revoking a key immediately if it is lost or compromised.
  • Short-lived tokens: if your pipeline signs its own JWTs, create them at job time. Apple's token guide says App Store Connect rejects tokens with a lifetime over 20 minutes for most requests.

A short checklist

  1. Create a team key with the lowest workable role and put its three values in the CI secret store at once.
  2. Test one upload route on a throwaway build.
  3. Record the Xcode version you tested and re-test after upgrades.

Sources

Share