Skip to content
Secrets StoreMarkdown

Delete, undelete and destroy

Take a version back softly, bring it back, or remove its values for good, one version or the whole secret.

AvailableAPI

You choose how final each step is. A delete hides a version but keeps its values, so you can undelete it if you were wrong. A destroy removes a version’s values for good. Deleting the whole secret destroys every version and frees the path to start again.

  • Who: anyone with every right in the vault: the user in their own vault, a member in a group’s, a realm administrator in the realm’s. Grantees can’t delete.
  • Where: the API. There are no screens yet.
  • First: know the versions: read the secret’s metadata.

Each call is under https://foobar.cvyuh.com/api/v0/vault/managed/v1/<vault>:

ToCallCan it be undone?
Delete the latest versionDELETE …/data/<path>Yes, by undelete
Delete some versionsPOST …/delete/<path> with { "versions": [1, 2] }Yes, by undelete
Undelete versionsPOST …/undelete/<path> with { "versions": [1, 2] }—
Destroy versionsPOST …/destroy/<path> with { "versions": [1] }No
Delete the whole secretDELETE …/metadata/<path>No

Each answers 204. Reading a deleted or destroyed version answers 404 with its metadata, so you can see when it was deleted or that it was destroyed.

Destroy version 1 of web/github for good (Call the API shows how to get $CVYUH_SESSION):

Terminal window
curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/destroy/web/github \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "versions": [1] }'

To have versions delete themselves after a time, set delete_version_after on the path, or managed.deleteVersionAfter for the realm. Each version then reads as deleted that long after it was written, and can be undeleted like any other. See Metadata and Realm settings.

No one is told of a delete. A grantee reading a deleted or destroyed version gets 404, as the owner does, and a use grantee reading a secret whose latest version is deleted gets nothing until it is undeleted or written again.

AnswerWhenWhat to do
400, “no versions provided”The body has no versions listSend { "versions": [<n>, …] }
400, “a version is a positive integer”A version isn’t a whole numberSend version numbers
404The path isn’t there, or, in a personal vault, you have no accessCheck the path
403A grantee, or no right in a group’s or the realm’s vaultAsk someone with the vault’s right
LimitValue
Undo a deleteany time, until the version is destroyed or dropped past the version limit
Undo a destroy, or a whole-secret deletenone
Automatic deletionoff (0) unless the path or the realm sets delete_version_after; up to ten years
SymptomCauseFix
Undelete does nothingThe version was destroyed, or dropped past the version limitNothing brings it back; write the value again if you have it
Versions read as deleted that no one deleteddelete_version_after is set on the path or the realmUndelete them, and change the setting
The secret’s path is still listedIts versions are deleted but its metadata remainsDelete the whole secret

Each delete, undelete and destroy, and a whole-secret delete, is an UPDATED change record on the secret, under who made it. See Secrets audit trail.

  • A destroyed version never comes back. Undeleting it does nothing.
  • A version number the path doesn’t hold is passed over, not refused.
  • After the whole secret is deleted, the path reads as absent, its settings and labels are cleared, and the next write starts again at version 1.
  • Destroyed values leave database backups only as the backups expire. They are gone from the live store at once. To make them unreadable everywhere at once, see Crypto-shredding.