Manage secrets
This guide walks through managing secrets throughout their lifecycle: creation, listing, version inspection, rotation, audited revealing, and deletion.
Prerequisites
- Access to a Crusoe AI Platform project.
- Project membership is required to list and inspect secrets.
- Project administrator role is required to reveal secret values or delete secrets.
Set your API environment variables:
export CAI_API="https://api.codyhill.dev"
export CAI_PROJECT="<your-project-id>"
export CAI_TOKEN="<your-api-key-or-session-token>"
1. Create a secret
Secrets are created by sending values via standard input, files, or Console UI.
- Naming Rules: 1–63 characters (letters, numbers,
-,_), starting with an alphanumeric character. - Value Limit: Up to 64 KiB per secret value.
- platformctl
- curl
- Console UI
# Pipe a secret value safely without exposing it in shell history
printf %s "$OPENAI_KEY" | platformctl secrets put openai-api-key
Or upload from a file:
platformctl secrets put tls-chain --value-file ./chain.pem
Output:
created openai-api-key at version 1
curl -s -X POST "$CAI_API/v1/projects/$CAI_PROJECT/secrets" \
-H "Authorization: Bearer $CAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"openai-api-key","value":"sk-live-1234567890"}'
Expected response (201 Created):
{
"name": "openai-api-key",
"version": 1,
"created": true
}
- Go to Security → Secrets in the Crusoe Console.
- Click Add Secret.
- Enter
openai-api-keyin the Name field and paste your key into the Value field (or click Generate Random Value). - Click Create Secret.
2. List secrets
List all secret metadata in your project. Values are never returned in list responses.
- platformctl
- curl
- Console UI
platformctl secrets list
Output:
NAME VERSION UPDATED
openai-api-key 1 2026-08-12T09:14:03Z
curl -s "$CAI_API/v1/projects/$CAI_PROJECT/secrets" \
-H "Authorization: Bearer $CAI_TOKEN"
Expected response:
{
"secrets": [
{
"name": "openai-api-key",
"current_version": 1,
"updated_at": "2026-08-12T09:14:03Z"
}
]
}
Open Security → Secrets to view all active project secrets, version numbers, and update timestamps.
3. Inspect secret metadata and history
Inspect version history and bound workloads for a secret.
- platformctl
- curl
- Console UI
platformctl secrets show openai-api-key
View version history table:
platformctl secrets versions openai-api-key
Output:
VERSION CREATED CURRENT DESTROYED
1 2026-08-12T09:14:03Z yes no
curl -s "$CAI_API/v1/projects/$CAI_PROJECT/secrets/openai-api-key" \
-H "Authorization: Bearer $CAI_TOKEN"
Click any secret in the table to view its version timeline, and its workload bindings under Referenced by. That list is read-only — a binding is a fact about a workload, so it is changed on the workload's own page, which each row's Open agent button goes to.
4. Rotate a secret
Updating a secret creates a new version while preserving older versions for bound workloads.
- platformctl
- curl
- Console UI
printf %s "$NEW_OPENAI_KEY" | platformctl secrets put openai-api-key
Output:
rotated openai-api-key at version 2
curl -s -X POST "$CAI_API/v1/projects/$CAI_PROJECT/secrets" \
-H "Authorization: Bearer $CAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"openai-api-key","value":"sk-live-NEWKEY999"}'
Expected response (200 OK):
{
"name": "openai-api-key",
"version": 2,
"created": false
}
- Open the secret details page.
- Click Rotate Secret.
- Paste the new credential value and click Save Version.
After rotating a secret, re-apply bindings on your workloads so they pick up the latest version on their next deployment or revision roll.
5. Reveal a secret value (Audited Break-Glass)
Revealing a secret value is an administrative action that logs an audit record with your identity, timestamp, and justification.
- platformctl
- curl
- Console UI
platformctl secrets reveal openai-api-key --reason "verifying key rotation"
curl -s -X POST "$CAI_API/v1/projects/$CAI_PROJECT/secrets/openai-api-key:reveal" \
-H "Authorization: Bearer $CAI_TOKEN" \
-H "Content-Type: application/json" \
-d '{"version":0,"reason":"verifying key rotation"}'
Expected response:
{
"name": "openai-api-key",
"version": 2,
"value": "sk-live-NEWKEY999"
}
- Select the secret from Security → Secrets.
- Click Reveal Value.
- Enter your justification reason and click Confirm Reveal.
6. Delete a secret
Deleting a secret permanently destroys all stored versions. Secrets cannot be deleted while actively bound to workloads.
- platformctl
- curl
- Console UI
platformctl secrets delete openai-api-key
curl -s -X DELETE "$CAI_API/v1/projects/$CAI_PROJECT/secrets/openai-api-key" \
-H "Authorization: Bearer $CAI_TOKEN"
- Open the secret details page.
- For each workload listed under Referenced by, click the row's Open agent button and unbind the variable in that workload's Secrets and environment section.
- Return to the secret and click Delete, then confirm with Delete
<name>.
While any binding remains, the delete is refused with 409 naming each <workload>.<VARIABLE> still bound. The refusal is deliberate: a binding has no foreign key to the secret, so nothing in the database would stop the delete — the failure would just resurface later, as a workload that will not start.
Next steps
- Use secrets in workloads — Bind secrets to environment variables and manage revision rolls.
- Secrets Manager Guide — Full operational reference for secrets management.