Skip to content

Environments API

Environments.

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

PATCH/environments/{environmentId}

Update an environment

ParameterInTypeDescription
environmentIdrequiredpathstring
Request body · application/json · required
UpdateEnvironmentInputBody
  • isProductionboolean
  • namestring
Response 200 · OK · application/json
Environment
  • createdAtstring (date-time)required
  • idstringrequired
  • isProductionbooleanrequired
  • kindenum: standard | previewrequired
  • namestringrequired
  • parentEnvironmentIdstring | nullrequired
  • prNumberinteger (int64) | nullrequired
  • prTitlestringrequired
  • projectIdstringrequired
  • slugstringrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

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

DELETE/environments/{environmentId}

Delete an empty environment

Fails with 409 environment_not_empty while the environment still has services.

ParameterInTypeDescription
environmentIdrequiredpathstring
Response 204 · No Content

No body.

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

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

POST/environments/{environmentId}/clone

Clone an environment

Creates a new, non-production environment in the same project with a staged copy of every service of the source: configuration, variables, the environment's shared variables, volume definitions, links, repository links and canvas layout. Slugs are kept, so references such as ${{postgres.DATABASE_URL}} point at the cloned siblings. Secrets are copied sealed and generated values are generated again. Databases are created new and empty: restore a dump into them. Volumes are new and empty. Domains are dropped (default) or cloned with a suffix; 409 domain_conflict when a suffixed hostname is taken. Route services and Compose stacks are skipped and listed. Nothing runs until the services are deployed. dryRun returns the plan and changes nothing.

ParameterInTypeDescription
Idempotency-KeyheaderstringClient-chosen key (<=255 chars). A retry with the same key replays the original response for 24 hours.
environmentIdrequiredpathstring
Request body · application/json · required
CloneEnvironmentInputBody
  • domainSuffixstring
    Default: -<new environment slug>
  • domainsenum: drop | suffix
    drop (default) clones no domain; suffix clones each public domain with domainSuffix added to its first label
  • dryRunboolean
    Report what the clone would do and change nothing
  • namestringrequired
  • serverIdstring
    Place every cloned service on this server (default: each service keeps its server)
Response 200 · OK · application/json
CloneResult
  • CloneDomainOutcome[] | nullrequired
  • dryRunbooleanrequired
  • CloneEnvironmentRef
  • linksinteger (int64)required
  • ReferenceFinding[] | nullrequired
  • ServiceView
  • ClonedService[] | nullrequired
  • sharedVariablesinteger (int64)required
  • CloneSkipped[] | nullrequired
  • warningsstring[] | nullrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflictdomain_conflict
  • 422Unprocessable Entity
  • 500Internal Server Error

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

GET/projects/{projectId}/environments

List a project's environments

ParameterInTypeDescription
projectIdrequiredpathstring
Response 200 · OK · application/json
PageEnvironment
  • Environment[] | nullrequired
  • nextCursorstring
    Present when more items exist
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 422Unprocessable Entity
  • 500Internal Server Error

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

POST/projects/{projectId}/environments

Create an environment

ParameterInTypeDescription
Idempotency-KeyheaderstringClient-chosen key (<=255 chars). A retry with the same key replays the original response for 24 hours.
projectIdrequiredpathstring
Request body · application/json · required
CreateEnvironmentInputBody
  • isProductionboolean
  • namestringrequired
Response 201 · Created · application/json
Environment
  • createdAtstring (date-time)required
  • idstringrequired
  • isProductionbooleanrequired
  • kindenum: standard | previewrequired
  • namestringrequired
  • parentEnvironmentIdstring | nullrequired
  • prNumberinteger (int64) | nullrequired
  • prTitlestringrequired
  • projectIdstringrequired
  • slugstringrequired
Errors
  • 401Unauthorized
  • 403Forbidden
  • 404Not Found
  • 409Conflict
  • 422Unprocessable Entity
  • 500Internal Server Error

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