Quickstart

This guide uses a client library to retrieve Google Ads campaigns.

To enable API access, first obtain the required OAuth2 credentials.

Then, add the authorization and account details to a config file. Once the config file is set up, you're ready to call the API.

Config parameters for client library

Supply the following information in the config file of your client library.

Developer token

Your developer token lets your app access the API, but the token is not restricted to only one Google Ads account. Once your token is approved, you can use the same token for requests against all your Google Ads accounts, even if they're not linked to the Google Ads manager account associated with the token.

The accounts you manage are authorized by OAuth credentials from the manager account. A manager account requires only one set of credentials to manage all of its sub-accounts.

Only approved tokens can connect to the API for production Google Ads accounts; pending tokens can connect only to test accounts.

You can retrieve your developer token by signing in to your manager account, then navigating to the API Center (TOOLS & SETTINGS > SETUP > API Center).

Client customer ID

The client customer ID is the account number of the Google Ads client account you want to manage with the API, usually in the form 123-456-7890.

Optionally, the client customer ID can be left out of the config file and set programmatically. Once your developer token is approved, you can use a client customer ID from a production account instead of a test account.

OAuth2 client ID and client secret

The OAuth2 client ID and client secret map your client app to a project in the Google API Console and are used for OAuth2 authentication—enabling your app to operate on behalf of your account. They identify your app to Google and let you generate OAuth tokens for managing Google Ads users. See Create a client ID and client secret for more details.

OAuth2 access and refresh tokens

Before your app can access private data using the API, it must obtain an OAuth2 access token that grants access to the API.

If you're using the client libraries, the OAuth2 access token is automatically taken care of for you. Otherwise, try getting tokens through the OAuth Playground.

OAuth2 access tokens expire after a limited time. For this reason, the client libraries use the OAuth2 refresh token to automatically regenerate the OAuth2 access token. Access and refresh token has instructions for creating the refresh token.