IBM Cloud Docs
Deleting secrets

Deleting secrets

You can use IBM Cloud® Secrets Manager to delete a secret and its contents.

Before you begin

Before you begin, be sure that you have the required level of access. To delete secrets, you need the Manager service role.

If you have a service ID or API key that was generated by the IAM credentials secret engine and delete your instance of Secrets Manager, you must also delete the secret from IAM.

Deleting secrets in the UI

You can use the Secrets Manager UI to manually delete your secrets.

  1. In the console, click the Menu icon Menu icon > Resource List.
  2. From the list of services, select your instance of Secrets Manager.
  3. Use the Secrets table to browse the secrets in your instance.
  4. In the row for the secret that you want to delete, click the Actions menu Actions icon > Delete.
  5. Enter the name of the secret to confirm its deletion.
  6. Click Delete.

Deleting secrets from the CLI

To delete a secret, run the ibmcloud secrets-manager secret-delete command.

ibmcloud secrets-manager secret-delete --id ID

For more information about the command options, see ibmcloud secrets-manager secret.

Deleting secrets with the API

You can delete secrets by calling the Secrets Manager API.

The following example request deletes a secret and its contents. When you call the API, replace the ID variables and IAM token with the values that are specific to your Secrets Manager instance.

curl -X DELETE  
  --H "Authorization: Bearer {iam_token}" \ 
  "https://{instance_ID}.{region}.secrets-manager.appdomain.cloud/api/v2/secrets/{id}"
```{: curl}