Cookbook
Short, copy-pasteable recipes for things you'll do often. Each entry has a one-line scenario and the code that does it. For deeper explanations, follow the cross-links.
Reading#
Read one secret and use a single field#
python
1 2 3 4 | |
Read many secrets at startup#
python
1 2 3 4 5 6 7 | |
See Batch Operations.
Read with retry on transient failure#
python
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Read a specific version#
bash
1 2 | |
Check whether a secret exists without reading it#
python
1 2 3 4 5 | |
read_metadata returns version count, tags, rotation status — but not the value, and only requires secrets:list not secrets:read.
Writing#
Idempotent write of initial value#
python
1 2 3 4 5 | |
Update one field without overwriting others#
ScaiVault doesn't have field-level update. Read, mutate, write:
python
1 2 3 | |
Write a JSON blob from a file#
bash
1 2 3 | |
Write with expiration#
python
1 2 3 4 5 | |
Rotation#
Force rotation now#
bash
1 2 3 4 | |
List secrets due for rotation in the next week#
bash
1 2 3 | |
Find secrets that missed their rotation window#
bash
1 2 3 | |
Subscribe to rotation events on production secrets#
bash
1 2 3 4 5 6 7 8 9 10 | |
Policies and access#
Grant a service account read access to one path#
bash
1 2 3 4 5 6 7 8 9 10 11 12 | |
Test whether an identity can read a path#
bash
1 2 3 4 5 6 7 8 | |
List who has access to a path#
ScaiVault doesn't have a direct "who can read X" endpoint, but you can list all policies and filter:
bash
1 2 | |
(Glob-pattern matching in jq is rough; for production use the SDK's policies.list_for_path().)
PKI#
Issue a 7-day mTLS cert#
bash
1 2 3 4 | |
Renew a cert ahead of schedule#
bash
1 2 | |
Validate a cert chain a client gave you#
bash
1 2 3 4 5 6 7 8 | |
List certs expiring in 30 days#
bash
1 2 3 | |
Revoke a cert#
bash
1 2 3 4 | |
Dynamic credentials#
One-shot Postgres credential for a script#
python
1 2 3 | |
AWS IAM credentials for a deploy job#
bash
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Emergency revoke all leases from an engine#
bash
1 2 3 4 | |
Audit#
Who read this secret in the last 24 hours?#
bash
1 2 3 | |
Find every action by an ex-employee#
bash
1 2 | |
Then rotate everything in the response's summary.resources_accessed.
Export last month for compliance#
bash
1 2 3 4 5 6 7 8 9 | |
Health and observability#
Smoke test the API#
bash
1 | |
Detailed component health#
bash
1 2 | |
Confirm a token works and see its identity#
bash
1 2 | |
Find your own rate-limit headroom#
bash
1 2 3 4 5 6 | |
Federation#
Read from HashiCorp Vault via ScaiVault#
(Assumes federation backend already configured.)
bash
1 2 3 4 | |
Trigger an immediate sync#
bash
1 2 | |
Cleanup and migration#
Soft-delete then restore#
bash
1 2 3 4 5 | |
Bulk-tag secrets matching a pattern#
python
1 2 3 4 5 6 | |
Find unused secrets (30-day baseline)#
bash
1 2 3 | |
What's next#
- Managing Secrets — full secret API.
- Tutorials — longer scenarios that use these recipes.
- Reference — every endpoint.