# Set up Service Usage for a development environment

The Service Usage API lets you manage APIs and services in your
Google Cloud project. In this quickstart, you configure your
development environment to interact with the Service Usage API for testing purposes.

- For most operational use cases, the simplest way to enable and disable services is to use Google 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](https://docs.cloud.google.com/service-usage/docs/libraries.md.txt).
- To experiment with the API, follow the 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.

> [!NOTE]
> **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.

### Enable the Service Usage API

To use the Service Usage API, you must first enable it in your
Google Cloud project.

1. Ensure that your user account has been granted the [Service Usage Admin](https://docs.cloud.google.com/iam/docs/roles-permissions/serviceusage.md.txt) role.

<br />

### Test with curl

1. Set an environment variable `PROJECT_ID` with the identifier of your
   project:

       PROJECT_ID=PROJECT_ID

   Replace <var translate="no">PROJECT_ID</var> with your Google Cloud project ID or
   number.
2. Ensure that you are logged into 'gcloud':

       gcloud auth login

3. List the enabled APIs and services in this project:

       curl -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://serviceusage.googleapis.com/v1/projects/${PROJECT_ID}/services?filter=state:ENABLED&fields=services.config.title,services.config.name"

   If you see output like this, then your setup is successful:

       {
       "services": [
         {
           "config": {
             "name": "bigquery.googleapis.com",
             "title": "BigQuery API"
           }
         },
         {
           "config": {
             "name": "bigquerystorage.googleapis.com",
             "title": "BigQuery Storage API"
           }
         },
         ...

## Next steps

To list the APIs and services that are enabled or available in your
Google Cloud projects, see [List services](https://docs.cloud.google.com/service-usage/docs/list-services.md.txt).