Lorsqu'une API associée à un projetGoogle Cloud auquel vous n'avez pas accès requiert une clé API, vous disposez des options suivantes pour l'obtenir :
Option 1 : demandez à un administrateur de sécurité de créer une clé API pour vous.
Option 2 : demandez à un administrateur de sécurité de vous accorder l'accès au projet afin que vous puissiez créer une clé API dans le projet auquel l'API est associée.
Option 3 : demandez à un administrateur de sécurité de vous autoriser à activer l'API dans votre propre projet Google Cloud , afin que vous puissiez créer une clé API.
Si vous avez opté pour l'option 3 et que vous avez demandé à quelqu'un de vous accorder un accès permettant d'activer l'API, suivez les étapes ci-dessous pour activer l'API dans votre propre projet Google Cloud.
Pour activer une API :
Console
Dans la console Google Cloud , accédez à "API et services" pour votre projet.
Dans la page Bibliothèque, cliquez sur API privées. Si l'API ne figure pas dans la liste, cela signifie que l'accès à cette API ne vous a pas été accordé.
Cliquez sur l'API que vous souhaitez activer. Si vous avez besoin d'aide pour trouver cette API, utilisez le champ de recherche.
Dans la page qui affiche les informations relatives à l'API, cliquez sur Activer.
gcloud
Saisissez la commande suivante pour afficher les ID de vos projetsGoogle Cloud :
gcloud projects list
En utilisant l'ID de projet applicable déterminé à l'étape précédente, définissez le projet dans lequel vous souhaitez activer l'API comme projet par défaut :
gcloud config set project YOUR_PROJECT_ID
Obtenez la liste des services que vous pouvez activer dans votre projet, en utilisant la commande suivante :
gcloud services list --available
Si l'API ne figure pas dans la liste, cela signifie que l'accès à cette API ne vous a pas été accordé.
En utilisant le nom de service applicable déterminé à l'étape précédente, activez le service :
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis content outlines options for obtaining an API key when the API is associated with a Google Cloud project you lack direct access to.\u003c/p\u003e\n"],["\u003cp\u003eThere are three main options for getting an API key: requesting a security admin to create one, gaining project access to create one yourself, or gaining access to enable the API in your own project.\u003c/p\u003e\n"],["\u003cp\u003eIf you choose to enable the API in your own Google Cloud project, you can do so through the Google Cloud console or by using \u003ccode\u003egcloud\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eIf you cannot find the API in either the Console's Private API list or the \u003ccode\u003egcloud services list --available\u003c/code\u003e output, it means you have not been granted the necessary access.\u003c/p\u003e\n"]]],[],null,["# Enabling an API in your Google Cloud project\n\nOpenAPI \\| [gRPC](/endpoints/docs/grpc/enable-api \"View this page for the Cloud Endpoints gRPC docs\")\n\n\u003cbr /\u003e\n\nWhen an API requires an API key and the API is associated with a\nGoogle Cloud project that you don't have access to, you have the\nfollowing options to obtain an API key:\n\n- **Option 1**: Ask a security admin to create an API key for you.\n\n- **Option 2** : Ask a security admin to\n [grant you access to the project](/endpoints/docs/openapi/control-api-access)\n so that you can create an API key in the same project that the API is\n associated with.\n\n- **Option 3** : Ask a security admin to\n [grant you access to enable the API](/endpoints/docs/openapi/control-api-callers)\n in your own Google Cloud project so that you can create an API key.\n\nBefore you begin\n----------------\n\n[Make sure that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\nEnabling an API\n---------------\n\nIf you used option 3 and asked someone to grant you access to enable the\nAPI, follow the steps below to enable the API in your own Google Cloud\nproject.\n\nTo enable an API: \n\n### Console\n\n1. In the Google Cloud console, go to APIs \\& services for your project. [Go to APIs \\& Services](https://console.cloud.google.com/apis)\n\n2. On the **Library** page, click **Private APIs**. If you don't see the API listed, that means you haven't been granted access to enable the API.\n3. Click the API you want to enable. If you need help finding the API, use the search field.\n4. In the page that displays information about the API, click **Enable**.\n\n### gcloud\n\n1. Enter the following to display the project IDs for your\n Google Cloud projects:\n\n gcloud projects list\n\n2. Using the applicable project ID from the previous step, set the default\n project to the one in which you want to enable the API:\n\n ```\n gcloud config set project YOUR_PROJECT_ID\n ```\n3. Get a list of services that you can enable in your project:\n\n gcloud services list --available\n\n If you don't see the API listed, that means you haven't been granted\n access to enable the API.\n4. Using the applicable service name from the previous step, enable the\n service:\n\n ```\n gcloud services enable SERVICE_NAME\n ```\n\nFor more information on the preceding commands, see the\n[`gcloud` reference](/sdk/gcloud/reference)."]]