Skip to content
Secrets StoreMarkdown

Versions

Every write keeps the secret's earlier state as a numbered version, so you can read what it was and go back to it.

AvailableAPIRFC 7396

A secret is a set of named values, such as a user name and a password. Every write makes a new version of the whole set, numbered from 1, and the earlier versions stay readable. When a change goes wrong, you can read what the secret was and write it back.

  • Who: anyone with every right in the vault writes and reads: the user in their own vault, a member in a group’s vault, a realm administrator in the realm’s vault. A view grantee reads every version; a use grantee reads the latest only. No privilege is needed for your own vault.
  • Where: the API. There are no screens yet.
  • First: a realm administrator has turned the store on.

Each call is on https://foobar.cvyuh.com/api/v0/vault/managed/v1/<vault>/data/<path>, where <vault> is the vault’s address (Vaults):

ToMethodWhat happens
WritePOST with { "data": { … } }The values sent become the next version
ChangePATCH with { "data": { … } }The values sent are merged into the latest as a new version (JSON merge patch). A value sent as null is removed
Read the latestGETThe latest version’s values and metadata
Read an older oneGET with ?version=<n>That version

The first write creates the path; there is no separate create. A write answers 200 with the new version’s metadata. Values are any JSON object, nested objects included.

A path keeps a set number of versions, 10 unless the realm or the path says otherwise. The write that goes past the limit drops the oldest version for good.

Change one value of web/github in your own vault, keeping the rest (Call the API shows how to get $CVYUH_SESSION):

Terminal window
curl -X PATCH https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/data/web/github \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "data": { "password": "<new password>" } }'

Then read the version before it:

Terminal window
curl "https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/data/web/github?version=1" \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

The answer carries the values under data.data and the version’s metadata (version, created_time, deletion_time, destroyed, custom_metadata) under data.metadata.

AnswerWhenWhat to do
400, “no data provided”The body has no data objectSend { "data": { … } }
400, “is not a path”The path is empty, or has an empty, . or .. segmentUse a path such as web/github
400, check-and-setoptions.cas doesn’t match the latest version, or is required and missingSee Check-and-set
404 with metadataThe version is deleted or destroyedUndelete it, or read another version
404The path or version isn’t there, or, in a personal vault, you have no accessCheck the path and the version
404 on a PATCHThe latest version is deleted or destroyedWrite the whole secret with POST
403No right in a group’s or the realm’s vault, or a use grant asking for an older versionAsk for membership or a view grant
413The request body is larger than 2 MiBKeep secrets small; store a large file elsewhere and keep its key here
LimitDefaultRangeCan it be raised
Versions a path keeps101 to 100up to 100, per path or for the realm
One request, and so one version’s values2 MiBno
Path length, values per secret, nesting depthno fixed limit, within the 2 MiB request
Request ratethe store sets no limit of its own
SymptomCauseFix
An old version answers 404 with no metadataIt was dropped past the path’s version limitRaise max_versions before you need older history; dropped versions don’t come back
Writes answer 400 that worked yesterdayThe realm now requires check-and-setSend options.cas with each write
A PATCH answers 404The latest version is deletedUndelete it, or POST the whole secret

The first write is a CREATED change record on the secret, and each later write an UPDATED one, under the writer. Every read and write is also an ACCESS record. Values are never recorded. See Secrets audit trail.

  • A change needs a live latest version. Patching a path whose latest version is deleted or destroyed answers 404.
  • A deleted or destroyed version answers 404 with its metadata and no values, so you can still see when it was deleted, or that it was destroyed. See Delete, undelete and destroy.
  • Reading an older version needs view. Someone with a use grant reads the latest version only. See Grants.