Discover more from roger.ml
🤖 How to create Google Play API key in 2023
Google's official guide has always been confusing, and this year's update is no different. This guide will walk you through the entire process, step by step.
Google’s documentation for creating Google Play credentials can be confusing and hard to follow, specially without visuals. This step-by-step guide aims to resolve that.
Tip: If you see Google Play Console or Google Developer Console in your local language, add
&hl=enat the end of the URL (before any
#...) to switch to English. All the links below already have this to make it easier to find the correct buttons.
1. Write down your Developer Account ID
Open the Google Play Console, click in Account Details, and write down the Developer Account ID listed there. You’ll use it later.
2. Enable the Google Play Developer API
Before using this API, you must enable it. Open the Google Play Developer API page, select an existing Google Cloud Project that fits your needs, and hit ENABLE. If you don't have an existing project or prefer to have a dedicated one for your current needs (e.g. fastlane, Statused), create a new one here and follow the instructions. I personally like having a dedicated project called Google Play Console Project and use it for all my needs 😊
3. Create a Service Account
Open Service Accounts on Google Cloud and select the project you'd like to use.
Click the CREATE SERVICE ACCOUNT button at the top of the Google Cloud Platform Console page.
Verify that you are on the correct Google Cloud Platform project by looking for the Developer Account ID from earlier within the light gray text in the second input, preceding
.iam.gserviceaccount.com, or by checking the project name in the navigation bar. If you realize you don’t have the correct project selected, open the picker in the top navigation bar, and find the right one.
Provide a descriptive
Service account name, depending on what you intend to use this account for, e.g. “
fastlane-supply”, or “
Copy the generated email address that is displayed below the
Service account-IDfield for later use.
Click DONE (don't click CREATE AND CONTINUE as the optional steps such as granting access are not needed):
4. Create your API key JSON
After creating your service account, you’ll end up in a page that shows the list of your service accounts. Next:
Click on the Actions vertical three-dot icon “
⋮”of the service account you just created.
Select Manage keys on the menu.
Click ADD KEY → Create New Key.
Make sure JSON is selected as the
Key type, and click CREATE.
Save the file on your computer when prompted and remember where it was saved at.
5. Invite your service account to your Google Play Console
Open the Google Play Console and select Users and Permissions.
Click Invite new users.
Paste the email address you saved earlier into the email address field.
Make sure App Permissions tab has no apps in there.
Click on the Account Permissions tab.
Choose the permissions you'd like this account to have. This will depend on the purpose of the account you’re creating.
For fastlane, I recommend Admin (all permissions), to avoid permission issues down the road. If you feel adventurous, you may want to manually select some checkboxes and leave out some of the more permissive Release permissions such as Release to production, exclude devices, and use Play App Signing. Of course, this means your API key won’t be able to release to production programmatically, so you’ll have to do it manually, likely via the Google Play Console website.
For Statused, the only permission you’ll need is View app information and download bulk reports (read-only). This makes this API key more secure, as it’s read-only, which is enough for the access that Statused needs. It should look like this:
Click on Invite User.
Validating your API key access
You’re done creating and configuring your API key, congrats! Next, we should verify whether everything is working as expected.
If you're configuring an API key for Statused, you can simply upload your key and the system will validate the key for you.
If you’re going to use it for fastlane, there’s an action to validate your key:
bundle exec fastlane run validate_play_store_json_key json_key:path/to/your/api/key.json
Keep in mind that this action will only validate whether your key can connect to the API successfully, but not whether it can access your apps to manage them. To check whether you configured your key correctly to access your apps, you’ll need to run one of the fastlane supply actions. If it’s not configured correctly, it will raise the following error:
FastlaneCore::Interface::FastlaneError (Google Api Error: Invalid request - The caller does not have permission)
After following this step-by-step guide, you should be up and running with your Google Play API key, ready to use it to manage your releases, upload builds, update metadata, and even monitor your phased rollout distribution percentage if you’re using Statused.
If you’re still experiencing issues after following this guide, don’t hesitate to reach out! I’ll do my best to improve this guide to make it easier for everyone moving forward!
roger.ml is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.