def list(
project: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
product: str | None = None,
timeout: float | None = None,
) -> Page[EnvironmentSummaryResource]async def list(
project: str,
*,
limit: int | None = None,
offset: int | None = None,
search: str | None = None,
order: str | None = None,
product: str | None = None,
timeout: float | None = None,
) -> Page[EnvironmentSummaryResource]Returns one page of the environments in a project, sorted by name A to Z, as items plus a pagination envelope. The project argument resolves as a uniqueId first and then as a slug. Project slugs are only unique inside a product, so set product= whenever the same project slug exists in two products, otherwise the call fails with project.ambiguous_product before it ever looks at environments.
search matches environment name and slug, and order defaults to name, which sorts A to Z, with asc and desc sorting oldest and newest first on createdAt. Each row carries id, name, slug, projectId, exposed, createdAt and updatedAt, the same fields get returns.
Example
from envless import envless
page = envless.environments.list(
'api', product='billing', limit=50
)
print(page['pagination']['totalCount'])
print([environment['slug'] for environment in page['items']])import asyncio
from envless import AsyncEnvless
async def main() -> None:
async with AsyncEnvless() as envless:
page = await envless.environments.list(
'api', product='billing', limit=50
)
print(page['pagination']['totalCount'])
print([environment['slug'] for environment in page['items']])
asyncio.run(main())Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
project | str | Yes | Project slug or uniqueId that owns the environments. |
product | str | No | Product slug that disambiguates an ambiguous project slug. |
limit | int | No | Rows per page, a whole number between 1 and 100. |
offset | int | No | Rows to skip before the page starts. |
search | str | No | Case insensitive substring match on the environment name or slug. |
order | str | No | asc or desc sorts by creation time, oldest or newest first. Anything else, or nothing, sorts by name. |
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
Page[EnvironmentSummaryResource] holding the rows in items and the counts in pagination.
Reads the environments collection. list returns one page as a dict with items and pagination, list_all collects every page into a list, and iterate yields one item at a time, fetching the next page only when the loop reaches it. On AsyncEnvless, iterate is an async iterator for async for.
Worth knowing
- A
limitoutside 1 to 100 is rejected withrequest.invalid_paginationrather than clamped. - A 404 here means no project matched in scope for this key, not that the project has no environments.
Required scopes
environments:read
Underlying endpoint
GET /projects/{slug}/environments
Request and response schema, every error code, and a live playground.
In TypeScript
envless.environments.list()
The same method in @goenvless/sdk, with the same request, retries and errors.