Your app's secrets (API tokens, database URLs, keys) live in Syndai, not in your repository. Open **Connections** in the portal and choose the **Environment** tab, or use [`syndai secrets`](/docs/cli#secrets-and-environments) in a terminal.

## Environments and scope

A workspace has environments, such as development, test and production. Each value belongs to one environment, and is either:

- **shared**: every project in the workspace gets it;
- **for one project**: only that project gets it, and it wins over a shared value with the same name.

## Who can read a value

Seeing a secret's **name** and reading its **value** are different things. Names are never secret. Values are only shown or handed out in the cases below, and every read is in the environment's **Activity**.

| who | names | development and test values | production values |
|---|---|---|---|
| You in the portal (owner or admin) | yes | one at a time, when you tap to reveal | one at a time, when you tap to reveal |
| You in the CLI, after a browser-approved `syndai login` | yes | yes, with `syndai secrets get`, `download` and `run` | only after you allow this computer in the browser, for 10 minutes at a time |
| A Syndai run (the coding agent in its sandbox) | yes | its own environment's values, put into the sandbox | never; a run you start on Production can *use* some of them without seeing them |
| A coding agent you connect with `syndai mcp install` | no | no | no |
| A key you paste or make on the API keys page (CI, scripts) | with `coding:secrets:read` | never | never |

What each row means in practice:

- **The portal** shows names and who changed what. A value appears only when an owner or admin taps to reveal it, and each tap is in Activity under that person.
- **The CLI** reads values only with the `coding:secrets:reveal` scope, and only a `syndai login` that a person approves in the browser grants it. A pasted key (`syndai login --with-token`), a key made in the portal and the MCP key never hold it. Production needs one more step for every command. The browser page says **Allow production values for this command** and names the key. The approval is for that command only. An agent with the same key never reads production. Each value the CLI reads is in Activity as read by **The CLI**.
- **Runs** get the values of the environment they run in (development or test). The coding agent and your app share that sandbox, so treat those values as readable by the agent. Use test accounts and test keys there. A run never reads a production value, not even one started on Production (below).
- **Coding agents on your computer** that you connect through MCP get a key without any secrets scope. They cannot list or read your secrets. An agent that types commands in your signed-in terminal can do what you can there. That is why production values need a person in the browser, again every 10 minutes.

## Runs on Production: usable, never readable

An owner or admin can start a run on **Production**. The start screen says *Uses your production keys. The agent can use them but never sees them.* A member can't choose it, and neither can an API key: starting a run on Production is a person's consent.

A Production run gets your Test values plus the production values it can use without seeing them:

- The sandbox holds a **stand-in**, not the key. `STRIPE_API_KEY` reads as zeros behind your key's own prefix (`sk_live_000…` for an `sk_live_` key, `rk_live_000…` for a restricted one), shaped like the real key so tools accept it. When a request leaves the sandbox for that service's site (for Stripe, `api.stripe.com`), Syndai's network proxy swaps the stand-in for your real key on the way out. curl, Python, Node and the provider's own CLI all work. `env`, files, logs, the run's transcript and its events only ever show the stand-in.
- **Keys Syndai knows** work this way as they are. These are the services on the Connections page, such as Stripe or Cloudflare. Two don't: Fly, because `fly deploy` hands the token to Fly's remote builder, and CapSolver, because its key travels in the request body. The Connections page says so on each.
- **Other production keys** work this way once you say where they go. Give the site the key is sent to (or a few sites), the header it travels in and its prefix, such as `Authorization` and `Bearer `. Set this on the value in the Production environment.
- **Everything else is not available to runs.** A value a tool has to read, such as a `DATABASE_URL`, or a token that a deploy hands on to someone else's builder (`fly deploy`), would only work if the agent could see it. The portal marks it *Not available to runs* with the reason; use your Test environment for it. If Test has a value with the same name, the run uses that one.
- One run can send production keys to at most 7 sites. Syndai checks this when you save a value, and the portal says which value doesn't fit.

Each Production run's start is in Activity with the names it could use and the names it could not, never a value. Runs on Production always run on Syndai's sandboxes that have this proxy, so a Production run's largest size is 16 GiB.

## Keep values out of files

`syndai run <command>` puts the values in that one command's environment and writes nothing to disk. If you need a file, `syndai secrets download -o .env.local` writes it so only you can read it (mode 0600) and warns you when git would commit it.

When a value leaks, change it at its source, then set the new value in Syndai. The next run and the next `syndai run` use it.
