Error: 7 PERMISSION_DENIED: Google Ads API has not been used in project xxxxxxxxxx

3,109 views
Skip to first unread message

Michael Fedorov

unread,
Jan 27, 2022, 3:38:02 AM1/27/22
to Google Ads API and AdWords API Forum

Hi,
get error when try to get data from google ads:

Error: 7 PERMISSION_DENIED: Google Ads API has not been used in project xxxxxxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/googleads.googleapis.com/overview?project=xxxxxxxxxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

code:
const {GoogleAdsApi, enums} = require('google-ads-api');

const client = new GoogleAdsApi({
client_id: 'xxxxxxxxxxxx',
client_secret: 'xxxxxxxxxxxx',
developer_token: 'xxxxxxxxxxxx',
})

const customer = client.Customer({
customer_id: '000-000-0000',
refresh_token: 'xxxxxxxxxxxx',
});

const campaigns = await customer.report({
entity: "ad_group",
metrics: [
"metrics.cost_micros",
"metrics.clicks",
"metrics.impressions",
"metrics.all_conversions",
],
segments: ["segments.date"],
from_date: "2021-11-10",
to_date: "2021-11-11",
});

What is wrong ?
How to resolve this issue ?

thanks


Google Ads API Forum Advisor

unread,
Jan 27, 2022, 5:52:39 AM1/27/22
to mich...@realcommerce.co.il, adwor...@googlegroups.com
Hi Michael,

Thank you for posting your concern.

In Google Ads API, you will need to enable the Google Ads API in your project by following this guide where your Oauth2 credentials have been generated. You should enable it in the Google cloud project mentioned on the API response generated on your end.

Let me know if you have further questions.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2VQ0WL:ref

Michael Fedorov

unread,
Jan 27, 2022, 11:06:25 AM1/27/22
to Google Ads API and AdWords API Forum
Hi,

Thank you for answer.
I have the problem with google console, I can't to find what email connected to project.
Can I find out by client id and client secret which project or email it belongs to ?

Google Ads API Forum Advisor

unread,
Jan 28, 2022, 2:35:12 AM1/28/22
to mich...@realcommerce.co.il, adwor...@googlegroups.com
Hi Michael,

Thank you for the reply.

The project Id that appeared in your API response logs should be the project to which your client id and client secret belongs. However, if you want to know what email it belongs, then this is not possible to determine using Google Ads API.

With this, I would suggest reaching out to the Google Cloud Project support team via this link to know if they can help you find the email address of that Google cloud project.
Reply all
Reply to author
Forward
0 new messages