A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/api-keys/docs/get-started-api-keys below:

Getting started with API Keys API | API Keys API Documentation

Skip to main content Getting started with API Keys API

Stay organized with collections Save and categorize content based on your preferences.

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

Before you begin
  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. Install the Google Cloud CLI.

  3. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  4. To initialize the gcloud CLI, run the following command:

    gcloud init
  5. Create or select a Google Cloud project.

    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the API Keys API:

    gcloud services enable apikeys.googleapis.com
  8. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/serviceusage.apiKeysAdmin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

  9. Install the Google Cloud CLI.

  10. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  11. To initialize the gcloud CLI, run the following command:

    gcloud init
  12. Create or select a Google Cloud project.

    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
  13. Verify that billing is enabled for your Google Cloud project.

  14. Enable the API Keys API:

    gcloud services enable apikeys.googleapis.com
  15. Grant roles to your user account. Run the following command once for each of the following IAM roles: roles/serviceusage.apiKeysAdmin

    gcloud projects add-iam-policy-binding PROJECT_ID --member="user:USER_IDENTIFIER" --role=ROLE

    Replace the following:

Testing the API Keys API
  1. Get the project number for the project in which you enabled API Keys.

  2. Define a convenient shell alias for calling the API:

    alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
    
  3. Make a request to get a list of API keys in your project:

    gcurl https://apikeys.googleapis.com/v2/projects/YOUR_PROJECT_NUMBER/locations/global/keys
    

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

    {
      "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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This page guides you through setting up a local environment for experimenting with API Keys using the `curl` command."],["You'll need to obtain your project number where API Keys are enabled to proceed."],["A shell alias named `gcurl` is defined to simplify API calls for ease of use."],["You will learn how to make a request to get a list of all API keys in your project, followed by a successful response example."],["The page provides links to further actions, such as creating, managing, restricting, or troubleshooting API Keys."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4