SDK reference

Environment variables and secrets

Each route's function in the SDK, its call beside the same request in cURL.
orgProjectsEnv

GET/v1/orgs/:orgId/projects/:projectId/env

Lists the Serverless App Service's variables, and shared: the organization's shared variables (a Serverless App Service variable with the same key replaces a shared one per environment). Values of sensitive variables are null.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgProjectsEnvValues

GET/v1/orgs/:orgId/projects/:projectId/env/values

One environment's variables as a deployment gets them (shared ones overridden by the Serverless App Service's), for local development (cactive env pull, cactive dev). Sensitive values are null, except development-only secrets marked devReadable when the caller has env:write (audited as env.reveal).

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/values' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgProjectsEnv

POST/v1/orgs/:orgId/projects/:projectId/env

Creates or replaces many variables at once (e.g. a pasted .env file), all with the same environments and sensitivity. Nothing is written unless every key is valid.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "vars": [
      {
        "key": "example",
        "value": "example"
      }
    ],
    "targets": [
      "production"
    ]
  }'
putOrgProjectsEnvByKey

PUT/v1/orgs/:orgId/projects/:projectId/env/:key

Creates or replaces a variable. Omit value to keep the stored value, for example to change the targets of a sensitive variable.

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "targets": [
      "production"
    ]
  }'
deleteOrgProjectsEnvByKey

DELETE/v1/orgs/:orgId/projects/:projectId/env/:key

Deletes a variable. Running deployments keep the value they started with.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgProjectsEnvValue

GET/v1/orgs/:orgId/projects/:projectId/env/:key/value

Reads a value back (version: an earlier one). Sensitive values only as their access rule allows; audited.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}/value' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgProjectsEnvVersions

GET/v1/orgs/:orgId/projects/:projectId/env/:key/versions

The versions kept (when each was set and by whom), newest first.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}/versions' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgProjectsEnvVersionsRestore

POST/v1/orgs/:orgId/projects/:projectId/env/:key/versions/:version/restore

Sets an earlier value again, as a new version. Takes effect on the next deployment.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}/versions/{version}/restore' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
putOrgProjectsEnvSettings

PUT/v1/orgs/:orgId/projects/:projectId/env/:key/settings

A rotation reminder and who may read the value back.

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/projects/{projectId}/env/{key}/settings' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "rotateEveryDays": 1,
    "access": {
      "roles": [],
      "teams": [],
      "ownersOnly": true
    }
  }'
orgEnv

GET/v1/orgs/:orgId/env

Lists the organization's shared variables. Sensitive values are null.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/env' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgEnv

POST/v1/orgs/:orgId/env

Creates or replaces many shared variables at once, all with the same environments and sensitivity.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/env' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "vars": [
      {
        "key": "example",
        "value": "example"
      }
    ],
    "targets": [
      "production"
    ]
  }'
putOrgEnvByKey

PUT/v1/orgs/:orgId/env/:key

Creates or replaces a shared variable. Omit value to keep the stored one.

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "targets": [
      "production"
    ]
  }'
deleteOrgEnvByKey

DELETE/v1/orgs/:orgId/env/:key

Deletes a shared variable. Serverless App Services' own variables with the same key are unaffected.

Parameters and answers
curl -X DELETE 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgEnvValue

GET/v1/orgs/:orgId/env/:key/value

Reads a value back (version: an earlier one). Sensitive values only as their access rule allows; audited.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}/value' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
orgEnvVersions

GET/v1/orgs/:orgId/env/:key/versions

The versions kept (when each was set and by whom), newest first.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}/versions' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
postOrgEnvVersionsRestore

POST/v1/orgs/:orgId/env/:key/versions/:version/restore

Sets an earlier value again, as a new version. Takes effect on the next deployment.

Parameters and answers
curl -X POST 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}/versions/{version}/restore' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"
putOrgEnvSettings

PUT/v1/orgs/:orgId/env/:key/settings

A rotation reminder and who may read the value back.

Parameters and answers
curl -X PUT 'https://api.cactive.com.au/v1/orgs/{orgId}/env/{key}/settings' \
  -H "Authorization: Bearer $CACTIVE_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "rotateEveryDays": 1,
    "access": {
      "roles": [],
      "teams": [],
      "ownersOnly": true
    }
  }'
orgSecrets

GET/v1/orgs/:orgId/secrets

Every secret in the organization (shared ones and each Serverless App Service's sensitive variables): key, targets, current version, last change and by whom, rotation reminder and when it's due, and the access rule. Never values. Also limit, the plan's secretsMax. Needs env:read.

Parameters and answers
curl 'https://api.cactive.com.au/v1/orgs/{orgId}/secrets' \
  -H "Authorization: Bearer $CACTIVE_TOKEN"