Skip to content

Connect to Google Ads

bidsmith reads five environment variables to talk to the Google Ads API:

VariableWhat it is
GOOGLE_ADS_DEVELOPER_TOKENA token from your Google Ads manager account that authorizes API access.
GOOGLE_ADS_CLIENT_IDThe OAuth client ID — identifies bidsmith as an “app” to Google.
GOOGLE_ADS_CLIENT_SECRETThe OAuth client secret — paired with the client ID.
GOOGLE_ADS_REFRESH_TOKENA long-lived token bidsmith exchanges for short-lived access tokens on every run.
GOOGLE_ADS_CUSTOMER_IDThe numeric ID of the Google Ads account you’re managing (10 digits, no dashes).

Optionally GOOGLE_ADS_LOGIN_CUSTOMER_ID — set to your manager account ID if you’re managing a sub-account via an MCC.

You set these once. Total setup time: ≈ 15 minutes the first time.

Step 1 — Obtain the four credentials

Google’s docs are the canonical walkthrough for each piece. Open them in order:

  1. Developer tokenObtain a developer token. Apply via Google Ads → Tools → API Center. New tokens start in test access mode, which is fine for trying bidsmith against a test account. For a production account you need basic access — bidsmith ships a generator for the design document Google requires with that application; see Apply for Basic API access.

  2. OAuth client ID + secretCreate OAuth 2.0 credentials. In Google Cloud Console, enable the Google Ads API, configure the OAuth consent screen with scope https://www.googleapis.com/auth/adwords, and create credentials of type Desktop app.

  3. Refresh tokenGenerate a refresh token via the OAuth Playground. Use your own OAuth credentials in the Playground settings (gear icon → “Use your own OAuth credentials”), authorize the adwords scope, and copy the refresh token from the response. Treat it like a password.

  4. Customer ID — the 10-digit number in the top-right of the Google Ads UI (formatted as 123-456-7890). bidsmith expects it without dashes: 1234567890.

Step 2 — Save them as env vars

Add to ~/.zshrc (zsh, default on modern macOS) or ~/.bashrc (bash, default on most Linux distros):

Terminal window
export GOOGLE_ADS_DEVELOPER_TOKEN="aBc1DeFg2HiJk-LMNo3PqRs"
export GOOGLE_ADS_CLIENT_ID="123456789-abc...apps.googleusercontent.com"
export GOOGLE_ADS_CLIENT_SECRET="GOCSPX-xxxxxxxxxxxxxxxx"
export GOOGLE_ADS_REFRESH_TOKEN="1//09xxxxxxxxxxxxxxxxxxx"
export GOOGLE_ADS_CUSTOMER_ID="1234567890"
# export GOOGLE_ADS_LOGIN_CUSTOMER_ID="9876543210" # uncomment if needed

Open a new terminal window so the changes take effect, or run source ~/.zshrc.

Step 3 — Smoke test

Confirm bidsmith can authenticate with what you just configured:

Terminal window
bidsmith plan --whoami

Expected output:

Refresh token exchanged successfully.
Access token expires in 3599 seconds.
Customer ID: 1234567890

If you see that, you’re done. Skip to the first tutorial.

Troubleshooting

SymptomLikely cause
developer token is not approvedToken is still in test-access mode. Either use a test account, or apply for basic access via the API Center.
invalid_grantRefresh token is wrong, revoked, or expired. Re-do step 1.3.
PERMISSION_DENIED or customer not foundSet GOOGLE_ADS_LOGIN_CUSTOMER_ID to your manager account ID.
command not found: bidsmithRe-check the install page. Open a new terminal so shell config changes take effect.
Anything mentioning a retired API versionSet BIDSMITH_API_VERSION to the current version (defaults to v22).

Next

Your first 10 minutes — clone a starter repo, run plan and apply for the first time.