OAuth Service Account Flow

Stay organized with collections Save and categorize content based on your preferences.

This guide will walk you through how to setup OAuth2 for API access using your own credentials using service accounts. These steps only need to be done once, unless you revoke or delete your OAuth2 credentials.

Create OAuth2 credentials

Generate a service (delegate) account ID and a *.JSON file by following the linked instructions, then come back to this page.

Set up client library

Set the private key JSON file path and delegate account ID in your configuration. If you're using a googleads.properties file, add the following:


If you're using environment variables, add the following to your Bash configuration or environment: