Set up Service Usage for a development environment
This page describes how to set up your development environment to use the
Service Usage API.
For most operational use cases, the simplest way to
enable and disable services is to use Trusted Cloud console.
If you need to create
scripts, you can use the Google Cloud CLI.
If you need to
program against the Service Usage API, use one of
the client libraries.
To experiment with the API, you can follow the alternative setup instructions in this guide
and use the curl command to test the API without setting up a full application
development environment.
Set up to call the API directly
This section describes the basic steps necessary to set up your local
environment to experiment with the Service Usage API using the
curl command. It is aimed at developers who need to program against the
Service Usage API.
Enable the Service Usage API
To use the Service Usage API, you must first enable it in the
Trusted Cloud project you want to use it for:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Quickstart: Set up Service Usage for a development environment\n\nSet up Service Usage for a development environment\n==================================================\n\nThis page describes how to set up your development environment to use the\nService Usage API.\n\n- For most operational use cases, the simplest way to enable and disable services is to use Google Cloud console.\n- If you need to create scripts, you can use the Google Cloud CLI.\n- If you need to program against the Service Usage API, use one of the [client libraries](/service-usage/docs/libraries).\n- To experiment with the API, you can follow the alternative setup instructions in this guide and use the `curl` command to test the API without setting up a full application development environment.\n\nSet up to call the API directly\n-------------------------------\n\nThis section describes the basic steps necessary to set up your local\nenvironment to experiment with the Service Usage API using the\n`curl` command. It is aimed at developers who need to program against the\nService Usage API.\n| **Note:** You don't need to complete the instructions in this section if you want to list, enable, or disable services using Google Cloud console or the `gcloud` command line interface.\n\n### Enable the Service Usage API\n\nTo use the Service Usage API, you must first enable it in the\nGoogle Cloud project you want to use it for:\n\n1. Go to the Google Cloud console **API Library** page. \n [Go to the API Library page](https://console.cloud.google.com/project/_/apis/library/serviceusage.googleapis.com)\n2. Select the Google Cloud project that you want to use to access the service.\n3. On the API Library page, click **Enable**.\n4. Ensure that your user account has the [Service Usage Admin](https://cloud.google.com/iam/docs/understanding-roles#service-usage-roles) role.\n\n### Test with curl\n\n1. Define a convenient shell alias for calling Google REST APIs:\n\n alias gcurl='curl -H \"Authorization: Bearer $(gcloud auth print-access-token)\" -H \"Content-Type: application/json\"'\n\n2. Set an environment variable `PROJECT_ID` with the identifier of your\n project. This can be the project id or number:\n\n PROJECT_ID=\"my-project-id\"\n\n3. Ensure that you are logged into 'gcloud':\n\n gcloud auth login\n\n4. List the enabled APIs and services in this project:\n\n gcurl \"https://serviceusage.googleapis.com/v1/projects/${PROJECT_ID}/services?filter=state:ENABLED&fields=services.config.title,services.config.name\"\n\n If you see output like this, then your setup is successful: \n\n {\n \"services\": [\n {\n \"config\": {\n \"name\": \"bigquery.googleapis.com\",\n \"title\": \"BigQuery API\"\n }\n },\n {\n \"config\": {\n \"name\": \"bigquerystorage.googleapis.com\",\n \"title\": \"BigQuery Storage API\"\n }\n },\n ...\n\nNext steps\n----------\n\nFollow [Listing Services](/service-usage/docs/list-services) to list the APIs\nand services that are enabled or available in your Google Cloud projects."]]