When calling APIs that do not access private user data, you can use simple API keys. These keys are used to authenticate your application for accounting purposes. The Google API Console documentation also describes API keys.
Note: If you do need to access private user data, you must use OAuth 2.0. See Using OAuth 2.0 for Web Server Applications, Using OAuth 2.0 for Installed Applications, and Using OAuth 2.0 for Server to Server Applications for more information.
Acquiring API keys
- Open the Credentials page in the API Console.
- Click Create credentials > API key and select the appropriate key type.
To keep your API keys secure, follow the best practices for securely using API keys.
Using API keys
To use API keys, pass them to the
function when creating service objects. For example:
books_service = build('books', 'v1', developerKey='api_key')
All calls made using that service object will include your API key.