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.

Environment variables
| Endpoint | Action |
|---|---|
GET /env-var | env-var:index |
GET /env-var/:id | env-var:show |
POST /env-var | env-var:create |
PUT /env-var/:id | env-var:update |
DELETE /env-var/:id | env-var:delete |
{"key": "SITE_URL", "value": "https://blog.example.com"}Secrets
| Endpoint | Action |
|---|---|
GET /secret | secret:index |
GET /secret/:id | secret:show |
POST /secret | secret:create |
PUT /secret/:id | secret:update |
DELETE /secret/:id | secret:delete |
Secret values are encrypted with --secret-module-encryption-secret (derived from the master key when not set). The API never returns them:
{"_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.