Products

envless.products.list_all_projects()

Collect every project in a product

def list_all_projects(
    slug: str,
    *,
    limit: int | None = None,
    offset: int | None = None,
    search: str | None = None,
    order: str | None = None,
    timeout: float | None = None,
) -> list[ProjectResource]

Walks every page of the projects in a product and returns one flat list. Requests use the maximum page size of 100 until the API reports no more rows.

The pagination envelope is dropped, so call list_projects once when you need totalCount. An unknown product, or a private one with no grant, raises here rather than returning an empty list, which makes this a cheap existence check as well.

Example

from envless import envless

projects = envless.products.list_all_projects('billing')

print([project['slug'] for project in projects])

Parameters

ParameterTypeRequiredDescription
slugstrYesProduct slug, or the product uniqueId when the value is UUID shaped.
limitintNoPage size for each underlying request, capped at 100.
offsetintNoRow to start the walk from.
searchstrNoCase-insensitive substring match against project name and slug.
orderstrNoDefaults to name, which sorts A to Z. Pass asc for oldest first or desc for newest first on createdAt.
timeoutfloatNoSeconds 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

An list[ProjectResource] with every project in the product the key can see.

Reads the projects 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

  • Each returned project still carries its own product summary, so the list is safe to concatenate across products.

Required scopes

products:read and projects:read

Underlying endpoint

GET /products/{slug}/projects

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

In TypeScript

envless.products.listAllProjects()

The same method in @goenvless/sdk, with the same request, retries and errors.