---
title: "Secrets"
description: "Store API keys and credentials as encrypted, scoped environment variables for cloud computers without exposing values in chat."
url: "https://www.thecompany.company/docs/code/secrets"
---

# Secrets

> Store API keys and credentials as encrypted, scoped environment variables for cloud computers without exposing values in chat.

Store API keys, tokens, and service credentials in **Secrets** whenever code running on a cloud [computer](/docs/agent/computer) needs them. Values are encrypted at rest and injected as environment variables on the machine. Agents can see a secret's name, scope, and description, but never its stored value through the settings UI or masked form.

![The Secrets settings page with names and scopes but no saved values](https://www.thecompany.company/docs/screenshots/light/secrets-settings.webp)

Manage scoped environment variables without displaying saved values.

## Add or rotate a secret [#add-or-rotate-a-secret]

Organization owners and admins manage shared secrets in **Settings → Secrets**. Give each secret the exact variable name your code expects (for example, `REPORTING_API_TOKEN`), enter the value, and choose a scope. To rotate a credential, edit the existing secret and save the replacement.

When an agent asks for a credential during a session, enter it in the **masked secret form** rather than pasting secret values into chat messages.

| Scope | When to use it |
| --- | --- |
| **Session** | A temporary credential for the current session only (selected in the in-session masked form, not in **Settings → Secrets**). |
| **Personal** | A credential for your own sessions, not shared across the organization. |
| **Organization** | A shared credential available to sessions across the organization. |

## Group secrets [#group-secrets]

Secrets are listed in groups, with ungrouped secrets under **No group** at the end. A group only organizes the list; it never changes which sessions can use a secret.

- **File a secret:** Pick a **Group** when you create or edit a secret, or open a secret's **⋯** menu (or select several) and choose **Move to group**. Choose **New group** there to name a new one.
- **Rename or delete a group:** Open the **⋯** on the group's header. Deleting a group keeps its secrets and moves them to **No group**.
- **Change the grouping:** Use **Display → Group by** to group by scope instead, or turn grouping off.

## Keep secret values out of output [#keep-secret-values-out-of-output]

Code running on a cloud computer can read its environment variables. A test script, dependency, or shell command that dumps `env` or logs a token can expose the value in terminal output. Sharing a session also does not isolate personal credentials from code executed on that session's computer.

> Check whether `REPORTING_API_TOKEN` is set on this machine. Report only whether it is present—do not print the environment or value.

> Run the staging report using `REPORTING_API_TOKEN`, keeping the token out of commands, logs, and the final summary.

### Hygiene [#hygiene]

- **Use least privilege:** Choose the narrowest scope and grant the token only the permissions the task requires.
- **Treat exposure as burned:** If a secret appears in chat, logs, or a commit, revoke or rotate it at the provider immediately and save the replacement in **Settings → Secrets**.
- **Keep values out of descriptions and config:** Use a secret's description to help agents pick the right variable name—never put actual values in descriptions or in `.company/environment.json`.

## Next steps [#next-steps]

- [Environments](https://www.thecompany.company/docs/code/environments.md): Combine secrets with non-secret env config and setup scripts.
- [Computer](https://www.thecompany.company/docs/agent/computer.md): Understand how cloud computers isolate sessions and processes.
- [Access tokens](https://www.thecompany.company/docs/organization/access-tokens.md): Create scoped API tokens for CI and external clients.
- [Security](https://www.thecompany.company/docs/organization/security.md): Review how data, uploads, and credentials are handled.
