Environments

envless.environments.update()

Rename an environment or change its slug

ts
update(project: string, environment: string, patch: EnvironmentPatch, options?: ProductScope): Promise<EnvironmentResource>

Partially updates the name, the slug or both, addressed by the environment current slug. Unlike create, the new slug is validated as-is rather than slugified, so an uppercase or spaced value returns 400 instead of being cleaned up for you.

This route returns the updated environment with the same fields get returns, exposed and updatedAt included. exposed is read-only here: putting it in the patch is silently ignored, so use expose and unexpose for that. Changing the slug changes the address every later call has to use.

Example

ts
const environment = await envless.environments.update('api', 'production', { name: 'Production EU' })

console.log(environment.exposed, environment.updatedAt)

Parameters

ParameterTypeRequiredDescription
projectstringYesProject slug or uniqueId that owns the environment.
environmentstringYesCurrent environment slug; ids are not accepted.
patch.namestringNoNew display name, 2 to 50 characters.
patch.slugstringNoNew lowercase hyphenated slug, validated as-is and unique within the project.
options.productstringNoProduct slug that disambiguates an ambiguous project slug.
options.signalAbortSignalNoCancels the request.

Returns

EnvironmentResource reflecting the stored values, including exposed and updatedAt.

Worth knowing

  • A slug another environment in the project already owns fails with environment.slug_conflict.

Required scopes

environments:write

Underlying endpoint

PATCH /projects/{slug}/environments/{environmentSlug}

Request and response schema, every error code, and a live playground.

In Python

envless.environments.update()

The same method in envless-sdk, the Python SDK, with the same request, retries and errors.

In Ruby

Envless.environments.update

The same method in envless-sdk, the Ruby gem, with the same request, retries and errors.

In PHP

$envless->environments->update()

The same method in envless/sdk, the PHP SDK, with the same request, retries and errors.