Read Google custom search JSON API simplified for more information on the API and on how to use it.
GCS unauthorized access to internal API
As the name suggests, unauthorized access to internal API is an error that comes up if you try to directly access Google’s internal API instead of using the embed code.
If you want to use Google’s custom search engine then, Google expects you to do so using the embed code. Trying to directly access the Custom Search Engine’s internal API (‘v1element’) will return an unauthorized access error.
If you wish to access Google custom search through API, then take a look at this article.