Google Secret Manager
List Google Secret Manager metadata without reading payloads
Inventory secret resource names, labels, create times, and replication metadata while deliberately avoiding secret version access.
Documentation reviewed · 2 methods with sources
Ways to do it
API
GET /v1/projects/{project}/secrets
List secret resources and metadata for a project. This endpoint does not return secret payload bytes.
Read source: GET /v1/projects/{project}/secrets reference- Requirements
- Secret Manager API enabled, OAuth token with secretmanager.secrets.list or an equivalent read role, and the project ID.
- Limitations
- List results are paginated with nextPageToken. Secret payloads require a separate versions access call and are excluded from this workflow.
Example shell
curl --fail -H "Authorization: Bearer $GOOGLE_ACCESS_TOKEN" "https://secretmanager.googleapis.com/v1/projects/$PROJECT/secrets?pageSize=100"CLI
gcloud secrets list
List secret names and metadata through gcloud without invoking versions access.
Read source: gcloud secrets list reference- Requirements
- Google Cloud CLI, an authenticated account, Secret Manager Viewer or equivalent list permission, and a project.
- Limitations
- The command lists metadata only. Avoid commands that describe or access a version payload when the workflow is inventory-only.
Example shell
gcloud secrets list --project="$PROJECT" --limit=100 --format="table(name,createTime,labels)"