I'm using the Google Ads REST API to retrieve a list of customers and display them to the user. I want to display these customers alongside metadata like the account name, whether it's a manager account or not, etc.

I've already got a list of accessible customers using https://googleads.googleapis.com/v15/customers:listAccessibleCustomers. However, I can't find the appropriate documentation for retrieving the customer object itself using the customer id.

I've tried using the https://googleads.googleapis.com/v15/customers/{customerID}/operations/get endpoint, however this always returns a 404 resource not found error.

Any help would be appreciated. Thank you.

Tag:google-ads-api, google-api

2 comments.

  1. Ethan Crabb

    After many hours of searching, I've found you can retrieve attributes of a Google Ads customer using the following POST endpoint.

    https://googleads.googleapis.com/v15/customers/${accountID}/googleAds:search

    In the request body, specify the attributes you'd like to query using Google Ads query language in the query field.

    For example:

    // Define the request body const requestBody = { query: 'SELECT customer.id, customer.resource_name, customer.descriptive_name, customer.manager, customer.test_account FROM customer' }; // Make the request axios.post(`https://googleads.googleapis.com/v15/customers/${CUSTOMER_ID}/googleAds:search`, requestBody, { headers: { "developer-token": {{DEVELOPER_TOKEN}}, // Replace with your developer token Authorization: `Bearer {{ACCESS_TOKEN}}`, // Replace with your access token 'Content-Type': 'application/json', }, })

    You can find a full list of customer attributes here

  2. Johnover Board

    I am not familiar with the REST API aspect, but if you can use the service GoogleAdsService.Search, you can get account level info using the following GAQL query:

    SELECT customer_client.id, customer_client.level, customer_client.manager, customer_client.resource_name, customer_client.descriptive_name, customer_client.client_customer, customer_client.applied_labels, customer_client.currency_code, customer_client.hidden, customer_client.status, customer_client.test_account, customer_client.time_zone FROM customer_client

    You can check the customer_client documentation, or the query builder tool to see other options. Let me know if I can help with any further details.

    https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy

Add a new comment.