This page describes how to set up your local environment to experiment
with API Keys using the `curl` command.

## Before you begin

<br />

## Testing the API Keys API

1. Get the [project number](https://docs.cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects)
   for the project in which you enabled API Keys.

2. Make a request to get a list of API keys in your project:

   ```bash
   curl -X GET \
        -H "Authorization: Bearer $(gcloud auth print-access-token)" \
        'https://apikeys.googleapis.com/v2/projects/PROJECT_NUMBER/locations/global/keys'
   ```

   On success, you get a response similar to the following:

   ```json
   {
     "keys": [
       {
         "name": "projects/12345678/locations/global/keys/2885bf87-5b84-47fa-92af-08c3e9337349",
         "displayName": "API key 2",
         "createTime": "2019-05-29T22:07:22.036Z",
         "uid": "2885bf87-5b84-47fa-92af-08c3e9337349",
         "updateTime": "2019-05-29T22:07:22.058623Z",
         "restrictions": {
           "androidKeyRestrictions": {}
         },
         "etag": "zHib8eXEMCxe4ayQEbIaZg=="
       },
       {
         "name": "projects/12345678/locations/global/keys/a4db08b7-5729-4ba9-8c08-f2df493465a1",
         "displayName": "API key 1",
         "createTime": "2019-05-29T22:06:58.844Z",
         "uid": "a4db08b7-5729-4ba9-8c08-f2df493465a1",
         "updateTime": "2019-05-29T22:06:58.855103Z",
         "restrictions": {
           "androidKeyRestrictions": {}
         },
         "etag": "0L5KcPMGoNi53K5+FqPxiw=="
       }
     ]
   }
   ```

## What's next

- [Creating and managing API keys](https://docs.cloud.google.com/api-keys/docs/create-manage-api-keys)
- [Getting information about API keys](https://docs.cloud.google.com/api-keys/docs/get-info-api-keys)
- [Adding restrictions to API keys](https://docs.cloud.google.com/api-keys/docs/add-restrictions-api-keys)
- [Troubleshooting](https://docs.cloud.google.com/api-keys/docs/troubleshooting)