Accessing the API

Clients can access the Cloud Key Management Service via our REST API. Thus, any language that supports sending HTTP requests can access the API. However, many users will prefer a more idiomatic client library.

In the long run, we'll want clients to use gRPC for the substantial performance improvements. However, some developers may be more familiar with the existing Google API Client Libraries. So, we currently recommend using the libraries built on our REST API.

There is also a web-based interface for Cloud KMS on the Cloud Console, which allows for key management operations. Encrypt and decrypt operations cannot be performed from the web interface.

We want to make accessing Cloud KMS a joy from every language and platform, and work on that will be ongoing. If we're falling short in any way, let us know.


How clients access the API may vary a bit depending on the platform on which the code is running, particularly with respect to authentication. Google Application Default Credentials abstract away many of the differences, but there are still some things to keep in mind.

Google Compute Engine

Software running on Compute Engine typically authenticates using credentials automatically provisioned into the environment using the default service account. The same is true for Cloud KMS. Just make sure that when you create an instance, you give it access to the (preferred because it supports the principle of least privilege) or OAuth scope.

For example:


gcloud compute instances create instance-1 --zone us-east1-b --scopes=

See the Google Compute Engine documentation for more information.

Google App Engine

App Engine is easy. Simply use the Application Default Credentials, and specify the scope (preferred because it supports the principle of least privilege) or Remember that you'll need to give your App Engine service account ( IAM permissions to manage and/or use your keys.

On-premises production environment

For your on-premises production environment, the recommended way to authenticate to a Google Cloud Platform API, including Cloud KMS, is to use a service account. To learn how to use a service account, see Getting Started with Authentication.

Client authentication

If your application needs to authenticate your users directly, you can obtain and use credentials on their behalf. To learn more, see Authenticating as an End User.

Developer workstation

Authenticating by using a service account is also recommended for your developer workstation. For information on how to use a service account, see Getting Started with Authentication.

Non-Google production environment

For a non-Google-managed environment, you'll need to:

  1. Create a service account.
  2. Download a JSON key file for that service account.
  3. Somehow provision that key file into your production environment.
  4. Load the credentials from the key file in your code.

This process is described in detail in the Google Identity documentation.

Was this page helpful? Let us know how we did:

Send feedback about...