Skip to main content

Rotate a secret

Endpoint: POST /v1/vaults/{vault_id}/secret-rotate/{path}
Authentication: Bearer JWT

You can rotate in two ways:

  1. Server-generated valuePOST /v1/vaults/{vault_id}/secret-rotate/{path} with optional { "length": 32, "charset": "hex", "type": "api_key" }. Requires rotate or write permission.
  2. Client-supplied valuePUT to the same path with a new value (see Create / Update). Creates a new version while preserving history.

Server-side generation

curl -X POST "https://api.1claw.xyz/v1/vaults/$VAULT_ID/secret-rotate/api-keys/openai" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"length": 32, "charset": "alphanumeric", "type": "api_key"}'

Manual rotation (new version via PUT)

curl -X PUT "https://api.1claw.xyz/v1/vaults/$VAULT_ID/secrets/api-keys/openai" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"type":"api_key","value":"sk-proj-NEW..."}'

After rotation, optionally disable older versions with POST /v1/vaults/{vault_id}/secret-version-disable/{path}/{version}.