Create a new App Store Connect Team API Key with Admin permissions, download the one-time .p8 private key, and store it in ~/.blitz. Use when the user needs a new ASC API key for CLI auth, CI/CD, or external tooling.
Use this skill to create a new App Store Connect API Key with Admin permissions via Apple's iris API, download the one-time .p8 private key, and save it to ~/.blitz.
asc auth login, CI/CD pipelines, or external tooling~/.blitz/asc-agent/web-session.json. If no session exists or it has expired (401), call the asc_web_auth MCP tool first — this opens the Apple ID login window in Blitz and captures the session automatically.Before anything else, check if a web session file already exists:
test -f ~/.blitz/asc-agent/web-session.json && echo "SESSION_EXISTS" || echo "NO_SESSION"
NO_SESSION: call the asc_web_auth MCP tool first to open the Apple ID login window in Blitz. Wait for it to complete before proceeding.SESSION_EXISTS: proceed to the next step.Ask the user what they want to name the key (the nickname field in ASC). This is a required input — do not guess or use a default.
Use the following self-contained script. Replace KEY_NAME with the user's chosen name. Do not print or log cookies — they contain sensitive session tokens.
python3 -c "
import json, urllib.request, base64, os, sys, time
KEY_NAME = 'KEY_NAME_HERE'
# Read web session file (silent — never print these)
session_path = os.path.expanduser('~/.blitz/asc-agent/web-session.json')
if not os.path.isfile(session_path):
print('ERROR: No web session found. Call asc_web_auth MCP tool first.')
sys.exit(1)
with open(session_path) as f:
raw = f.read()
store = json.loads(raw)
session = store['sessions'][store['last_key']]
cookie_str = '; '.join(
f'{c[\"name\"]}={c[\"value\"]}'
for cl in session['cookies'].values() for c in cl
if c.get('name') and c.get('value')
)
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-Requested-With': 'XMLHttpRequest',
'Origin': 'https://appstoreconnect.apple.com',
'Referer': 'https://appstoreconnect.apple.com/',
'Cookie': cookie_str
}
# Step 1: Create the API key
create_body = json.dumps({
'data': {
'type': 'apiKeys',
'attributes': {
'nickname': KEY_NAME,
'roles': ['ADMIN'],
'allAppsVisible': True,
'keyType': 'PUBLIC_API'
}
}
}).encode()
req = urllib.request.Request(
'https://appstoreconnect.apple.com/iris/v1/apiKeys',
data=create_body, method='POST', headers=headers)