Projects

envless.projects.update()

Rename a project or change its slug

ts
update(slug: string, patch: ProjectPatch, options?: ProductScope): Promise<ProjectResource>

Partial update of name and slug. Send only the fields you want changed. Uniqueness for a new slug is checked inside the project own product, and options.product may still be needed just to resolve which project you meant.

The new slug is validated as sent rather than slugified, so it must already match ^[a-z0-9]+(?:-[a-z0-9]+)*$ or you get 400. There is no product field in the patch: projects cannot be moved between products over the API, and icons are not settable here either.

Example

ts
const project = await envless.projects.update('api', { name: 'API Gateway', slug: 'api-gateway' }, { product: 'billing' })

console.log(project.slug)

Parameters

ParameterTypeRequiredDescription
slugstringYesCurrent project slug, or the project uniqueId.
patch.namestringNoNew project name.
patch.slugstringNoNew slug, which must already be in valid slug form.
options.productstringNoProduct slug used to disambiguate an ambiguous project slug.
options.signalAbortSignalNoCancels the request.

Returns

ProjectResource reflecting the stored record after the patch.

Worth knowing

  • A 409 project.slug_conflict means another project in the same product already owns the new slug.
  • A missing or ambiguous project carries project.not_found or project.ambiguous_product, but the update itself answers 400, 404 and 409 with the generic request.invalid, request.not_found and request.conflict, so read message for the reason.

Required scopes

projects:write

Underlying endpoint

PATCH /projects/{slug}

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

In Python

envless.projects.update()

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

In Ruby

Envless.projects.update

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

In PHP

$envless->projects->update()

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