Skip to content

Variables API

Service variables.

11 operations. Every call needs a session cookie or an Authorization: Bearer nct_… token unless marked Public. Conventions, errors and scopes

POST/environments/{environmentId}/env-template-preview

Preview the .env.example keys of a repository before creating its service

Like the service scan, for a repository that has no service yet: nothing is created or stored. The suggestions can reference the databases of the environment. Give a git connection and repository, or a repository URL (with gitToken for a private one); serverId is the server a read that needs an agent (Bitbucket, other hosts, a pasted token) runs on. The pasted token is used for this read only and never stored. A repository that cannot be read answers status: unavailable with the reason.

ParameterInTypeDescription
environmentIdrequiredpathstring
Request body · application/json · required
EnvTemplatePreviewInput
  • branchstring
    Defaults to the repository's default branch
  • buildContextstring
    Build context directory, read as well as the repository root
  • connectionIdstring
    Git connection the repository is read through
  • gitTokenstring
    Access token of a private repository, used for this read only and never stored
  • gitUrlstring
    Clone URL of the repository (https, public or with gitToken)
  • repostring
    owner/name on the connection
  • serverIdstring
    The server a read that needs an agent runs on
Response 200 · OK · application/json
EnvTemplateScan
  • branchstring
  • commitstring
    Commit the files were read from (agent reads only)
  • EnvTemplateFile[] | nullrequired
  • SuggestedVariable[] | nullrequired
    One suggestion per key not set yet, with smart defaults (database references, generators, safe example values)
  • messagestringrequired
  • methodenum: provider | agent | nonerequired
    provider: read through the git provider's API; agent: read on the server
  • SkippedVariable[] | nullrequired
  • statusenum: found | none | unavailablerequired
    found: files with keys exist; none: the repository has no template file; unavailable: it could not be read (see message)
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

GET/environments/{environmentId}/variable-usage

Which variables reference a variable

ParameterInTypeDescription
environmentIdrequiredpathstring
nsquerystringNamespace: shared (default), team or a service slug
keyrequiredquerystring
Response 200 · OK · application/json
UsageOutputBody
  • VariableUsage[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

POST/services/{serviceId}/env-template-scan

Read a git service's .env.example files again

Reads .env.example, .env.sample, .env.template and .env.dist (never .env or .env.local) from the repository root and the build context at the tracked branch: through the git provider's API when the service is linked to a connection or the repository is public on github.com or gitlab.com, otherwise by a scan-only command on the service's server. The files become the suggestion source of GET /services/{serviceId}/suggested-variables. Returns the keys not set yet with smart defaults; a repository that cannot be read answers status: unavailable with the reason, and nothing changes. Reading re-runs on every push to the tracked branch.

ParameterInTypeDescription
serviceIdrequiredpathstring
Response 200 · OK · application/json
EnvTemplateScan
  • branchstring
  • commitstring
    Commit the files were read from (agent reads only)
  • EnvTemplateFile[] | nullrequired
  • SuggestedVariable[] | nullrequired
    One suggestion per key not set yet, with smart defaults (database references, generators, safe example values)
  • messagestringrequired
  • methodenum: provider | agent | nonerequired
    provider: read through the git provider's API; agent: read on the server
  • SkippedVariable[] | nullrequired
  • statusenum: found | none | unavailablerequired
    found: files with keys exist; none: the repository has no template file; unavailable: it could not be read (see message)
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

GET/services/{serviceId}/suggested-variables

Suggested variables

References to databases of the environment that nothing references yet, and the keys of the repository's .env.example-style files that are not set yet (read before the first deploy, see POST /services/{serviceId}/env-template-scan, and again after every push to the tracked branch and at every build). Accepting a suggestion is a normal staged write; send source: "suggested" for an .env.example key so a value left empty is reported by the deploy plan.

ParameterInTypeDescription
serviceIdrequiredpathstring
Response 200 · OK · application/json
SuggestedVariableList
  • branchstring
    Branch the .env.example files were read from
  • commitstring
    Commit the .env.example files were read from (empty when they were read through the git provider)
  • SuggestedVariable[] | nullrequired
  • SkippedVariable[] | nullrequired
    Keys of the example files left out on purpose (platform variables such as PORT)
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

GET/services/{serviceId}/variables

List a service's variables

Secret values are never returned: they appear as {key, isSecret:true, set:true}. computedSecret is also true for a variable that embeds a secret through a reference. platform lists the reserved variables NebulaCtrl provides; exports the virtual variables other services can reference.

ParameterInTypeDescription
serviceIdrequiredpathstring
Response 200 · OK · application/json
VariableList
  • ExportVar[] | nullrequired
  • Variable[] | nullrequired
  • PlatformVar[] | nullrequired
  • RestagedServiceRef[] | nullrequired
  • VariableWarning[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

PUT/services/{serviceId}/variables

Upsert variables (staged until deployed)

Bulk upsert; variables not listed are untouched. Omitting a value keeps the stored one. Values may reference other services (${{service-slug.KEY}}), the same service (${{KEY}}) and shared variables (${{shared.KEY}}), and may contain generators (${{secret(32)}}, ${{randomInt(1,6)}}, ${{uuid()}}, ${{randomBytes(32,hex)}}) that run once: writing the same text again keeps the generated value. $${{ writes a literal ${{. Variables whose resolved value changes in other services are restaged (restaged). Platform variable names (PORT, NEBULA_*) are rejected with reserved_variable.

ParameterInTypeDescription
serviceIdrequiredpathstring
Request body · application/json · required
PutInputBody2
  • VariableInput[] | nullrequired
Response 200 · OK · application/json
VariableList
  • ExportVar[] | nullrequired
  • Variable[] | nullrequired
  • PlatformVar[] | nullrequired
  • RestagedServiceRef[] | nullrequired
  • VariableWarning[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

DELETE/services/{serviceId}/variables/{key}

Delete a variable (staged until deployed)

ParameterInTypeDescription
serviceIdrequiredpathstring
keyrequiredpathstring
Response 204 · No Content

No body.

Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

GET/services/{serviceId}/variables/{key}/history

Version history of a variable

Newest first. Non-secret versions include their value; secrets carry only a fingerprint (equal fingerprints mean equal values).

ParameterInTypeDescription
serviceIdrequiredpathstring
keyrequiredpathstring
Response 200 · OK · application/json
HistoryOutputBody
  • VariableHistoryEntry[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

POST/services/{serviceId}/variables/{key}/history/{version}/restore

Restore an old non-secret version as a new version

Secrets cannot be restored (restore_unsupported); use a release rollback or re-enter the value.

ParameterInTypeDescription
serviceIdrequiredpathstring
keyrequiredpathstring
versionrequiredpathinteger (int64)
Response 200 · OK · application/json
VariableList
  • ExportVar[] | nullrequired
  • Variable[] | nullrequired
  • PlatformVar[] | nullrequired
  • RestagedServiceRef[] | nullrequired
  • VariableWarning[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

POST/services/{serviceId}/variables/{key}/rotate

Rotate a generated variable (plan or stage)

Re-runs the generators of a generated variable. dryRun:true returns the plan (affected services, deploy order, warnings, blockers) and changes nothing; dryRun:false stages the new value and restages the services that consume it. Nothing is deployed. Database credentials and volume-backed passwords are blocked with rotation_unsupported once deployed.

ParameterInTypeDescription
serviceIdrequiredpathstring
keyrequiredpathstring
Request body · application/json · required
VariableRotateBody
  • dryRunbooleanrequired
    true returns the plan and changes nothing; false stages the new value (nothing is deployed)
Response 200 · OK · application/json
VariableRotationPlan
  • RotationAffected[] | nullrequired
  • RotationBlocker[] | nullrequired
  • deployOrderstring[] | nullrequired
    Service slugs, providers first
  • keystringrequired
  • kindenum: app-secret | engine-boundrequired
  • stagedbooleanrequired
  • warningsstring[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.

POST/services/{serviceId}/variables/validate

Validate a draft value

Parses the draft, checks generator arguments and dry-run resolves its references in the service's environment. Nothing is written and no generated value is returned.

ParameterInTypeDescription
serviceIdrequiredpathstring
Request body · application/json · required
ValidateVariableInput
  • isSecretboolean
  • keystring
    Name of the variable being edited (defaults to a placeholder)
  • valuestringrequired
Response 200 · OK · application/json
ValidateVariableResult
  • codestring
  • containsSecretbooleanrequired
    The value is or becomes secret (declared, a secret generator, or a secret reference)
  • SyntaxProblem
  • GeneratorCall[] | nullrequired
  • messagestring
  • okbooleanrequired
  • previewstring
    The resolved value for non-secret drafts
  • RefCheck[] | nullrequired
  • VariableWarning[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

Errors are RFC 9457 application/problem+json with a stable code field.