Google APIs Client Library for Python

API Keys

This document describes API Keys, when to use them, how to acquire them, and how to use them with the Google APIs Client Library for Python.

Introduction

When calling an API that does not access private user data, you can use a simple API key. This key is used to authenticate your application for accounting purposes. The Google APIs Console documentation also describes API keys.

Note: If you do need to access private user data, you must use OAuth 2.0.

Acquiring API keys

You can get your project's API key on the API Access pane of the Google APIs Console.

Warning: Keep your API key private. If someone obtains your key, they could use it to consume your quota or incur charges against your Google APIs Console project.

Using API keys

To use an API key, pass it to the build() function when creating a service object. The Simple API Example on the Getting Started page provides a complete example that uses API keys. Here is the relevant line from that script:

service = build('books', 'v1', developerKey=api_key)

All calls made using that service object will include your API key.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.