Reference
View as MarkdownVariables API
Service variables.
11 operations. Every call needs a session cookie or an Authorization: Bearer nct_… token unless marked Public. Conventions, errors and scopes
/environments/{environmentId}/env-template-previewPreview 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.
| Parameter | In | Type | Description |
|---|---|---|---|
environmentIdrequired | path | string |
Request body · application/json · required
- branchstringDefaults to the repository's default branch
- buildContextstringBuild context directory, read as well as the repository root
- connectionIdstringGit connection the repository is read through
- gitTokenstringAccess token of a private repository, used for this read only and never stored
- gitUrlstringClone URL of the repository (https, public or with gitToken)
- repostringowner/name on the connection
- serverIdstringThe server a read that needs an agent runs on
Response 200 · OK · application/json
- branchstring
- commitstringCommit the files were read from (agent reads only)
- EnvTemplateFile[] | nullrequired
- SuggestedVariable[] | nullrequiredOne suggestion per key not set yet, with smart defaults (database references, generators, safe example values)
- messagestringrequired
- methodenum: provider | agent | nonerequiredprovider: read through the git provider's API; agent: read on the server
- SkippedVariable[] | nullrequired
- statusenum: found | none | unavailablerequiredfound: files with keys exist; none: the repository has no template file; unavailable: it could not be read (see message)
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/environments/{environmentId}/variable-usageWhich variables reference a variable
| Parameter | In | Type | Description |
|---|---|---|---|
environmentIdrequired | path | string | |
ns | query | string | Namespace: shared (default), team or a service slug |
keyrequired | query | string |
Response 200 · OK · application/json
- VariableUsage[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/env-template-scanRead 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Response 200 · OK · application/json
- branchstring
- commitstringCommit the files were read from (agent reads only)
- EnvTemplateFile[] | nullrequired
- SuggestedVariable[] | nullrequiredOne suggestion per key not set yet, with smart defaults (database references, generators, safe example values)
- messagestringrequired
- methodenum: provider | agent | nonerequiredprovider: read through the git provider's API; agent: read on the server
- SkippedVariable[] | nullrequired
- statusenum: found | none | unavailablerequiredfound: files with keys exist; none: the repository has no template file; unavailable: it could not be read (see message)
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/suggested-variablesSuggested 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Response 200 · OK · application/json
- branchstringBranch the .env.example files were read from
- commitstringCommit the .env.example files were read from (empty when they were read through the git provider)
- SuggestedVariable[] | nullrequired
- SkippedVariable[] | nullrequiredKeys of the example files left out on purpose (platform variables such as PORT)
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variablesList 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Response 200 · OK · application/json
- ExportVar[] | nullrequired
- Variable[] | nullrequired
- PlatformVar[] | nullrequired
- RestagedServiceRef[] | nullrequired
- VariableWarning[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variablesUpsert 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Request body · application/json · required
- VariableInput[] | nullrequired
Response 200 · OK · application/json
- ExportVar[] | nullrequired
- Variable[] | nullrequired
- PlatformVar[] | nullrequired
- RestagedServiceRef[] | nullrequired
- VariableWarning[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variables/{key}Delete a variable (staged until deployed)
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string | |
keyrequired | path | string |
Response 204 · No Content
No body.
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variables/{key}/historyVersion history of a variable
Newest first. Non-secret versions include their value; secrets carry only a fingerprint (equal fingerprints mean equal values).
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string | |
keyrequired | path | string |
Response 200 · OK · application/json
- VariableHistoryEntry[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variables/{key}/history/{version}/restoreRestore an old non-secret version as a new version
Secrets cannot be restored (restore_unsupported); use a release rollback or re-enter the value.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string | |
keyrequired | path | string | |
versionrequired | path | integer (int64) |
Response 200 · OK · application/json
- ExportVar[] | nullrequired
- Variable[] | nullrequired
- PlatformVar[] | nullrequired
- RestagedServiceRef[] | nullrequired
- VariableWarning[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variables/{key}/rotateRotate 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string | |
keyrequired | path | string |
Request body · application/json · required
- dryRunbooleanrequiredtrue returns the plan and changes nothing; false stages the new value (nothing is deployed)
Response 200 · OK · application/json
- RotationAffected[] | nullrequired
- RotationBlocker[] | nullrequired
- deployOrderstring[] | nullrequiredService slugs, providers first
- keystringrequired
- kindenum: app-secret | engine-boundrequired
- stagedbooleanrequired
- warningsstring[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.
/services/{serviceId}/variables/validateValidate 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.
| Parameter | In | Type | Description |
|---|---|---|---|
serviceIdrequired | path | string |
Request body · application/json · required
- isSecretboolean
- keystringName of the variable being edited (defaults to a placeholder)
- valuestringrequired
Response 200 · OK · application/json
- codestring
- containsSecretbooleanrequiredThe value is or becomes secret (declared, a secret generator, or a secret reference)
- SyntaxProblem
- GeneratorCall[] | nullrequired
- messagestring
- okbooleanrequired
- previewstringThe resolved value for non-secret drafts
- RefCheck[] | nullrequired
- VariableWarning[] | nullrequired
401Unauthorized403Forbidden404Not Found422Unprocessable Entity500Internal Server Error
Errors are RFC 9457 application/problem+json with a stable code field.