I am getting a 403 "The caller does not have permission" error when using the Google Custom Search API that I haven't gotten before

255 views Asked by At

I am getting the following error when I make calls to the Google Custom Search API:

{
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "errors": [
      {
        "message": "The caller does not have permission",
        "domain": "global",
        "reason": "forbidden"
      }
    ],
    "status": "PERMISSION_DENIED"
  }
}

I have used this API many times before, the only difference here is that I'm using a different Google cloud account & API key. I have enabled the Custom Search API in my Google Cloud project, and when I look at the usage in the Google Cloud Console, it shows 100% errors, and the chart shows all 403 errors. I also have the Places API enabled, and it is working perfectly fine. Why would I be getting this error?

I have tried setting up the OAuth Consent Screen, but I'm pretty sure that's only relevant if I'm using an OAuth Token rather than an API key, and the docs for this API only tell me how to use an API key.

1

There are 1 answers

0
David On

Be sure that Custom search API is enabled for the API key you are using?

In the GCloud console, check the restrictions here: https://console.cloud.google.com/apis/credentials?project=<YOUR_PROJECT_HERE>

The "Custom search API" should be enabled.