Docs
BlogHomeStart building

Secrets, Keys & .env

Environment variables, project keys and the .env file.


Secrets are environment variables the app reads on the server (process.env.STRIPE_KEY): values are write-only and never returned. Project API keys (tlm_pk_…) let your own servers call the project's database, files and built-in features. They are not your account key (tlm_sk_…).

#Create Secret

POST/api/v1/vcaas/projects/:projectId/secretsapi-keyFree

Add an environment variable. It reaches the preview and the agent at once and the published site at the next publish. The agent never asks for a key in its reply text: when the app needs one, its message carries secretKeysNeeded (Get Agent Status). Let your user choose the environment, add each name here, then prompt again ("the keys are saved, carry on").

Path parameters

ParameterTypeDescription
projectIdstringThe project id

Body parameters

FieldTypeRequiredDescription
secretNamestringYesUppercase letters, digits and _, starting with a letter. Names starting with TOTALUM_ (except TOTALUM_VCAAS_API_KEY) and NODE_ENV, NEXT_PUBLIC_APP_URL, BETTER_AUTH_SECRET, NEXT_SERVER_ACTIONS_ENCRYPTION_KEY, TURSO_AUTH_TOKEN, TURSO_DATABASE_URL are reserved
secretValuestringYes1–10,000 characters
environmentstringNo"development" (preview), "production" (published site) or "both" (default)

Response fields

FieldTypeDescription
data._idstringSecret id (to delete it)
data.secretNamestringName
data.environmentstringEnvironment
data.createdAtstringISO 8601

Example request

curl -X POST \
  -H "api-key: tlm_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"secretName":"OPENWEATHER_KEY","secretValue":"abc123","environment":"both"}' \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/secrets
Success · 200 OK
json
{ "errors": null, "data": { "_id": "sec_01k6xy", "secretName": "OPENWEATHER_KEY", "environment": "both", "createdAt": "2026-10-08T12:00:00.000Z" } }
Validation error · 400
json
{ "errors": { "errorCode": "VALIDATION_ERROR", "errorMessage": "secretName: Secret name must be uppercase, separated by underscores, cannot start with a number, and can only contain letters, numbers, and underscores", "errorDetails": { "errors": [{ "value": "openweather", "msg": "Secret name must be uppercase, separated by underscores, cannot start with a number, and can only contain letters, numbers, and underscores", "param": "secretName", "location": "body" }] } }, "data": null }

Error codes

CodeHTTPMeaning
MISSING_SECRET_FIELDS400secretName or secretValue is missing
VALIDATION_ERROR400The name, value or environment is invalid; errorDetails.errors lists each field
SECRET_CREATE_FAILED400A secret with this name already exists in that environment
RESERVED_SECRET_NAME400The name is reserved
SECRET_LIMIT_EXCEEDED400The project already has 500 secrets

#Delete Secret

DELETE/api/v1/vcaas/projects/:projectId/secrets/:secretIdapi-keyFree

Remove an environment variable. The names and ids of a project's secrets are in Get Project (secrets[]).

Path parameters

ParameterTypeDescription
projectIdstringThe project id
secretIdstringThe secret's _id

Response fields

FieldTypeDescription
data.successbooleantrue

Example request

curl -X DELETE -H "api-key: tlm_sk_your_key" \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/secrets/sec_01k6xy
Success · 200 OK
json
{ "errors": null, "data": { "success": true } }

#List Project Keys

GET/api/v1/vcaas/projects/:projectId/api-keysapi-keyFree

The project's own API keys, revoked ones included (secrets are never listed). Two are managed by Totalum: managed: "app" runs the app itself, managed: "env" is the key in the downloaded .env; rotate them, never revoke them.

Path parameters

ParameterTypeDescription
projectIdstringThe project id

Response fields

FieldTypeDescription
data.keys[].idstringKey id
data.keys[].namestringName
data.keys[].prefixstringThe visible start of the key
data.keys[].scopesstring[]Scopes
data.keys[].envstring"dev", "live" or "both"
data.keys[].createdAtstring | nullISO 8601
data.keys[].expiresAtstring | nullExpiry
data.keys[].revokedAtstring | nullWhen it was revoked
data.keys[].managedstring | undefined"app" or "env" for Totalum's own keys

Example request

curl -H "api-key: tlm_sk_your_key" \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/api-keys
Success · 200 OK
json
{ "errors": null, "data": { "keys": [{ "id": "key_01k6xz", "name": "backend", "prefix": "tlm_pk_a1b2", "scopes": ["db:read", "db:write"], "env": "both", "createdAt": "2026-10-08T12:00:00.000Z", "expiresAt": null, "revokedAt": null }] } }

#Create Project API Key

POST/api/v1/vcaas/projects/:projectId/api-keysapi-keyFree

Create a tlm_pk_ key for calling this project's database, files and built-in features from your servers (with totalum-sdk or HTTP). It works only on this project and only for its scopes. The secret is returned once. Owner (or a member allowed to manage API keys) only.

ScopeAllows
db:read, db:write, db:schemaRead rows, write rows, change the schema
files:read, files:writeRead and upload files (files:write also makes PDFs)
ai, email, web, scan, speech, vectors, cron, seoOne built-in feature each
integrations:*Every built-in feature above
browser, payments, realtimeCloud browser, payments, real-time
logs:read, analytics:read, meter:writeLogs, site analytics, usage reporting
*Everything

Path parameters

ParameterTypeDescription
projectIdstringThe project id

Body parameters

FieldTypeRequiredDescription
namestringYesA name
scopesstring[]YesOne or more scopes from the table
envstringNo"dev", "live" or both (default): the database environment the key may use

Response fields

FieldTypeDescription
data.keyobjectThe key, with the fields of List Project Keys
data.key.plaintextstringThe secret — shown only now

Example request

curl -X POST \
  -H "api-key: tlm_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"backend","scopes":["db:read","db:write","integrations:*"]}' \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/api-keys
Success · 201 Created
json
{ "errors": null, "data": { "key": { "id": "key_01k6xz", "name": "backend", "prefix": "tlm_pk_a1b2", "scopes": ["db:read", "db:write", "integrations:*"], "env": "both", "createdAt": "2026-10-08T12:00:00.000Z", "expiresAt": null, "revokedAt": null, "plaintext": "tlm_pk_a1b2…" } } }

Error codes

CodeHTTPMeaning
INVALID_SCOPES400Empty or unknown scopes; the message lists the valid ones
OWNER_ONLY403Only the owner or a member allowed to manage API keys
PROJECT_NOT_READY409The project is still being set up; retry after Retry-After seconds
End of Create Project API KeyNext endpointPOSTRotate Project Key

#Rotate Project Key

POST/api/v1/vcaas/projects/:projectId/api-keys/:keyId/rotateapi-keyFree

Replace a key with a new secret (same name, scopes and environment); the old one stops at once. For the app's own key, the new key reaches the app before the old one stops.

Path parameters

ParameterTypeDescription
projectIdstringThe project id
keyIdstringThe key id

Response fields

FieldTypeDescription
data.keyobjectThe new key, with plaintext (shown once)

Example request

curl -X POST -H "api-key: tlm_sk_your_key" \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/api-keys/key_01k6xz/rotate
Success · 201 Created
json
{ "errors": null, "data": { "key": { "id": "key_01k6y0", "name": "backend", "prefix": "tlm_pk_c3d4", "scopes": ["db:read", "db:write", "integrations:*"], "env": "both", "createdAt": "2026-10-08T12:10:00.000Z", "expiresAt": null, "revokedAt": null, "plaintext": "tlm_pk_c3d4…" } } }

Error codes

CodeHTTPMeaning
KEY_NOT_FOUND404Unknown or already revoked
OWNER_ONLY403Only the owner or a member allowed to manage API keys

#Revoke Project Key

DELETE/api/v1/vcaas/projects/:projectId/api-keys/:keyIdapi-keyFree

Revoke a key at once.

Path parameters

ParameterTypeDescription
projectIdstringThe project id
keyIdstringThe key id

Response fields

FieldTypeDescription
data.revokedbooleantrue

Example request

curl -X DELETE -H "api-key: tlm_sk_your_key" \
  https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/api-keys/key_01k6y0
Success · 200 OK
json
{ "errors": null, "data": { "revoked": true } }

Error codes

CodeHTTPMeaning
KEY_NOT_FOUND404Unknown or already revoked
KEY_MANAGED409The app's own key or the .env key: rotate it instead
OWNER_ONLY403Only the owner or a member allowed to manage API keys
End of Revoke Project KeyNext endpointGETGet Project Env

#Get Project Env

GET/api/v1/vcaas/projects/:projectId/envapi-keyFree

The project's .env file for one environment, as plain text (not JSON): the project key, the auth secret, the URLs and that environment's secrets. Save it as .env (dev) or .env.prod (live) next to the downloaded source to run the app locally; never commit it. Owner (or a member allowed to manage API keys) only.

Path parameters

ParameterTypeDescription
projectIdstringThe project id

Query parameters

FieldTypeRequiredDescription
envstringYes"dev" or "live"

Response fields

FieldTypeDescription
(body)textThe .env file (Content-Disposition: attachment)

Example request

curl -H "api-key: tlm_sk_your_key" -o .env \
  "https://builder-api.totalum.app/api/v1/vcaas/projects/barber-bookings/env?env=dev"

Error codes

CodeHTTPMeaning
INVALID_ENV400env is not dev or live
OWNER_ONLY403Only the owner or a member allowed to manage API keys
End of Get Project Env Back to top