- Print
- DarkLight
- PDF
The Google Ads API is a powerful tool that allows developers to interact programmatically with Google Ads accounts. It provides a way to automate tasks, build custom reporting tools, and integrate Google Ads data with other systems.
Key features of the Google Ads API include:
- Account management
- Campaign and ad group creation and modification
- Keyword and targeting management
- Reporting and performance data retrieval
- Billing and budget management
To start using the Google Ads API:
- Create a project in Google Cloud Console.
- Create an OAuth client.
- Obtain an authorization code.
- Receive access and refresh tokens.
- (Optional) Get Google Ads developer token.
1. Create project in Google Cloud Console
To create a project in Google Cloud Console:
Go to Google Cloud Console and sign in with your Google account.
Create a new project or select an existing one by clicking My First Project and then clicking Dashboard.
On the left navigation panel, click APIs & Services and from the dropdown list, select Library.
In the search field of the API Library page, enter Google Ads API and in the list, click Google Ads API.
On the Product details page, click Enable.
Your project has been created.
2. Create OAuth client
To create OAuth client:
On the API/Service Details page, click Credentials.
On the Credentials page, click + Create Credentials and in the dropdown list, select OAuth client ID.
On the right side of the Create OAuth client ID page, click Configure Consent Screen.
On the OAuth consent screen page, select a user type (Internal or External) and click Create.
On the Create OAuth client ID page:
- Select the Web application type in the Application type dropdown list.
- Enter a name in the Name field.
- Below Authorized redirects URls, click Add URI and enter the http://localhost:8000/callback URI in the URls 1 field.
Note: This is the URI to which the user will be redirected after authorization. - Click Create.
The OAuth client has been created.
Note: You can download the file by clicking Download JSON.
3. Obtain authorization code
To obtain an authorization code:
- Go to the https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=https://www.googleapis.com/auth/adwords&access_type=offline URL.
- Replace YOUR_CLIENT_ID with your Client ID and YOUR_REDIRECT_URI with your redirect URI (that you’ve specified in step 5 of Create OAuth client).
- Copy the code from your URL: the piece from ?code till &scope.
You have the authorization code that you can use in the Corezoid process for receiving access and refreshing tokens.
4. Receive access and refresh tokens
To receive an access and refresh tokens:
Go to Corezoid.com and create a process with an API Call node with the POST API request.
On the API Call node details panel:
- Enter Create access/refresh token in the Add title field.
- Enter "https://www.googleapis.com/oauth2/v4/token" in the URL field.
- Select Default in the Request format dropdown list.
- Select POST in the Request method dropdown list.
- Select json in the Data format dropdown list.
- Enter "application/json; charset=utf-8" in the Content-Type field.
- Enter redirect_uri, grant_type, client_id, code, and client_secret in the Key fields.
- Enter https://localhost:300, authorization_code, client ID (can be found in the json file you downloaded), code (that you obtained in Obtain authorization code, step 3), and client secret (can be found in the json file you downloaded) in the Value fields.
After you receive your access and refresh the token, create another API Call node and on its details panel:
a. Enter Refresh access token in the Add title field.
b. Enter "https://www.googleapis.com/oauth2/v4/token" in the URL field.
c. Select Default in the Request format dropdown list.
d. Select POST in the Request method dropdown list.
e. Enter Application/X-Www-Form-Urlencoded in the Content-Type field.
f. Enter "refresh_token", "grant_type", "client_id", and "client_secret" in the Key fields.
g. Enter "refresh_token", {{client_id}}, and {{client_secret}} in the Value fields.
You can call this request with refresh tokens every hour to update your access token and use it in API requests for Google Ads.
5. Get Google Ads developer token
To get a Google Ads developer token:
On the left navigation panel of the Google Ads main page, click Administrator, and from the dropdown list, select API Center.
Fill in the API Access form:
- Enter your API contact email in the API Contact Email field.
- Enter your company name in the Company name field.
- Enter your company website URL in the Company website URL field.
- Select your company type checkbox (Advertiser, Search Engine Marketing Agency/Company, Partner, or Independent Google Ads Developer).
- Describe your plan in the Intended use field.
- Select your country in the Primary country of business activity dropdown list.
- Select the I accept these Terms of Use checkbox.
- Click Create ID.
The API Access form has been submitted for verification: Google reviews the form and sends you the token by email to access the Google Ads API.