canonical: https://jentic.com/apis/googleapis.com/secretmanager

# Google Secret Manager API

Google Cloud Secret Manager stores sensitive data such as API keys, passwords, certificates, and database credentials with versioning, IAM-based access control, and CMEK encryption. The API lets agents create secrets, add new versions, access specific versions, enable, disable, and destroy versions, and manage replication policies across regions. It is a managed alternative to rolling your own secret store on top of GCS or running HashiCorp Vault.

## For AI agents

Store, version, and retrieve sensitive credentials in Google Cloud with IAM-controlled access and CMEK encryption.

## Scope

Does not handle encryption-key management, certificate issuance, or runtime config files - use for storing and versioning opaque secret payloads only.

## Capabilities

- Create named secrets with replication policies (automatic, multi-region, or user-managed)
- Add new secret versions and roll back by accessing earlier versions
- Access decoded secret payloads at runtime via the access endpoint
- Disable, enable, and destroy individual secret versions for rotation workflows
- Manage IAM bindings on a secret using setIamPolicy and getIamPolicy
- List secrets and versions within a Google Cloud project or location

## Use cases

### Application Credential Storage

Replace hard-coded credentials in code, environment variables, or build pipelines with Secret Manager. Applications fetch the latest secret version at startup or on a refresh cycle, and operators rotate credentials by adding new versions without redeploying. IAM controls who or which service account can read each secret, and CMEK lets compliance teams hold the encryption keys.

Example prompt: Create a secret named 'db-password' with automatic replication, add a version with the payload bytes of the new password, and grant secretAccessor role to the app's service account.

### Automated Secret Rotation

Build a rotation pipeline that issues a new credential from the upstream system (database, third-party API), adds it as a new version of the secret, switches consumers to the new version, then disables and eventually destroys the old version. The Secret Manager API exposes versioned access plus enable, disable, and destroy actions to make this safe and auditable.

Example prompt: Add a new version to projects/myproj/secrets/api-key with the freshly issued key, then call POST on projects/myproj/secrets/api-key/versions/1:disable to retire the previous version.

### Compliance-Grade Secret Storage

Use user-managed replication and CMEK to satisfy data-residency and key-ownership requirements. Secrets can be pinned to specific GCP regions and encrypted with keys that customers control in Cloud KMS. IAM audit logs record every access, supporting SOC 2, ISO 27001, and HIPAA evidence requirements.

Example prompt: Create a secret with replication.userManaged.replicas pinned to us-central1 and europe-west1, each using a customer-managed KMS key.

### AI Agent Credential Vault

An AI agent that calls many third-party APIs uses Secret Manager as its credential vault. Through Jentic the agent never touches the raw secret payload - Jentic resolves and injects credentials at execution time. Useful for multi-tenant agent platforms where each tenant brings their own keys.

Example prompt: Call GET on projects/{project}/secrets/{secret}/versions/latest:access to retrieve the decoded payload, then use it as the bearer token for a downstream API call.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v1/{+parent}/secrets | List secrets in a project |
| POST | /v1/{+parent}/secrets | Create a new secret |
| POST | /v1/{+parent}:addVersion | Add a new version to a secret |
| GET | /v1/{+name}:access | Access a decoded secret version payload |
| POST | /v1/{+name}:disable | Disable a secret version |
| POST | /v1/{+name}:destroy | Permanently destroy a secret version |

## Key resources

- **secrets** — Create, list, update, and delete logical secrets in a project
- **versions** — Add, list, access, disable, enable, and destroy secret versions
- **iam** — Get and set IAM policies on individual secrets
- **locations** — List the regions where Secret Manager is available

## Why Jentic

- **Setup:** Wiring Google Secret Manager by hand means setting up a service account, minting OAuth access tokens against secretmanager.googleapis.com, and handling token refresh yourself. Through Jentic you install once, import the Secret Manager API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Secret Manager puts the secret name in the URL path (/v1/{name}:access, /v1/{name}:disable), so a rule can pin your agent to one secret or project: it can read the versions you name and nothing else. You choose the operations it may call, so destructive ones like disable or destroy are not included unless you add them.
- **Credential handling:** Your Secret Manager OAuth credential is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'access the latest secret version' or 'add a new secret version', and Jentic returns the matching Secret Manager operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Google Cloud KMS API** — Manages the encryption keys that protect secrets stored in Secret Manager when CMEK is enabled.
- **Google Cloud IAM API** — Controls which principals can access each secret via IAM bindings.
- **Google Cloud API Keys API** — Manages Google API keys specifically - narrower than Secret Manager, which holds any opaque secret.
- **HashiCorp Nomad API** — HashiCorp's scheduler that pairs with Vault for secrets in non-GCP environments.

## FAQ

### What authentication does the Secret Manager API use?

Secret Manager uses OAuth 2.0 with the cloud-platform scope and IAM permissions like roles/secretmanager.secretAccessor on each secret. Through Jentic the OAuth credentials and service account keys are stored encrypted in your Jentic One instance and injected at execution time.

### Can I rotate a secret without downtime using the Secret Manager API?

Yes. Add a new version to the secret, point consumers at the 'latest' alias or the new version number, then call the disable action on the older version once traffic has cut over. Destroy the old version when you no longer need to roll back.

### What are the rate limits for the Secret Manager API?

Google enforces a default per-project quota of 90,000 access requests per minute and lower limits for write operations like AddSecretVersion (around 60 per minute per secret). Quotas can be raised via the Cloud Console quota page.

### How do I retrieve a secret value at runtime through Jentic?

Run the Jentic search query 'access a secret manager secret', load the GET projects/{project}/secrets/{secret}/versions/{version}:access operation, and execute it. Jentic resolves the underlying GCP credentials so the agent only sees the decoded payload.

### Does Secret Manager support customer-managed encryption keys?

Yes. When you create a secret with user-managed replication you can specify a Cloud KMS customerManagedEncryption.kmsKeyName per replica. The key must be in the same region as the replica.

### Can I list every version of a secret with this API?

Yes. Use GET on projects/{project}/secrets/{secret}/versions to page through every version, including their state (ENABLED, DISABLED, DESTROYED) and create timestamps.

### Can I limit what my agent is allowed to do with the Secret Manager API?

Yes. Because Jentic One is self-hosted, your own rules decide which Secret Manager operations and credentials the agent may use. Secret Manager puts the secret name in the URL path, as in /v1/{name}:access and /v1/{name}:disable, so you can pin the agent to one secret or a single project and let it read only the versions you name. You also choose the operations it may call, so destructive actions like disable and destroy stay out of reach unless you explicitly grant them.
