SecretService
Manage project secrets.
SecretService manages project-scoped secrets: named values stored encrypted, attached to sandboxes by name at creation. The sandbox only ever receives an opaque per-sandbox placeholder as an environment variable — the platform's egress proxy substitutes the real value into outbound requests, so the real value never enters the sandbox and is never returned by the API (values are write-only). Obtain the service as daytona.secret. See the secrets guide.
set()
Creates a secret, or updates an existing one's value and metadata (upsert by name).
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | — | Secret name (referenced from secrets=[...] at sandbox creation). |
value | str | — | The secret value. Write-only — never returned by any API. |
allowed_domains | List[str] | None | Restrict substitution to these hosts (exact or *. wildcard). Empty/omitted allows any verified upstream. |
description | str | None | Human-readable description. |
get()
Fetches one secret's metadata — name, allowed domains, description, last-update time. Never the value.
Raises: DaytonaNotFoundError if the secret does not exist.
list()
Lists secret metadata for the project. Never returns values.
Returns: a list of metadata dicts (name, allowed_domains, description, updated_at).
delete()
Deletes a secret. Already-running sandboxes that attached it are unaffected.
Attaching secrets to a sandbox
Pass secret names in secrets at creation. Each becomes an environment variable inside the sandbox whose value is an opaque placeholder; outbound requests to permitted hosts have the placeholder replaced with the real value in transit.
See environment and secrets for placeholder semantics and naming rules.