docs/versioned_docs/version-0.16.3/api/secrets.mdx
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Dagger has first-class support for "secrets", such as passwords, API keys, SSH keys and so on. These secrets can be securely used in Dagger functions without exposing them in plaintext logs, writing them into the filesystem of containers you're building, or inserting them into the cache.
Here is an example, which uses a secret in a Dagger function chain:
<Tabs groupId="language"> <TabItem value="Dagger CLI"> ```shell export API_TOKEN="guessme"dagger core container
from --address=alpine:latest
with-secret-variable --name="MY_SECRET" --secret="env://API_TOKEN"
with-exec --args="sh","-c",'echo this is the secret: $MY_SECRET'
stdout
</TabItem>
<TabItem value="Go">
```go file=./snippets/secrets/go/main.go
Secret arguments can be sourced from multiple providers: the host environment, the host filesystem, the result of host command execution, and external secret managers 1Password and Vault.