Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

tractorbeam secret

Manage encrypted Secret values.

tractorbeam secret <subcommand> [flags]

Shared flags

Every subcommand takes these flags.

Flag Description
--config <string> The Project’s tractorbeam.config.ts. Defaults to the one in the current directory or its nearest ancestor.
--workspace <string> Workspace name. Environment variable: TRACTORBEAM_WORKSPACE.
--origin <string> The Tractorbeam origin to call instead of the default, such as a proxy’s. Environment variable: TRACTORBEAM_ORIGIN.
--token <string> Access token. Defaults to the saved interactive session. Environment variable: TRACTORBEAM_TOKEN.

secret set

Set a Secret’s value on a Branch in a new version, the Branch’s own. On main, each Branch without its own version uses it too. The value has to match the Secret’s schema on the Branch.

tractorbeam secret set [flags] <secret>
Argument Description
<secret> Secret name.
Flag Description
--file <string> Read the JSON value from this file instead of standard input.
--branch <string> Branch name. Defaults to the Branch you last switched to, or main. Environment variable: TRACTORBEAM_BRANCH.

Examples:

# Set the stripe Secret from a JSON file
tractorbeam secret set stripe --file stripe.json

# Set it from standard input
tractorbeam secret set stripe < stripe.json

secret list

Returns each Secret the Branch’s HEAD selects, with the schema its value has to match there and whether it has a value. The response leaves out each value. Needs secrets:read; an App token can’t list Secrets.

tractorbeam secret list [flags]
Flag Description
--branch <string> Branch name. Defaults to the Branch you last switched to, or main. Environment variable: TRACTORBEAM_BRANCH.

secret delete-value

Records a deletion as a new version of the Secret’s value, the Branch’s own, as setting a value does. After that, an Action listing the Secret fails on the Branch until it has a value again. Other Branches keep their own versions; on the default Branch, each Branch without its own version loses its value too. Having the Branch use an earlier version undoes the deletion. A retried request is safe. When the Branch already uses a deletion or has no value, Tractorbeam returns 204 without recording another version. Needs Workspace authority; an App token can’t delete a Secret’s value.

tractorbeam secret delete-value [flags] <secret>
Argument Description
<secret> The name of the Secret whose value to delete.
Flag Description
--branch <string> Branch name. Defaults to the Branch you last switched to, or main. Environment variable: TRACTORBEAM_BRANCH.

secret list-versions

Returns the versions Tractorbeam keeps of the Secret’s value, newest first, each with who wrote it and when, its state, and the Branches using it as their own. The response leaves out each value. Past 100 versions, Tractorbeam drops the oldest version no Branch uses. Needs secrets:read; an App token can’t list a Secret’s versions.

tractorbeam secret list-versions [flags] <secret>
Argument Description
<secret> The Secret’s name.

secret set-branch-version

Has the Branch use a kept version of the Secret’s value as its own. Its Actions get that version until the Branch is cleared, or its value is set or deleted again; writes and deletions on other Branches leave it in place. On the default Branch, it changes the version each Branch without its own uses. Use that to roll back a write or undo a deletion. Returns 409 for a version recording a deletion. Needs Workspace authority; an App token can’t set the version a Branch uses.

tractorbeam secret set-branch-version [flags] <secret>
Argument Description
<secret> The Secret’s name.
Flag Description
--branch <string> Branch name. Defaults to the Branch you last switched to, or main. Environment variable: TRACTORBEAM_BRANCH.
--version <number> The version’s number.
--json <json> The body’s fields as one JSON object. Flags given as well override its fields.

secret clear-branch-version

Has the Branch use the default Branch’s version of the Secret again. A Branch without its own version returns 204 too. Returns 400 for the default Branch, whose version the others fall back to. Needs Workspace authority; an App token can’t clear the version a Branch uses.

tractorbeam secret clear-branch-version [flags] <secret>
Argument Description
<secret> The Secret’s name.
Flag Description
--branch <string> Branch name. Defaults to the Branch you last switched to, or main. Environment variable: TRACTORBEAM_BRANCH.