App Store Connect API

RSS for tag

The App Store Connect API helps you automate tasks usually done on the Apple Developer website and App Store Connect.

App Store Connect API Documentation

Post

Replies

Boosts

Views

Activity

401 Unauthorized App Store Connect API
I'm getting the following error: Provide a properly configured and signed bearer token, and make sure that it has not expired. Learn more about Generating Tokens for API Requests https://developer.apple.com/go/?id=api-generating-tokens I am using the correct key files and I have assigned the Admin permission. Any help would be greatly appreciated import requests import datetime from authlib.jose import jwt app = Flask(__name__) # App Store Connect API information KEY_ID = 'XXXXXXXXX' ISSUER_ID = 'XXXXX-XXXXX-XXXX-XXXX-XXXXXXXX' KEY_FILE = 'AuthKey_XXXXXXX.p8' APP_ID = '12345678' # App Store Connect application ID def generate_jwt_token(): """ Generate JWT token using authlib.jose """ header = { 'alg': 'ES256', 'kid': KEY_ID, 'typ': 'JWT' } payload = { 'iss': ISSUER_ID, 'aud': 'appstoreconnect-v1', 'exp': int(datetime.datetime.utcnow().timestamp()) + 1200 # token good for 20 min } with open(KEY_FILE, 'r') as key_file: key = key_file.read() token = jwt.encode(header, payload, key) return token.decode('utf-8') # Ensure the token is a string @app.route('/latest-build') def latest_build(): token = generate_jwt_token() headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' } response = requests.get( f'https://api.appstoreconnect.apple.com/v1/builds?filter[app]={APP_ID}&limit=1&sort=-uploadedDate', headers=headers ) if response.status_code != 200: return jsonify({ 'error': 'Failed to fetch data from API', 'status_code': response.status_code, 'response': response.json() }) build_data = response.json() try: latest_build_version = build_data['data'][0]['attributes']['version'] return jsonify({'latest_build_version': latest_build_version}) except KeyError as e: return jsonify({ 'error': 'KeyError accessing response data', 'details': str(e), 'response': build_data }) if __name__ == '__main__': app.run(debug=True)
0
0
68
3d
Unable to recreate a ONE_TIME_SNAPSHOT analytics report
Previously created a one time snapshot report that was later deleted. Trying to recreate it but keeping getting a 409. Been already a week since it was deleted. Error message { "errors" : [ { "id" : "b0d8d738-1744-463d-bdcf-a48fbfa5d715", "status" : "409", "code" : "STATE_ERROR", "title" : "The request cannot be fulfilled because of the state of another resource.", "detail" : "You already have such an entity" } ] } Reports request only returns the ONGOING reports link no ONE_TIME_SNAPSHOT . Wonder if it takes time although unlikely or might it be a cache or similar causing the problem.
0
0
106
4d
App Store Connect API: How to create introductory offer for all territories?
I'm trying to use the appstore connect REST API to create an introductory offer for one of our subscriptions. The introductory offer should exist in all territories our app supports. I successfully created an intro offer for all territories, but only by calling POST https://api.appstoreconnect.apple.com/v1/subscriptionIntroductoryOffers (https://developer.apple.com/documentation/appstoreconnectapi/create_an_introductory_offer) 175 times, once for each territory. Is there a more efficient way to do that? The API documentation has no explanatory text, only the types and payloads. I used those to piece together the following approach. I am not sure if this is even the intended way to use the API, so please correct me if I'm wrong. Call GET https://api.appstoreconnect.apple.com/v1/subscriptions/{id}/pricePoints with territory filter USA to get all available price points in USD From the result list, pick the price point whose customer price is closest to the one I wish to set up Call GET https://api.appstoreconnect.apple.com/v1/subscriptionPricePoints/{id}/equalizations to get equivalent price points in all territories Call POST https://api.appstoreconnect.apple.com/v1/subscriptionIntroductoryOffers for each the USA's the and other territories' price points Now my question. The create intro offer endpoint takes as payload an object of type SubscriptionIntroductoryOfferCreateRequest (https://developer.apple.com/documentation/appstoreconnectapi/subscriptionintroductoryoffercreaterequest), which has a field "included", which is a list of price point IDs. In my step 3 above I have a list of price point IDs, and the field name and type suggests to put them here to create an intro offer for all territories in one API call. However, this does not work. The field "included" seems to have no effect whatsoever, no matter what I put in there. Is there a way to create an intro offer for all territories in one go, or do I have to call the create endpoint multiple times?
0
0
73
6d
Failed to parse the media type: application/json;
Few days ago app store connect api response is incorrect, returns the Content-type "application/json;" It is wrong cause there is a semicolon at the end of mime type. Many http clients fail with 'Failed to parse the media type: application/json;' i tested on https://api.appstoreconnect.apple.com/v1/apps/appid/appStoreVersions After a few retries the response is correct Please help
0
0
99
1w
Can I change the availability of the auto-renewal subscription item using the API?
In my application, I have to create and remove many auto-renewal subscription items programmatically using an API. Like the YouTube app, when a user creates a channel, I will create a subscription item with their name, and when they shut down the channel, I will cancel the whole subscription and remove the item. I found that I can create subscription items using the following API: https://developer.apple.com/documentation/appstoreconnectapi/create_an_auto-renewable_subscription In the following document, I found that I can stop selling and cancel subscriptions at https://appstoreconnect.apple.com by changing the availability of item from "Cleared for Sale" to "Remove from Sale": https://developer.apple.com/help/app-store-connect/manage-subscriptions/set-availability-for-an-auto-renewable-subscription My question is can I stop selling and cancel subscriptions using an API? The App Store Connect API offers modifying subscription availability, but it only offers changing sales countries: https://developer.apple.com/documentation/appstoreconnectapi/modify_an_auto-renewable_subscription They also offer a subscription deletion API, but I'm not sure if it'll work as I need: https://developer.apple.com/documentation/appstoreconnectapi/delete_a_subscription How do you manage auto-renewal subscription items when you stop selling them? Is there any API or do you do it manually? Thank you.
0
0
116
1w
App Store Notification
Hello, I am developing App Store Server to Server Notifications. (The app has already been deployed and is in operation.) Test notifications in both the Sandbox and Production environments have been working correctly. Additionally, I tested in-app purchases using a Sandbox account and confirmed that the server notifications are received. However, when an actual purchase is made in the live app, the server notifications are not received. Please provide the possible causes and solutions for this issue.
1
0
182
1w
Incorrect 400 response when downloading subscriber report
I am attempting to download subscriber reports for my app. I'm using the following URL with vendorNumber redacted: https://api.appstoreconnect.apple.com/v1/salesReports?filter[frequency]=DAILY&filter[reportSubType]=DETAILED&filter[reportType]=SUBSCRIBER&filter[reportDate]=2024-04-04&filter[vendorNumber]=xxxxxxxx&filter[version]=1_3 I am getting the following response: "id": "92183ac5-7881-436c-ac66-5d89673c5070", "status": "400", "code": "PARAMETER_ERROR.INVALID", "title": "A parameter has an invalid value", "detail": "Invalid vendor number specified. Try again.", "source": { "parameter": "filter[vendorNumber]" } However when I use the same vendor number for the sales summary report: https://api.appstoreconnect.apple.com/v1/salesReports?filter[frequency]=MONTHLY&filter[reportDate]=2023-09&filter[reportSubType]=SUMMARY&filter[reportType]=SALES&filter[vendorNumber]=xxxxxxxx&filter[version]=1_0 I get a proper response. I believe I should be getting a 404 on this response, but am not. This issue can be tracked back to 2019, can we please get some detail about this response?
0
1
136
1w
App Store Connect API - Daily App Analytics
Hello, I am trying for a few days to get daily reports for a specific app_id but it seems the process is not working. I manage to get a list of my apps, then of my current reports, but when I try to request a https://api.appstoreconnect.apple.com/v1/analyticsReportInstances/{id} from the report list I am returning above I get a 404. I was wondering if you have any actual guide on how to get daily reports updated from the api for a specific type (downloads or installs for example)?
0
1
116
1w
How Can I create a new App from API
Hi all, I am developing new things on my existing .Net core application. I want to create a new page and with this page, the users will create a new app and write important informations. But I cant create a new app with sending post request with connect API. Here is my Postman requests and body. Sending request to : https://api.appstoreconnect.apple.com/v1/apps Body : { "data": { "type": "apps", "attributes": { "bundleId": "com.test.testtest", "name": "Test Test", "primaryLocale": "en-US", "sku": "test2024", "platform": "IOS" } } } Also I am using a bearer token, and this token has a admin role. When I send a post request, I am getting below error. { "errors": [ { "id": "35f9631f-b8d8-408c-8dfd-adaef043d062", "status": "403", "code": "FORBIDDEN_ERROR", "title": "The given operation is not allowed", "detail": "The resource 'apps' does not allow 'CREATE'. Allowed operations are: GET_COLLECTION, GET_INSTANCE, UPDATE" } ] } How can I fix this. Pls help. Thanks.
1
0
171
1w
Empty response returned on read instances GET request
I'm trying following endpoint to get instances of a report, https://api.appstoreconnect.apple.com/v1/analyticsReports/{id}/instances but getting an empty response: {'data': [], 'links': {'self': 'https://api.appstoreconnect.apple.com/v1/analyticsReports/r8-4433f324-ba58-44d0-8b7f-f8976ef36646/instances'}, 'meta': {'paging': {'total': 0, 'limit': 50}}} I'm accessing "App Sessions Standard" report and correctly passing the instance id to get instances of this report. Also made sure that the App I'm accessing have App sessions data in the console. code.txt This is the order of api requests I implemented: 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests' 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests/{report_id}/reports' 'https://api.appstoreconnect.apple.com/v1/analyticsReports/{report_id}/instances' Source code is provided in the attached file. Would be grateful if someone can help resolve this issue.
0
0
145
1w
API Key 403 Detected
I'm using Expo EAS to try and submit a build to Test Flight. During the submission, there's two paths I've tried and both fail with the same error: "This request is forbidden for security reasons - The API key in use does not allow this request" The first way, it asks "Generate a new App Store Connect API Key" which I respond yes and it fails with the above message. The second way, I respond no to the above question and specify a path to the API Key that I manually created under "Individual API Key" in my Apple Connect account. Is this the correct place to have created this API Key? Is there a different type of API Key I should be using? Or is this a permission issue with my Apple account? I am not the account owner but it looks like I have the correct permissions as far as I can tell. TIA!
1
0
109
2w
Unreal/ Apple Connect/ non-public or deprecated API
Hello I get rejected from Apple Store Connect because because "Your app uses or references the following non-public or deprecated APIs: Contents/Resources/YYYYYYYYY.app/Contents/UE/Engine/Binaries/ThirdParty/Apple/MetalShaderConverter/Mac/libmetalirconverter.dylib Symbols: • __dyld_get_image_uuid In Terminal, I get this: otool -Iv /Users/XXXXXXXX/Desktop/XXXXXXXXX/Mac15/YYYYYYYY.app/Contents/UE/Engine/Binaries/ThirdParty/Apple/MetalShaderConverter/Mac/libmetalirconverter.dylib | grep __dyld_get_image_uuid 0x00000000012c62a0 374767 __dyld_get_image_uuid 0x00000000015e8468 374767 __dyld_get_image_uuid The question is, how to find what is using the __dyld_get_image_uuid in Unreal? The game is Mac only, not iOS. Any help highly appreciated because I have tried to solve this a month now with no luck. Unreal 5.4.2, Mac 14.4.1, Xcode 15.4 Thank you in advance and all the best, Ramili
0
0
180
2w
Checking refund history for multiple transactions
As of the latest available information, Apple does not directly provide an endpoint for checking refund history for multiple transactions in a single request via their App Store Server API. The endpoint https://api.storekit.itunes.apple.com/inApps/v2/refund/lookup/{transactionId} allows you to check the refund status for a single transaction ID at a time. What if you have 8000 subscribers? Are we going to send 8k requests everyday? What's the solution for this scenario? We don't want to implement the notifications by the way. Any solutions?
2
0
175
2w
Electron failed to setup iap sandbox environment
Hi there, I'm implementing in app purchase in Electron following docs here: https://www.electronjs.org/zh/docs/latest/tutorial/in-app-purchases But : getProducts returns [] calls to purchaseProduct, nothing happend(no dialog, no login) calls to restoreCompletedTransactions , a login dialog appears, and I can login my sandbox tester account. The account even appears int the Apple Store. More info list as follow. Packaging using electron builder, configuration is : "masDev": { "type":"development", "identity": "York Chan", "hardenedRuntime": false, "gatekeeperAssess": false, "entitlements": "./build/entitlements.mas.plist", "entitlementsInherit": "./build/entitlements.mas.inherit.plist", "provisioningProfile": './build/provisionloginsight.provisionprofile', //development的描述文件,确保系统描述文件里已经安装好 }, "mas": { "type": "distribution", "identity": "York Chan", "hardenedRuntime": false, "entitlements": "./build/entitlements.mas.plist", "entitlementsInherit": "./build/entitlements.mas.inherit.plist", "entitlementsLoginHelper": "./build/entitlements.mas.loginhelper.plist", //如果需要testflight则该项必须 "provisioningProfile": './build/provisionloginsightappstore.provisionprofile', //distribution描述文件 }, "mac": { "artifactName": "${productName}_${version}.${ext}", "identity":null, "type": "development", //mas - distribution; mas-dev - development, "icon": "./icons/icon512.icns", "target": [ { "target": "mas-dev",//mas "arch": [ "universal" ], } ], "extendInfo":{ } }, I wrap StoreKit API into 'Platform' class, and call from render process to main process using ipcRender.invoke If I create a Xcode project, and set bundler identifier to the same one, configure the storekit in schema, I can successfully 'purchase', and seeing [Enviroment: Xcode]. Someone can help me please ?
1
0
180
2w
App Store Connect API: Modifying Phased Release
I'm trying to automate the process of resuming, or completing a phased release using the "PATCH /v1/appStoreVersionPhasedReleases/{id}" endpoint. When sending a request to update the PhasedReleaseState, I am seeing a 409 error that states: An attribute value is not acceptable for the current resource state. You cannot change the state of a phased release in the current version state. Source: {'pointer': '/data/attributes/pendingDeveloperRelease'} Apparently PENDING_DEVELOPER_RELEASE is an invalid state. Based on the "App and submission statuses" document, the PENDING_DEVELOPER_RELEASE state means: Your app was approved, but you still need to release it for distribution on the App Store. I'm a bit surprised that it would fail, when releasing the app for distribution is exactly what I'm trying to do by modifying the PhasedReleaseState to ACTIVE, or COMPLETE. In addition, the "Release a version update in phases" document lists it as a valid state: When you release a version update of your iOS, macOS, tvOS, or universal app, you can choose to release it to the App Store in stages. This option is available if you're submitting a version update and your app has one of the following app statuses; Prepare for Submission Waiting for Review In Review Waiting for Export Compliance Pending Developer Release Developer Rejected Rejected Metadata Rejected Notably, some of the other states seem like they shouldn't be valid states to rollout an app (e.g. Rejected, Waiting for Review, etc.). So this makes me think that this document doesn't necessarily cover the list of valid states; more so, they tell you that you have the capability to perform a phased rollout for your app. So, my question is, what are the valid app version states required for me to be able to successfully modify a phased rollout? Any help, or pointers would be greatly appreciated. Thank you! API Endpoint URL: https://developer.apple.com/documentation/appstoreconnectapi/modify_an_app_store_version_phased_release App and submission statuses document: https://developer.apple.com/help/app-store-connect/reference/app-and-submission-statuses Release a version update in phases document: https://developer.apple.com/help/app-store-connect/update-your-app/release-a-version-update-in-phases
1
0
166
2w
Migrate from the verifyReceipt API to the new
Apple has deprecated the https://buy.itunes.apple.com/verifyReceipt API and encourages users to migrate to the new https://api.storekit.itunes.apple.com/inApps/v1/transactions/{transactionId} API. However, during the migration, a problem was discovered. Previously, with the verifyReceipt API, the 21007 status code could be used to distinguish between the sandbox and production environments. Now, with the new API, if the {transactionId} is from the sandbox environment, it will directly return {"errorCode":4040010,"errorMessage":"Transaction id not found."}. How can I distinguish whether a {transactionId} is generated in the sandbox environment or the production environment?
5
1
278
2w
How to Update App Store Metadata via App Store Connect API Using Postman
I need help updating the description, keywords, what's new, and promotional text for my app on the App Store using the App Store Connect API through Postman. I already have my access token. I need to update the data for each language, I changed to PATCH, but what is the url to patch? And what json should I send?
1
0
187
2w