Google Cloud Vision API "PERMISSION_DENIED"

Binoy Mathew picture Binoy Mathew · Feb 21, 2016 · Viewed 12.7k times · Source

I am trying Google Cloud Vision API (beta) and it is returning "Permission Denied" message. But the "Cloud Vision API" is enabled for the project. Any help is appreciated.

Error Details from Google APIs Explorer

403 OK

- Show headers -

{
 "error": {
  "code": 403,
  "message": "Project has not activated the vision.googleapis.com API. Please enable the API for project google.com:apisexplorerconsole (#292824132082).",
  "status": "PERMISSION_DENIED",
  "details": [
   {
    "@type": "type.googleapis.com/google.rpc.Help",
    "links": [
     {
      "description": "Google developers console API activation",
      "url": "https://console.developers.google.com/project/292824132082/apiui/api"
     }
    ]
   }
  ]
 }
}

Answer

Simon Micollier picture Simon Micollier · Feb 21, 2016

You should start by using a CURL request instead of the API explorer or instead of your favorite programming language :

curl -v -k -s -H "Content-Type: application/json" https://vision.googleapis.com/v1/images:annotate?key=put_your_browser_secret_key_here --data-binary @put_your_req.json > result.json

{
"requests":[
{
  "image":{
    "content":"put_your_encoded_base64_image_content"
  },
  "features":[
    {
      "type":"LABEL_DETECTION",
      "maxResults":4
    }
  ]
}
]
}

as you may already know :

base64 your_image > your_encoded_base64_image_content

Hope that helps, I don't know why from API explorer there is a limitation.