Using API Keys  |  API Gateway Documentation  |  Google Cloud (2024)

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

This page describes how to utilize API keys in API Gateway.

An API key is a simple string that identifies aGoogle Cloud project for quota, billing, and monitoring purposes. Adeveloper generates an API key in a project in the Google Cloud console andembeds that key in every call to your API as a query parameter or in a request header.

If you specify an API key requirement in your API config,API Gateway uses the API key to look up the associated Google Cloud project. API Gateway rejects requests unlessthe API key was generated in your Google Cloud project or within otherGoogle Cloud projects in which your API has been enabled.

To create an API key, or view API keys already available within your Google Cloud project, go to the APIs & Services > Credentials page.

Go to Credentials

Use case

To use API Gateway features such asquotas, you can pass in an APIkey so that API Gateway can identify the Google Cloud projectthat the client application is associated with.

About API key authentication for API Gateway

If you are using an API key for authentication, you must first enable API key supportfor your service.

Enter the following command:

gcloud services enable MANAGED_SERVICE_NAME

The MANAGED_SERVICE_NAME specifies the name of the managed service created when you deployed the API. You can find this name in the Managed Service column for your API on the APIs landing page in the console. Alternatively, you can find this name in the Managed service property when using the gcloud api-gateway apis describe command.

For example:

gcloud services enable my-api-a12bcd345e67f89g0h.apigateway.my-project.cloud.goog

Restricting API keys

API keys are unrestricted by default. Unrestricted keys are insecure becausethey can be used by anyone from anywhere. We recommend that you add API restrictions where possible.API restrictions specify which APIs can be called using the API key. All API keys used by production applications should have API restrictions.

To add API restrictions:

  1. Find the title of the API as noted in your API Config. In the following example, the API title is My Example Config:

    # openapi.yamlswagger: '2.0'info: title: My Example Config description: Sample API on API Gateway version: 1.0.0...
  2. In the Google Cloud console, go to the APIs & Services > Credentials page.

    Go to Credentials

  3. Select the name of the API key you wish to use for your API.

  4. In the API restrictions section of the API key detail page, click Restrict key.

  5. Select the API that your API key will be used to access from the dropdown list of available APIs. For example, ifusing the example config above, select My Example Config.

  6. Click Save.

Your restriction should take effect momentarily.

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 2024-09-10 UTC.

Using API Keys  |  API Gateway Documentation  |  Google Cloud (2024)
Top Articles
What is a Crypto Trading Bots and How Do They Work?
Should I leave the Heating on when I go away?
Skyward Sinton
Places 5 Hours Away From Me
Patreon, reimagined — a better future for creators and fans
Brady Hughes Justified
Craigslist Benton Harbor Michigan
Comforting Nectar Bee Swarm
Crocodile Tears - Quest
Cumberland Maryland Craigslist
سریال رویای شیرین جوانی قسمت 338
2022 Apple Trade P36
Xrarse
Help with Choosing Parts
Best Food Near Detroit Airport
Colorado mayor, police respond to Trump's claims that Venezuelan gang is 'taking over'
History of Osceola County
Convert 2024.33 Usd
Uktulut Pier Ritual Site
iZurvive DayZ & ARMA Map
Trivago Sf
Vigoro Mulch Safe For Dogs
Metro Pcs.near Me
Our History
Toyota Camry Hybrid Long Term Review: A Big Luxury Sedan With Hatchback Efficiency
67-72 Chevy Truck Parts Craigslist
Where to eat: the 50 best restaurants in Freiburg im Breisgau
Dragonvale Valor Dragon
Wics News Springfield Il
Manuela Qm Only
Mynahealthcare Login
Pixel Combat Unblocked
Craigslist Gigs Norfolk
Dumb Money, la recensione: Paul Dano e quel film biografico sul caso GameStop
Imperialism Flocabulary Quiz Answers
The Boogeyman Showtimes Near Surf Cinemas
Wsbtv Fish And Game Report
How To Upgrade Stamina In Blox Fruits
manhattan cars & trucks - by owner - craigslist
Immobiliare di Felice| Appartamento | Appartamento in vendita Porto San
Below Five Store Near Me
11 Best Hotels in Cologne (Köln), Germany in 2024 - My Germany Vacation
The Attleboro Sun Chronicle Obituaries
Kutty Movie Net
Mitchell Kronish Obituary
Arch Aplin Iii Felony
Conan Exiles Colored Crystal
Identogo Manahawkin
Runescape Death Guard
What Does the Death Card Mean in Tarot?
Lira Galore Age, Wikipedia, Height, Husband, Boyfriend, Family, Biography, Net Worth
Edict Of Force Poe
Latest Posts
Article information

Author: Msgr. Benton Quitzon

Last Updated:

Views: 5989

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Msgr. Benton Quitzon

Birthday: 2001-08-13

Address: 96487 Kris Cliff, Teresiafurt, WI 95201

Phone: +9418513585781

Job: Senior Designer

Hobby: Calligraphy, Rowing, Vacation, Geocaching, Web surfing, Electronics, Electronics

Introduction: My name is Msgr. Benton Quitzon, I am a comfortable, charming, thankful, happy, adventurous, handsome, precious person who loves writing and wants to share my knowledge and understanding with you.