Storemast

Guide

The App Store Connect API: a practical guide

By the Storemast team · Last updated

TL;DR

The App Store Connect API is Apple's REST (JSON:API) interface at api.appstoreconnect.apple.com for apps, versions, builds, TestFlight, reviews, releases, users and reports. Every request carries a JWT signed with ES256 using your API key's .p8: kid = key ID, iss = issuer ID (team keys), aud = appstoreconnect-v1, and a lifetime of at most 20 minutes. Use a team key with the lowest role that does the job.

Almost everything you click in App Store Connect can also be done with code. The App Store Connect API is how CI pipelines upload and distribute builds, how scripts pull sales reports at night, and how apps like Storemast show review status and release versions from an iPhone. This guide covers what the API can do, how authentication works, the endpoints you'll use most, and how to keep your keys safe, with a small working example.

What the API covers

The API is a REST interface at https://api.appstoreconnect.apple.com, following the JSON:API format. Most of App Store Connect is in it:

AreaWhat you can do
Apps and versionsList apps, create versions, edit localizations (description, keywords, What's New), choose builds, set release options.
Review and releaseCreate review submissions, read version states, release approved versions, manage phased releases.
Builds and TestFlightRead builds and processing states, manage beta groups and testers, test information, expire builds.
Customer reviewsRead reviews and create, replace or delete your response.
Users and accessList users, invite people, change roles.
ProvisioningBundle IDs, certificates, devices and profiles.
ReportsSales and Trends and financial reports, and analytics report requests.
In-app purchases and subscriptionsProducts, prices and their localizations.
Xcode CloudProducts, workflows and build runs.

What it doesn't include matters too. App Review's messages (the replies you get with a rejection) aren't in the API, and a few setup tasks are still easier, or only possible, on the website. Apple adds endpoints every year, so check the documentation before assuming something is missing.

Authentication: API keys and JWTs

The API doesn't use your Apple Account password. You create an API key in App Store Connect (Users and Access › Integrations › App Store Connect API) and use it to sign short-lived tokens. The full walk-through is in how to create an App Store Connect API key.

Team keys vs individual keys

Team keyIndividual key
Belongs toThe teamOne user
PermissionsThe role chosen when it's createdThat user's roles
Created byAccount Holder or AdminThe user, if allowed
Token identifies the team withiss: your issuer IDsub: "user" (no issuer ID)
Good forCI, shared tools, apps like StoremastPersonal scripts

Some areas, such as provisioning and certain reports, have extra restrictions for individual keys. When in doubt, use a team key.

The JWT

Each request sends Authorization: Bearer <token>, where the token is a JSON Web Token signed with your .p8 private key using ES256 (ECDSA with P-256 and SHA-256).

PartFieldValue
HeaderalgES256
HeaderkidYour key ID
HeadertypJWT
PayloadissYour issuer ID (team keys)
PayloadiatIssued-at time, in seconds since 1970
PayloadexpExpiry: no more than 20 minutes after iat
Payloadaudappstoreconnect-v1
PayloadscopeOptional: limit the token to specific requests

Apple rejects tokens that live longer than 20 minutes for most requests. You don't need to cache them for long: sign a new one every 10–15 minutes. A 401 almost always means the token is wrong: the key ID and issuer ID don't belong together, the clock is off, the lifetime is too long, or the .p8 was pasted incompletely.

A first request

This Python snippet signs a token with the PyJWT library (pip install "pyjwt[crypto]"). The IDs are fake: use your own.

import time, jwt  # PyJWT

KEY_ID = "ABC123DEFG"                              # fake
ISSUER_ID = "00000000-0000-0000-0000-000000000000"  # fake
private_key = open("AuthKey_ABC123DEFG.p8").read()

now = int(time.time())
token = jwt.encode(
    {"iss": ISSUER_ID, "iat": now, "exp": now + 15 * 60, "aud": "appstoreconnect-v1"},
    private_key,
    algorithm="ES256",
    headers={"kid": KEY_ID, "typ": "JWT"},
)
print(token)

Save it as make_token.py, then list your apps with curl (-g stops curl treating the square brackets as a pattern):

TOKEN=$(python3 make_token.py)
curl -sg -H "Authorization: Bearer $TOKEN" \
  "https://api.appstoreconnect.apple.com/v1/apps?fields[apps]=name,bundleId&limit=10"

The answer is JSON:API: a data array of objects with id, type and attributes, plus links.next when there are more pages. Use include to pull related resources in one request, fields[type] to ask only for what you need, and filter[…] to narrow lists.

Endpoints you'll use most

TaskRequest
List appsGET /v1/apps
Versions and their statesGET /v1/apps/{id}/appStoreVersions (look at appVersionState)
Edit What's New and other textPATCH /v1/appStoreVersionLocalizations/{id}
BuildsGET /v1/builds?filter[app]={id} (processing state, expiry)
Submit for reviewPOST /v1/reviewSubmissions, add items, then mark it submitted
Release an approved versionPOST /v1/appStoreVersionReleaseRequests
Pause, resume or complete a phased releasePATCH /v1/appStoreVersionPhasedReleases/{id} with phasedReleaseState PAUSED, ACTIVE or COMPLETE
Customer reviewsGET /v1/apps/{id}/customerReviews
Reply to a reviewPOST /v1/customerReviewResponses; DELETE to remove it
TestFlight testers and groups/v1/betaGroups, /v1/betaTesters
Sales and finance reportsGET /v1/salesReports, GET /v1/financeReports (gzip-compressed text)

Version states are upper case with underscores, for example WAITING_FOR_REVIEW, PENDING_DEVELOPER_RELEASE and READY_FOR_DISTRIBUTION. The older appStoreState field is deprecated. Treat unknown values gracefully: Apple adds and renames states. The meaning of each is in every App Store version status explained.

Rate limits and errors

Apple limits how many requests a key can make over a rolling hour, and reports the limit and what's left in the X-Rate-Limit response header. Apple doesn't promise the numbers stay fixed, so read the header rather than hard-coding a value. When you go over, you get 429 Too Many Requests.

StatusUsually means
401Bad token: key ID, issuer ID, .p8, clock or lifetime.
403The token is fine but the key's role can't do this.
404Wrong ID, or the resource isn't visible to this key.
409Conflict: the request doesn't fit the current state (e.g. releasing a version that isn't approved), or invalid attributes.
429Rate limit reached.

Error responses include an errors array with a detail that's usually readable. Log it.

Tools built on the API

Apple has also introduced webhook notifications for some App Store Connect events, which can save you from polling; check Apple's documentation for the events it currently covers.

Keeping API keys safe

How Storemast uses the API

Storemast is an iPhone app built entirely on the App Store Connect API. You add a team key once; the .p8 stays in the iPhone Keychain, ES256 tokens are signed on the phone with a 15-minute lifetime, and requests go straight to api.appstoreconnect.apple.com, with no Storemast server in between. It reads apps, versions, builds and reviews, and makes the release request, phased release update, What's New edit and review reply described above, each after Face ID. Details are on the security page.

Connecting App Store Connect in Storemast: three steps to make a team key, then fields for Issuer ID, Key ID and the pasted .p8 private key
Storemast asks for the issuer ID, key ID and .p8 (sample screen).

Questions

Is the App Store Connect API free?

Yes. It's included with the Apple Developer Program. The Account Holder requests API access for the team once, then the Account Holder and Admins can create keys.

How long can an App Store Connect API token last?

Apple rejects tokens with a lifetime of more than 20 minutes for most requests. Tools generate a fresh token every few minutes; it's cheap to sign one.

What's the difference between team keys and individual keys?

A team key belongs to the team and has the role you pick when you create it; its token includes your issuer ID. An individual key belongs to one user, acts with that user's permissions, and its token uses sub set to user instead of an issuer ID.

What are the App Store Connect API rate limits?

Apple applies per-key request limits over a rolling hour and reports your limit and what's left in the X-Rate-Limit response header. Going over returns 429 Too Many Requests, so back off and retry later.

Can I read App Review rejection messages through the API?

No. The API shows that a version was rejected, but App Review's messages are only available in App Store Connect.

Can the API release an approved version?

Yes. A POST to appStoreVersionReleaseRequests releases a version in Pending Developer Release, and appStoreVersionPhasedReleases lets you pause, resume or complete a phased release. The key needs App Manager or Admin.

Which language or library should I use?

Any that can sign an ES256 JWT and make HTTPS requests. Most teams start with an existing tool such as fastlane or their CI's built-in support, then script specific tasks.