Secrets and Environment Files
Store the secrets your deployed app and database functions read, keep local secrets in env files, and set the variables the CLI reads.
Your deployed app needs API keys and other secret values. Cofounder stores them and delivers them to your app. Secrets your own machine needs (to run the app locally, or to reach Cofounder) stay in local env files and environment variables.
Set App Secrets
App secrets are the values your deployed app reads: third-party API keys, webhook secrets, anything that would sit in a production env file.
| MCP | CLI | API |
|---|---|---|
secrets set prompts for the value or reads it from --stdin, so the value
never lands in your shell history. secrets list shows key names and
details only. Values can't be read back.
To keep a value out of the chat, enter it yourself on the company's
Secrets page, using the App, Marketing, Development, or Sandbox destination from
company_get. Your agent can then check key names and setup with
secrets_list.
Saving a value doesn't check a running deployment. Running apps and sandbox processes can keep using the old value after you change or delete it.
Calling the API Directly
Send an authenticated bearer token and X-Organization-Id with every
request. Writes need a destinations list:
appandmarketingeach update production and staging and try to redeploy.developmentupdates the Vercel Development environment.sandboxstores a separate development value for new sandbox commands.- Destinations you leave out keep their current value.
| Method and path | Request | Response |
|---|---|---|
| A array with per-key write receipts | ||
| No body | A array containing metadata, never values | |
| No body | after all tracked copies are removed |
Have your secret source write the JSON request to a protected file, then send that file so the value stays out of shell history:
curl --fail-with-body https://api.cofounder.co/cofounder-cli/v1/secrets \
-H "Authorization: Bearer $COFOUNDER_API_TOKEN" \
-H "X-Organization-Id: $COFOUNDER_COMPANY_ID" \
-H 'Content-Type: application/json' \
--data-binary @/secure/path/secret-request.jsonThe request has to follow these rules:
- Use HTTPS for remote endpoints.
- Names are uppercased, with hyphens turned into underscores. Names starting
with
COFOUNDER_, such asCOFOUNDER_API_TOKEN, are allowed. - Destinations must be non-empty with no repeats.
Check the Result and Recover
An HTTP 200 doesn't mean every write saved, so check each POST result:
- Success:
success: true,error_code: null, andwritesentries withdestination,scope, andstatus: "saved". - Partial:
success: false,error_code: "write_incomplete", listing which scopes saved and which are unknown. resources_unavailable: fix the destination's setup before writing.- Invalid requests return a redacted 422 response.
The CLI exits 1 for partial or unknown outcomes and doesn't retry on its own. To recover, send the same value again. That can trigger another redeploy. HTTP retries should keep the same destinations. If a delete fails, retry it to remove the remaining copies. If a response is lost, the metadata can't tell you whether the write landed.
Set Sandbox Secrets
Choose Sandbox on the Secrets page, or supply the value through stdin.
cofounder secrets set DATABASE_URL --destination sandbox --stdin < /secure/path/dev-database-urlSandbox uses one set per company. New commands and their child processes receive those values automatically. The same key can hold a different value in App, Marketing, or Vercel Development. Missing Sandbox values stay absent.
Managed Stripe test setup saves its test API keys, current test webhook secret, and billing flags to Sandbox automatically. Managed test product and price IDs are saved there when created. Live Stripe setup leaves Sandbox values unchanged.
Cofounder configures Vercel's native credential file and project link when a
sandbox is created, restored from a snapshot, or resumed. With managed Vercel
hosting set up, vercel env pull works without a token argument. Ordinary Run
calls leave those credentials unchanged. Tokens can expire during uninterrupted
use; create a new sandbox or resume a paused one to get fresh credentials.
If Git or Library authentication fails in a running sandbox, pass
refresh_credentials: true to sandbox_terminal_commands_run or add
--refresh-credentials to cofounder sandbox terminal-commands run.
Other managed services still need their own development credentials; deployed app values are not copied into Sandbox automatically.
secrets_list reports sandbox_available: true only when a separate Sandbox
value is saved for that key.
Environment variables passed in a sandbox Run override Sandbox variables with the same names. Updates and deletions apply to new processes. Restart running apps to use them. Code in the sandbox can read injected values, and snapshots can retain values an app keeps in memory or writes to files.
Delete only the Sandbox value with cofounder secrets delete DATABASE_URL --destination sandbox. Omit --destination to remove the key everywhere.
Set Database Secrets
Edge functions on the managed Supabase project have their own secret store:
| MCP | CLI | API |
|---|---|---|
Keep Local Secrets in Env Files
Secrets for the app running on your machine stay out of Cofounder. Keep them
in the repo's gitignored env file (.env.local, .env) and never commit
them. Anything the deployed app needs belongs in secrets instead.
CLI Environment Variables
| Variable | Controls |
|---|---|
| Bearer token or injected network-secret placeholder for CLI and REST API requests; when it holds a company API key ( or a placeholder), configures MCP clients to send it as their bearer credential | |
| Use for an opaque network-secret placeholder | |
| Selects the CLI company; for a fixed API key, the server rejects a different company | |
| API base URL override | |
| Where the CLI stores credentials (default ) | |
| Opts a dev-environment CLI into telemetry; reporting cannot be switched off |
Export them in your environment. The CLI never reads repo env files for its own credentials.
To run more than one company, see Multiple Companies.