Stay organized with collections
Save and categorize content based on your preferences.
Secret Manager exposes a REST API and a gRPC API for using and managing secrets
directly or in your applications. This page describes how to enable the
Secret Manager API and configure your Google Cloud project to use
Secret Manager for the first time.
This step is a prerequisite for all tasks in Secret Manager, including the
quickstart.
When you are becoming familiar with Secret Manager, we recommend using a
separate Google Cloud project. Deleting the project also deletes all
resources created during testing, including billable resources.
If you are developing an application in an IDE with Cloud Code installed,
Secret Manager comes integrated into the extension. This means that you
can create, view, update, and use secrets without having to leave your IDE. For
more on using Secret Manager with Cloud Code, refer to the secret
managing guide for your preferred IDE,
VS Code,
IntelliJ,
or Cloud Shell Editor.
Before you begin
In the Google Cloud console, go to the project selector page.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
To set your Google Cloud project in the gcloud session, run the gcloud config set project
command. Replace PROJECT_ID with your Google Cloud project ID.
[[["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-28 UTC."],[],[],null,["# Enable the Secret Manager API\n\nSecret Manager exposes a REST API and a gRPC API for using and managing secrets\ndirectly or in your applications. This page describes how to enable the\nSecret Manager API and configure your Google Cloud project to use\nSecret Manager for the first time.\n\nThis step is a prerequisite for all tasks in Secret Manager, including the\n[quickstart](/secret-manager/docs/quickstart).\n\nWhen you are becoming familiar with Secret Manager, we recommend using a\nseparate Google Cloud project. Deleting the project also deletes all\nresources created during testing, including billable resources.\n\nIf you are developing an application in an IDE with [Cloud Code](https://cloud.google.com/code) installed,\nSecret Manager comes integrated into the extension. This means that you\ncan create, view, update, and use secrets without having to leave your IDE. For\nmore on using Secret Manager with Cloud Code, refer to the secret\nmanaging guide for your preferred IDE,\n[VS Code](/code/docs/vscode/secret-manager),\n[IntelliJ](/code/docs/intellij/secret-manager),\nor [Cloud Shell Editor](/code/docs/shell/secret-manager).\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, go to the project selector page.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Select or create a Google Cloud project.\n\n | **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.\n\nEnable the Secret Manager API\n-----------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Secret Manager API** page.\n\n [Go to Secret Manager API](https://console.cloud.google.com/apis/library/secretmanager.googleapis.com)\n2. Verify that the name of your project appears in the project selector at the top of the page.\n\n If you don't see the name of your project, click the project selector, and then select your project.\n3. Click **Enable**.\n\n### gcloud\n\n1. In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/how-cloud-shell-works)\n session starts and displays a command-line prompt. Cloud Shell is a shell environment\n with the Google Cloud CLI\n already installed and with values already set for\n your current project. It can take a few seconds for the session to initialize.\n2. To set your Google Cloud project in the gcloud session, run the [`gcloud config set project`](/sdk/gcloud/reference/config/set) command. Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your Google Cloud project ID. \n\n ```scdoc\n gcloud config set project PROJECT_ID\n ```\n3. To enable the Secret Manager API, run the [`gcloud services enable`](/sdk/gcloud/reference/services/enable) command: \n\n ```text\n gcloud services enable secretmanager.googleapis.com\n ```\n4. To verify that the Secret Manager API is enabled, run the [`gcloud services list`](/sdk/gcloud/reference/services/list) command: \n\n ```text\n gcloud services list --enabled\n ```\n\n Verify that the Secret Manager API is listed in the list of enabled APIs.\n\nConfigure roles and permissions\n-------------------------------\n\n\nTo get the permissions that\nyou need to set up Secret Manager,\n\nask your administrator to grant you the\n\n\n[Secret Manager Admin](/iam/docs/roles-permissions/secretmanager#secretmanager.admin) (`roles/secretmanager.admin`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nFor more information about the access control for Secret Manager, see\n[Access control with IAM](/secret-manager/docs/access-control).\n\nWhat's next\n-----------\n\n- Learn more about [authentication and access](/secret-manager/docs/authentication) to the Secret Manager API.\n- Learn more about [creating secrets](/secret-manager/docs/creating-and-accessing-secrets).\n- Learn more about [adding a secret version](/secret-manager/docs/add-secret-version)."]]