Environment variables & secrets

The modules that store configuration values and encrypted credentials for functions, and the endpoints that manage them.

Environment variables and secrets are stored once and attached to the functions that use them. For how functions read them and how placeholders work, see Functions → Env vars & secrets.

The secrets and variables page in the panel

Environment variables

EndpointAction
GET /env-varenv-var:index
GET /env-var/:idenv-var:show
POST /env-varenv-var:create
PUT /env-var/:idenv-var:update
DELETE /env-var/:idenv-var:delete
JSON
{"key": "SITE_URL", "value": "https://blog.example.com"}

Secrets

EndpointAction
GET /secretsecret:index
GET /secret/:idsecret:show
POST /secretsecret:create
PUT /secret/:idsecret:update
DELETE /secret/:idsecret:delete

Secret values are encrypted with --secret-module-encryption-secret (derived from the master key when not set). The API never returns them:

JSON
{"_id": "6b0b1a93a5611972c29c2623", "key": "STRIPE_KEY", "salt": "16745bff...", "value_hash": "f7a2bd56...", "updated_at": "2026-11-28T18:16:51.516Z"}

value_hash is a salted hash of the value, so tools can compare values without reading them.

Per-environment values

Keep the same keys in every environment and change only the values. With the CLI, values for each context are stored outside git in .spica/<context>.env, or provided as SPICA_VALUE_<KEY> environment variables in CI. See Values per environment.