Using the Chrome Web Store Publish API

Overview #

The Chrome Web Store Publish API provides a set of REST endpoints for programmatically creating, updating, and publishing items in the Chrome Web Store. Using this API, you can automate the process of uploading and publishing items into the store.

Before you begin #

To use the Chrome Web Store Publish API, you need to enable the API for your project in the Google Developers Console.

  1. Visit the Google Developers Console.
  2. Create a new project or select an existing one.
  3. In the sidebar on the left, select APIs & auth.
  4. In the displayed list of available APIs, set the status of the Chrome Web Store API to ON.
  5. Accept the Terms of Service.
  6. In the sidebar on the left, select Credentials.
  7. Find the lines labeled Client ID and Client secret. Note that there may be a client ID without a client secret for use with Compute Engine and App Engine. In that case, create a new client ID and client secret.
  8. To create the client ID and client secret, click on CREATE CREDENTIALS, select OAuth client ID and select Desktop app under Application type.
  9. Get an access token:

Once you have the client ID and client secret, you can retrieve an access token to work with the API. For example, enter this URL in your browser, replacing the $CLIENT_ID with the one for your app:

https://accounts.google.com/o/oauth2/auth?response_type=code&scope=https://www.googleapis.com/auth/chromewebstore&client_id=$CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob

You will see a page asking you to accept permission for the requested scope.

Note: Make sure you are requesting the token using the Google Account which owns the Chrome Web Store apps you want to manage. This account can be different from the account you create the Google Developers Console project with. For example, you can create an application for other developers to manage their apps, in which case you only need to register a Google Developers Console project.

A screenshot of the permission request UI.

Click the Accept button and you will see a code that looks something like this:

A screenshot of the UI for copying code.

Use this value to request an access token. For example, using curl, you can get an access token by executing the following command (replacing the values of $CLIENT_ID, $CLIENT_SECRET, and $CODE with the values from above):

> curl "https://accounts.google.com/o/oauth2/token" -d \
"client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&code=$CODE&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob"

This will return a result such as:

{
"access_token" : "ya29...",
"token_type" : "Bearer",
"expires_in" : 3600,
"refresh_token" : "1/rwn..."
}

You can now use the access_token to call the API. You can also use the refresh token to get future access tokens. Note that tokens expire after 40 minutes.

Note: For more information about getting OAuth 2.0 access tokens, see Using OAuth 2.0 to Access Google APIs.

Using the API #

Once you have an access token, your app can then use the Chrome Web Store Publish API. There are endpoints for creating items, updating items, and publishing items.

Note: Currently, there is no API for setting an item's metadata, such as description. This has to be done manually in the Chrome Web Store Developer Dashboard. More detail about the Web Store API can be found here.

Uploading a package to create a new store item #

Endpoint: https://www.googleapis.com/upload/chromewebstore/v1.1/items
Type: POST
Header Parameters: $TOKEN: the access token
Body content: the package file to upload

Type the following example on the command line:

> curl \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-X POST \
-T $FILE_NAME \
-v \
https://www.googleapis.com/upload/chromewebstore/v1.1/items

Note: For a full description of the insert method, see Items:Insert.

Uploading a package to update an existing store item #

Endpoint: https://www.googleapis.com/upload/chromewebstore/v1.1/items/$APP_ID
Type: PUT
Header Parameters: $TOKEN: the access token
Body content: the package file to upload

$APP_ID is the ID of the existing Web Store item.

> curl \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-X PUT \
-T $FILE_NAME \
-v \
https://www.googleapis.com/upload/chromewebstore/v1.1/items/$APP_ID

Note: For a full description of the update method, see Items:Update.

Publishing an item to the public #

Endpoint: https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish
Type: POST
Header Parameters: $TOKEN: the access token
> curl \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish

Note: For a full description of publish method, see Items:Publish.

Publishing an item to trusted testers #

Endpoint: https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish?publishTarget=trustedTesters
Type: POST
Header Parameters: $TOKEN: the access token
> curl \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish?publishTarget=trustedTesters

Note: For a full description of the publish method, see Items:Publish.

Checking the upload status of an item #

Endpoint: https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID?projection=draft
Type: GET
Header Parameters: $TOKEN: the access token
curl \
-H "Authorization: Bearer $TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-H "Expect:" \
-X GET \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID?projection=draft

Note: For a full description of the get method, see Items:Get.

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.