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.

Posts under App Store Connect API tag

200 Posts
Sort by:

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
72
3d
What is the timezone in Sales Report?
Hey, I'm using the reporter in order to get Sales and Trends report. I don't understand what is the date timezone in the report, in the documentation it says that it is depands on the Territory. Which Territory? The purchase territory? And if it is the purchase territory, does it means that each recoors is in different timezone? Or is it the application territory? Thank you for the answer, Ido
0
0
52
5d
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
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
138
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
146
1w
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
The in-app purchase is not working
The in-app purchase is not working. I am trying to create auto-renewable subscriptions, but all I see is "The subscription is unavailable in the current storefront." I have checked and signed all agreements available to me in App Store Connect. They are all in "Active" status. I created subscriptions in App Store Connect (they are all in "Waiting for Review" status). All countries or regions are selected in the subscription. Subscription Prices, Tax Category, and App Store Localization are set. When building in Xcode, I set the StoreKit Configuration to None in the scheme. The app was installed via TestFlight. I submitted the app for review, but the reviewer also couldn't use the purchases. I've already watched all the videos on StoreKit v2. I don't know what else I can do.
1
0
139
2w
Customer Reviews API Error - Authentication Challenge
Hello, I am currently running into issues while using the "List All Customer Reviews for an App" API. https://developer.apple.com/documentation/appstoreconnectapi/list_all_customer_reviews_for_an_app From both Postman and cURL, I am running into the below error when making requests to the endpoint. { "errors" : [ { "id" : "088cf5a0-5ea1-447c-ad21-e3de2f6e8ead", "status" : "403", "code" : "FORBIDDEN_ERROR", "title" : "This request is forbidden for security reasons", "detail" : "The API key in use does not allow this request" } ] } The API Key in question is an Admin role API Key that is capable of making other requests to the App Store Connect API such as Creating Beta Groups, Submitting Builds, downloading Sales data, etc. The same requests were working two weeks ago, but then stopped working last week sometime. Has anyone else run into the above issue? Any thoughts on things to try to get around this issue with Admin API Keys? Thanks in advance for any guidance or thoughts that can be shared!
3
0
206
2w
Is it possible to return someone's APP info (not mine) from "List All Customer Reviews for an App" API?
Hi, is it possible to use the "List All Customer Reviews for an App" API to get the reviews for someone else's app (not ours)? Or is it only possible to get reviews for our own app? https://developer.apple.com/documentation/appstoreconnectapi/list_all_customer_reviews_for_an_app We're considering to join Developer Program if it is possible to return SOMEONE(not ours)'s APP review data as well. Thank you in advance.
2
0
251
3w
App store connect API returns 404 with production url, but it returns 401 with sandbox url
My app is currently in review (review completed). I'm using the Get Transaction info API with a sandbox purchase transaction ID. "x": "Invalid response: Client error: GET https://api.storekit-sandbox.itunes.apple.com/inApps/v1/transactions/2000000632750685 resulted in a 401 Unauthorized response", However, when using the production url "Invalid response: Client error: GET https://api.storekit.itunes.apple.com/inApps/v1/transactions/2000000632750685 resulted in a 404 Not Found response:\n{"errorCode":4040010,"errorMessage":"Transaction id not found."}\n", Should I generate my JWT differently for sandbox vs production? If not, what else could cause this issue? Is there any missing congigration?
1
0
246
Jun ’24
Sale Report Data Inconsistent
We are pulling data from the salesReports endpoint, specifically focusing on the Subscriber, Subscription_Event, and Subscription report types. Our goal is to perform internal analysis on our subscriptions, such as comparing renewals to new subscriptions. However, we have observed that the data quality is not as high as we would expect from Apple. While some insights can be gleaned with a degree of uncertainty, our biggest concern is the discrepancy between the data obtained from the API or manually downloaded from the portal (https://appstoreconnect.apple.com/trends/reports) and the data displayed in the Portal visualizations (https://appstoreconnect.apple.com/trends/events). This discrepancy makes cross-checking difficult and lowers our confidence in the data’s accuracy. Is anyone else experiencing similar issues, or has anyone managed to obtain reliable data for their app(s)?
0
0
196
Jun ’24