Google Ads API client library for Java

  • The client library for Java is hosted on GitHub and distributed through Maven.

  • It simplifies credential management and creation of Google Ads API service clients.

  • The library requires Java 1.8 or newer.

  • Guides are available for getting started, authorization, building from source, configuration, logging, field masks, resource names, proxy configuration, and long-running operations.

The client library for Java is hosted on GitHub and distributed through Maven Central. It offers several features to help you use the API, including easier management of credentials and creation of Google Ads API service clients.

The library requires Java 8 or later.

Installation

Use the Google Ads API Bill of Materials (BOM) in your pom.xml or build.gradle file to manage dependency versions:

<!-- Import the Bill of Materials (BOM) to ensure you're using compatible
     versions of all google-ads libraries. -->
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.api-ads</groupId>
      <artifactId>google-ads-bom</artifactId>
      <version>46.1.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<!-- Add the google-ads dependency, without a version. The version is
     managed by the BOM. -->
<dependency>
  <groupId>com.google.api-ads</groupId>
  <artifactId>google-ads</artifactId>
</dependency>

You can also build the library from source.

Make your first API call

Video library: Getting started with the Java client library

To use the Google Ads API, you need to perform several steps to get access to the API and configure your Google Ads accounts. Follow the quick start guide, which walks you through all the important steps including setting up your Google Ads accounts.

Basic usage

Refer to the basic usage guide to learn how to set up a project, instantiate service clients, and run code examples with the Java client library.

Authentication and authorization

The Java client library supports multiple approaches to authentication and authorization, including OAuth 2.0 desktop and web application flows, service accounts, and Application Default Credentials. Refer to the authentication and authorization guide to learn more.

Configuration and logging

The Java client library supports multiple configuration options (including ads.properties files, environment variables, and programmatic configuration) and logging capabilities for tracing API requests and responses.

Utilities

The Java client library includes utility classes to improve API usability. Refer to the following guides to learn more:

  • FieldMasks: Helpers for constructing and calculating update field masks.
  • ResourceNames: Utilities for formatting entity resource name strings.
  • Long-running operations: Helpers for monitoring and managing asynchronous API operations.

Fine-tune your application

Refer to the advanced usage guide for recommendations on how to fine-tune your application's timeouts, retry settings, startup latency, and dependency management.