Enabling and Disabling Services

This page describes how to enable and disable services for a Google Cloud Platform project. You can use Service Usage to enable or disable any available service for your projects, including public Google Cloud Platform services and private services created using Cloud Endpoints. For more information on the differences between public and private APIs and services, see Public and Private Services.

For most operational use cases, the simplest way to enable and disable services is to use Google Cloud Platform Console. If you need to create scripts, you can also use the gcloud command line interface. If you need to program against the Service Usage API, we recommend that you use one of our provided client libraries. To experiment with the API, you can follow the alternative instructions in this guide and use the curl command to test the API without setting up a full application development environment.

Before you begin

To enable and disable APIs and services you need:

Enabling services

console

To enable an API for a project:

  1. Go to the GCP Console API Library page.
    go to the API Library page
  2. Click Select to choose the GCP project.
  3. Click the API you want to enable. If you need help finding the API, use the search field.
  4. Click Enable.

gcloud

Run the following command to enable the Cloud Pub/Sub API service in your current project:

gcloud services enable pubsub.googleapis.com

The command produces output similar to the following:

Waiting for async operation operations/acf.2e2fcfce-8327-4984-9040-a67777082687 to complete...
Operation finished successfully.

You can use the following command to get the operation details:

gcloud services operations describe operations/acf.2e2fcfce-8327-4984-9040-a67777082687

curl

You can enable a single service using the services.enable. You can enable between 2 and 20 services in a single operation using the services.batchEnable method.

The following command enables the Cloud Pub/Sub API service in project number 357084163378:

gcurl https://serviceusage.googleapis.com/v1/projects/357084163378/services/pubsub.googleapis.com:enable

The services.enable method returns a Long Running Operation resource, which you can use to check the operation's status. You can poll for the operation status using the Service Usage operations.get method.

The following command enables both the Cloud Pub/Sub and Cloud Dataflow API services in project number 357084163378:

gcurl -d '{
"serviceIds": ["pubsub.googleapis.com", "dataflow.googleapis.com"]
}' https://serviceusage.googleapis.com/v1/projects/357084163378/services:batchEnable

The services.batchEnable method returns a Long Running Operation resource, which you can use to check the operation's status. You can poll for the operation status using the Service Usage operations.get method.

Disabling services

You can disable an API for a project at any time, although any pending fees will still be charged to your account and you'll be charged for any billable API use in your projects. For more information, see APIs and Billing.

console

To disable an API for a project:

  1. Go to the GCP Console API Dashboard page.
    go to the API Dashboard page
  2. Click Select to choose the GCP project.
  3. Next to the API you want to disable, click Disable.

gcloud

Run the following command to disable the Cloud Pub/Sub API service for your current project:

gcloud services disable pubsub.googleapis.com

The command produces output similar to the following:

Waiting for async operation operations/acf.e9d0943b-55d9-4ac0-8af4-745e1b8983f8 to complete...
Operation finished successfully.

You can use the following command to get the operation details:

gcloud services operations describe operations/acf.e9d0943b-55d9-4ac0-8af4-745e1b8983f8

curl

The following command disables the Cloud Pub/Sub API service in project number 357084163378:

gcurl https://serviceusage.googleapis.com/v1/projects/357084163378/services/pubsub.googleapis.com:disable

The services.disable method returns a Long Running Operation resource, which you can use to check the operation's status. You can poll for the operation status using the Service Usage operations.get method.

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

Send feedback about...

Service Usage Documentation