def update(
slug: str,
patch: ProjectPatch,
*,
product: str | None = None,
timeout: float | None = None,
) -> ProjectResourceasync def update(
slug: str,
patch: ProjectPatch,
*,
product: str | None = None,
timeout: float | None = None,
) -> ProjectResourcePartial 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 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
from envless import envless
project = envless.projects.update(
'api',
{'name': 'API Gateway', 'slug': 'api-gateway'},
product='billing',
)
print(project['slug'])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
project = await envless.projects.update(
'api',
{'name': 'API Gateway', 'slug': 'api-gateway'},
product='billing',
)
print(project['slug'])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | str | Yes | Current project slug, or the project uniqueId. |
patch['name'] | str | No | New project name. |
patch['slug'] | str | No | New slug, which must already be in valid slug form. |
product | str | No | Product slug used to disambiguate an ambiguous project slug. |
timeout | float | No | Seconds each attempt of this call may take, the response body included, before it raises EnvlessNetworkError with is_timeout set. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
ProjectResource reflecting the stored record after the patch.
Worth knowing
- A 409
project.slug_conflictmeans another project in the same product already owns the new slug. - A missing or ambiguous project carries
project.not_foundorproject.ambiguous_product, but the update itself answers 400, 404 and 409 with the genericrequest.invalid,request.not_foundandrequest.conflict, so readmessagefor the reason.
Required scopes
projects:write
Underlying endpoint
PATCH /projects/{slug}
Request and response schema, every error code, and a live playground.
In TypeScript
envless.projects.update()
The same method in @goenvless/sdk, with the same request, retries and errors.