# Secrets

> A secret is a set of named values under a path, versioned on every write, with its own settings and labels, found by browsing its vault.

A secret is a set of named values, such as a user name and a password, kept under a path you choose, such as
`web/github`. Every write keeps the earlier state as a numbered version, so you can read what a secret was and go
back to it. You decide how much history a secret keeps, make writers name the version they replace, browse a vault by
folder, and choose how final each deletion is.

| Capability | What it gives you |
|---|---|
| [Versions](/secrets-store/secrets/versions/) | Every write a new numbered version; read or merge into any of them |
| [Check-and-set](/secrets-store/secrets/check-and-set/) | A write names the version it replaces, so no change is silently lost |
| [Metadata](/secrets-store/secrets/metadata/) | A secret's history, its own settings and your labels, without its values |
| [Subkeys](/secrets-store/secrets/subkeys/) | The names inside a secret, without opening its values |
| [Listing](/secrets-store/secrets/listing/) | Browse a vault one folder at a time (with limits) |
| [Delete, undelete and destroy](/secrets-store/secrets/delete-and-destroy/) | Take a version back softly, bring it back, or remove it for good |

## How it works

Every operation on a secret is addressed as `<vault>/<operation>/<path>` under
`https://foobar.cvyuh.com/api/v0/vault/managed/v1`, where `<vault>` is `me`, `user/<user id>`, `group/<group id>` or
`realm` (see [Vaults](/secrets-store/vaults/)):

| Operation | What it reaches |
|---|---|
| `data` | the values, by version: read, write, merge, delete the latest |
| `metadata` | the version map, settings and labels; listing; deleting the whole secret |
| `subkeys` | the names inside a version |
| `delete`, `undelete`, `destroy` | chosen versions |
| `grants`, `share` | who else reaches it: see [Sharing](/secrets-store/sharing/) |

For example, reading the latest version of `web/github` in your own vault ([Call the API](/develop/api/) shows how to
get `$CVYUH_SESSION`):

```sh
curl https://foobar.cvyuh.com/api/v0/vault/managed/v1/me/data/web/github \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
```

## Good to know

- **Paths are names, not files.** A path can't be empty or hold an empty, `.` or `..` segment. The same path in two
  vaults is two separate secrets.
- **Paths and values are sealed.** The store keeps each value, label and path sealed for the vault's owner; see
  [Sealing per owner](/secrets-store/keys-and-protection/sealing/). A request's address names its path, and each
  request is recorded, so choose paths that don't give a secret away.
- **One request carries at most 2 MiB.** That bounds one version's values and labels; the store sets no other size,
  count or rate limit of its own.
- **Every secret follows the realm's defaults** for history and check-and-set unless it sets its own: see
  [Realm settings](/secrets-store/realm-settings/).

## Coming next

A listing that always includes the path just written: see
[What's next for secrets](/secrets-store/secrets/whats-next/).

## Related

- [Store a secret](/secrets-store/guides/store-a-secret/): write and read your first secret.
- [Organize and find secrets](/secrets-store/guides/organize-and-find-secrets/): folders, listing and subkeys.
- [Take back a change](/secrets-store/guides/take-back-a-change/): delete, undelete or destroy a version.
