Data Studio API

Getting Started

In order to access and call the API, you will need to do the following:

Enable the API

Before you can call the API, you'll need to enable it. To do so, navigate to Enable the API in the Cloud Console.

Create an OAuth Client

  1. Navigate to Configure OAuth consent screen
    1. Choose Internal, then click Create
    2. Add the Data Studio read+write scope:
      1. Click Add Scope
      2. Click the manually paste link at the bottom of the pop-up
      3. Enter https://www.googleapis.com/auth/datastudio
      4. Click Add
    3. Fill out any other required fields, then click Save
  2. Navigate to Credentials
    1. Click the CREATE CREDENTIALS button
    2. Select OAuth client ID
    3. Choose the appropriate Application Type. (You probably want Web application)
    4. Fill out the required fields then click Create

Authorize OAuth client

  1. Navigate to domain wide delegation in Google Admin console
  2. In API clients, click Add new
  3. Enter the Client ID for the OAuth client you created in the previous step
  4. Enter all OAuth scopes needed for the application. At a minimum you will need to add the following scopes:
    • https://www.googleapis.com/auth/datastudio
    • https://www.googleapis.com/auth/userinfo.email
    • https://www.googleapis.com/auth/userinfo.profile
    • openid
  5. Click Authorize

Next Steps

After completing these steps you will have the necessary access to call the API. In order to actually call the API, you will need to get an OAuth token, and include it in your request. Programmatically getting an OAuth token is out of scope for this doc, but Using OAuth 2.0 to Access Google APIs should get you started.